Changeset 136168 in webkit
- Timestamp:
- Nov 29, 2012, 2:59:14 PM (14 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 6 edited
-
ChangeLog (modified) (1 diff)
-
bindings/scripts/CodeGeneratorV8.pm (modified) (4 diffs)
-
bindings/scripts/test/V8/V8TestCallback.cpp (modified) (7 diffs)
-
bindings/scripts/test/V8/V8TestCallback.h (modified) (2 diffs)
-
bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp (modified) (1 diff)
-
bindings/v8/custom/V8MutationCallbackCustom.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r136167 r136168 1 2012-11-29 Adam Barth <abarth@webkit.org> 2 3 [V8] DOM callbacks shouldn't reimplement ScopedPersistent they should use it 4 https://bugs.webkit.org/show_bug.cgi?id=103662 5 6 Reviewed by Eric Seidel. 7 8 This patch replaces yet another instance of the ScopedPersistent 9 pattern with ScopedPersistent. 10 11 * bindings/scripts/CodeGeneratorV8.pm: 12 (GenerateCallbackHeader): 13 (GenerateCallbackImplementation): 14 * bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp: 15 (WebCore::V8SQLStatementErrorCallback::handleEvent): 16 * bindings/v8/custom/V8MutationCallbackCustom.cpp: 17 (WebCore::V8MutationCallback::handleEvent): 18 1 19 2012-11-29 Min Qin <qinmin@chromium.org> 2 20 -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm
r136015 r136168 3264 3264 push(@unsortedIncludes, "#include \"ActiveDOMCallback.h\""); 3265 3265 push(@unsortedIncludes, "#include \"$interfaceName.h\""); 3266 push(@unsortedIncludes, "#include \"ScopedPersistent.h\""); 3266 3267 push(@unsortedIncludes, "#include \"WorldContextHandle.h\""); 3267 3268 push(@unsortedIncludes, "#include <v8.h>"); … … 3316 3317 { 3317 3318 ${v8InterfaceName}* object = static_cast<${v8InterfaceName}*>(parameter); 3318 object->m_callback.Dispose(); 3319 object->m_callback.Clear(); 3320 } 3321 3322 // FIXME: m_callback should be a ScopedPersistent. 3323 v8::Persistent<v8::Object> m_callback; 3319 object->m_callback.clear(); 3320 } 3321 3322 ScopedPersistent<v8::Object> m_callback; 3324 3323 WorldContextHandle m_worldContext; 3325 3324 }; … … 3353 3352 ${v8InterfaceName}::${v8InterfaceName}(v8::Handle<v8::Object> callback, ScriptExecutionContext* context, v8::Handle<v8::Object> owner) 3354 3353 : ActiveDOMCallback(context) 3355 , m_callback( v8::Persistent<v8::Object>::New(callback))3354 , m_callback(callback) 3356 3355 , m_worldContext(UseCurrentWorld) 3357 3356 { 3358 if ( !owner.IsEmpty()) {3359 owner->SetHiddenValue(V8HiddenPropertyName::callback(), callback);3360 m_callback.MakeWeak(this, &${v8InterfaceName}::weakCallback);3361 }3357 if (owner.IsEmpty()) 3358 return; 3359 owner->SetHiddenValue(V8HiddenPropertyName::callback(), callback); 3360 m_callback.get().MakeWeak(this, &${v8InterfaceName}::weakCallback); 3362 3361 } 3363 3362 3364 3363 ${v8InterfaceName}::~${v8InterfaceName}() 3365 3364 { 3366 if (!m_callback.IsEmpty())3367 m_callback.Dispose();3368 3365 } 3369 3366 … … 3435 3432 next if $param->type ne $thisType; 3436 3433 my $paramName = $param->name; 3437 push(@implContent, " return !invokeCallback(m_callback , v8::Handle<v8::Object>::Cast(${paramName}Handle), " . scalar(@params) . ", argv, callbackReturnValue, scriptExecutionContext());\n");3434 push(@implContent, " return !invokeCallback(m_callback.get(), v8::Handle<v8::Object>::Cast(${paramName}Handle), " . scalar(@params) . ", argv, callbackReturnValue, scriptExecutionContext());\n"); 3438 3435 last; 3439 3436 } 3440 3437 } else { 3441 push(@implContent, " return !invokeCallback(m_callback , " . scalar(@params) . ", argv, callbackReturnValue, scriptExecutionContext());\n");3438 push(@implContent, " return !invokeCallback(m_callback.get(), " . scalar(@params) . ", argv, callbackReturnValue, scriptExecutionContext());\n"); 3442 3439 } 3443 3440 push(@implContent, "}\n"); -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp
r135305 r136168 42 42 V8TestCallback::V8TestCallback(v8::Handle<v8::Object> callback, ScriptExecutionContext* context, v8::Handle<v8::Object> owner) 43 43 : ActiveDOMCallback(context) 44 , m_callback( v8::Persistent<v8::Object>::New(callback))44 , m_callback(callback) 45 45 , m_worldContext(UseCurrentWorld) 46 46 { 47 if ( !owner.IsEmpty()) {48 owner->SetHiddenValue(V8HiddenPropertyName::callback(), callback);49 m_callback.MakeWeak(this, &V8TestCallback::weakCallback);50 }47 if (owner.IsEmpty()) 48 return; 49 owner->SetHiddenValue(V8HiddenPropertyName::callback(), callback); 50 m_callback.get().MakeWeak(this, &V8TestCallback::weakCallback); 51 51 } 52 52 53 53 V8TestCallback::~V8TestCallback() 54 54 { 55 if (!m_callback.IsEmpty())56 m_callback.Dispose();57 55 } 58 56 … … 76 74 77 75 bool callbackReturnValue = false; 78 return !invokeCallback(m_callback , 0, argv, callbackReturnValue, scriptExecutionContext());76 return !invokeCallback(m_callback.get(), 0, argv, callbackReturnValue, scriptExecutionContext()); 79 77 } 80 78 … … 104 102 105 103 bool callbackReturnValue = false; 106 return !invokeCallback(m_callback , 1, argv, callbackReturnValue, scriptExecutionContext());104 return !invokeCallback(m_callback.get(), 1, argv, callbackReturnValue, scriptExecutionContext()); 107 105 } 108 106 … … 139 137 140 138 bool callbackReturnValue = false; 141 return !invokeCallback(m_callback , 2, argv, callbackReturnValue, scriptExecutionContext());139 return !invokeCallback(m_callback.get(), 2, argv, callbackReturnValue, scriptExecutionContext()); 142 140 } 143 141 … … 167 165 168 166 bool callbackReturnValue = false; 169 return !invokeCallback(m_callback , 1, argv, callbackReturnValue, scriptExecutionContext());167 return !invokeCallback(m_callback.get(), 1, argv, callbackReturnValue, scriptExecutionContext()); 170 168 } 171 169 … … 195 193 196 194 bool callbackReturnValue = false; 197 return !invokeCallback(m_callback , 1, argv, callbackReturnValue, scriptExecutionContext());195 return !invokeCallback(m_callback.get(), 1, argv, callbackReturnValue, scriptExecutionContext()); 198 196 } 199 197 … … 232 230 233 231 bool callbackReturnValue = false; 234 return !invokeCallback(m_callback , v8::Handle<v8::Object>::Cast(thisClassParamHandle), 2, argv, callbackReturnValue, scriptExecutionContext());232 return !invokeCallback(m_callback.get(), v8::Handle<v8::Object>::Cast(thisClassParamHandle), 2, argv, callbackReturnValue, scriptExecutionContext()); 235 233 } 236 234 -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestCallback.h
r135320 r136168 25 25 26 26 #include "ActiveDOMCallback.h" 27 #include "ScopedPersistent.h" 27 28 #include "TestCallback.h" 28 29 #include "WorldContextHandle.h" … … 61 62 { 62 63 V8TestCallback* object = static_cast<V8TestCallback*>(parameter); 63 object->m_callback.Dispose(); 64 object->m_callback.Clear(); 64 object->m_callback.clear(); 65 65 } 66 66 67 // FIXME: m_callback should be a ScopedPersistent. 68 v8::Persistent<v8::Object> m_callback; 67 ScopedPersistent<v8::Object> m_callback; 69 68 WorldContextHandle m_worldContext; 70 69 }; -
trunk/Source/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp
r126399 r136168 74 74 // the error callback did not return false, or there was no error callback. 75 75 // Jump to the last step in the overall steps. 76 return invokeCallback(m_callback , 2, argv, callbackReturnValue, scriptExecutionContext()) || callbackReturnValue;76 return invokeCallback(m_callback.get(), 2, argv, callbackReturnValue, scriptExecutionContext()) || callbackReturnValue; 77 77 } 78 78 -
trunk/Source/WebCore/bindings/v8/custom/V8MutationCallbackCustom.cpp
r126399 r136168 84 84 85 85 bool callbackReturnValue = false; 86 return !invokeCallback(m_callback , v8::Handle<v8::Object>::Cast(observerHandle), 2, argv, callbackReturnValue, scriptExecutionContext());86 return !invokeCallback(m_callback.get(), v8::Handle<v8::Object>::Cast(observerHandle), 2, argv, callbackReturnValue, scriptExecutionContext()); 87 87 } 88 88
Note:
See TracChangeset
for help on using the changeset viewer.