[Webkit-unassigned] [Bug 70833] SerializedScriptValue: lazy initialization of static nullValue not threadsafe
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Tue Oct 25 13:14:48 PDT 2011
https://bugs.webkit.org/show_bug.cgi?id=70833
--- Comment #1 from David Levin <levin at chromium.org> 2011-10-25 13:14:48 PST ---
(In reply to comment #0)
> For the origin of the change:
> https://bugs.webkit.org/show_bug.cgi?id=41372#c18
>
> For concerns with the implementation, noted while creating a similar method:
> https://bugs.webkit.org/show_bug.cgi?id=60197#c13
>
> Short version - this pattern does not look threadsafe:
>
> Source/WebCore/binding/v8/SerializedScriptValue.cpp(1932):
> > SerializedScriptValue* SerializedScriptValue::nullValue()
> > {
> > DEFINE_STATIC_LOCAL(RefPtr<SerializedScriptValue>, nullValue, (0));
> > if (!nullValue) {
> > Writer writer;
> > writer.writeNull();
> > String wireData = StringImpl::adopt(writer.data());
> > nullValue = adoptRef(new SerializedScriptValue(wireData));
> > }
> > return nullValue.get();
> > }
>
> If this will be called from multiple threads, caching should move to the callers. If it will not be called from multiple threads there should be an assertion. Since SSV is used from Workers, the former is more likely to be true.
But I don't think this method is used from Workers (At least not by postMessage -- I have no idea about idb).
--
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the webkit-unassigned
mailing list