Changeset 117377 in webkit
- Timestamp:
- May 16, 2012 6:36:11 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r117376 r117377 1 2012-05-16 Joshua Bell <jsbell@chromium.org> 2 3 SerializedScriptValue: lazy initialization of static nullValue not threadsafe 4 https://bugs.webkit.org/show_bug.cgi?id=70833 5 6 Reviewed by Kentaro Hara. 7 8 Remove unsafe lazy initialization of static |null| SSV. None of the callers 9 appeared to be in performance-critical areas - most were preparing an event to 10 be dispatched to script - so no per-call-site caching was added. 11 12 No new tests - no functional changes. 13 14 * bindings/js/SerializedScriptValue.cpp: Mint a new one each time. 15 (WebCore::SerializedScriptValue::nullValue): 16 * bindings/js/SerializedScriptValue.h: Return via PassRefPtr. 17 * bindings/v8/SerializedScriptValue.cpp: Mint a new one each time. 18 (WebCore::SerializedScriptValue::nullValue): 19 * bindings/v8/SerializedScriptValue.h: Return via PassRefPtr. 20 (SerializedScriptValue): 21 * dom/Document.cpp: 22 (WebCore::Document::statePopped): Change to PassRefPtr to maintain refcount. 23 * dom/Document.h: 24 (Document): 25 1 26 2012-05-16 James Robinson <jamesr@chromium.org> 2 27 -
trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp
r114992 r117377 1860 1860 } 1861 1861 1862 SerializedScriptValue* SerializedScriptValue::nullValue() 1863 { 1864 DEFINE_STATIC_LOCAL(RefPtr<SerializedScriptValue>, emptyValue, (SerializedScriptValue::create())); 1865 return emptyValue.get(); 1862 PassRefPtr<SerializedScriptValue> SerializedScriptValue::nullValue() 1863 { 1864 return SerializedScriptValue::create(); 1866 1865 } 1867 1866 -
trunk/Source/WebCore/bindings/js/SerializedScriptValue.h
r111044 r117377 79 79 80 80 static PassRefPtr<SerializedScriptValue> create(); 81 static SerializedScriptValue*nullValue();81 static PassRefPtr<SerializedScriptValue> nullValue(); 82 82 static PassRefPtr<SerializedScriptValue> undefinedValue(); 83 83 static PassRefPtr<SerializedScriptValue> booleanValue(bool value); -
trunk/Source/WebCore/bindings/v8/SerializedScriptValue.cpp
r115374 r117377 2099 2099 } 2100 2100 2101 SerializedScriptValue*SerializedScriptValue::nullValue(v8::Isolate* isolate)2101 PassRefPtr<SerializedScriptValue> SerializedScriptValue::nullValue(v8::Isolate* isolate) 2102 2102 { 2103 // FIXME: This is not thread-safe. Move caching to callers. 2104 // https://bugs.webkit.org/show_bug.cgi?id=70833 2105 DEFINE_STATIC_LOCAL(RefPtr<SerializedScriptValue>, nullValue, (0)); 2106 if (!nullValue) { 2107 Writer writer(isolate); 2108 writer.writeNull(); 2109 String wireData = StringImpl::adopt(writer.data()); 2110 nullValue = adoptRef(new SerializedScriptValue(wireData)); 2111 } 2112 return nullValue.get(); 2103 Writer writer(isolate); 2104 writer.writeNull(); 2105 String wireData = StringImpl::adopt(writer.data()); 2106 return adoptRef(new SerializedScriptValue(wireData)); 2113 2107 } 2114 2108 -
trunk/Source/WebCore/bindings/v8/SerializedScriptValue.h
r115229 r117377 59 59 static PassRefPtr<SerializedScriptValue> create(); 60 60 61 static SerializedScriptValue*nullValue(v8::Isolate* = 0);61 static PassRefPtr<SerializedScriptValue> nullValue(v8::Isolate* = 0); 62 62 static PassRefPtr<SerializedScriptValue> undefinedValue(v8::Isolate* = 0); 63 63 static PassRefPtr<SerializedScriptValue> booleanValue(bool value, v8::Isolate* = 0); -
trunk/Source/WebCore/dom/Document.cpp
r117323 r117377 5061 5061 } 5062 5062 5063 void Document::statePopped( SerializedScriptValue*stateObject)5063 void Document::statePopped(PassRefPtr<SerializedScriptValue> stateObject) 5064 5064 { 5065 5065 if (!frame()) -
trunk/Source/WebCore/dom/Document.h
r117029 r117377 1051 1051 1052 1052 void updateURLForPushOrReplaceState(const KURL&); 1053 void statePopped( SerializedScriptValue*);1053 void statePopped(PassRefPtr<SerializedScriptValue>); 1054 1054 1055 1055 bool processingLoadEvent() const { return m_processingLoadEvent; }
Note: See TracChangeset
for help on using the changeset viewer.