Changeset 128361 in webkit
- Timestamp:
- Sep 12, 2012 2:36:48 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r128353 r128361 1 2012-09-12 Adam Barth <abarth@chromium.org> 2 3 [V8] V8DOMWrapper::constructorForType is unnecessary now that we can get V8PerContextData from the v8::Context 4 https://bugs.webkit.org/show_bug.cgi?id=96556 5 6 Reviewed by Eric Seidel. 7 8 These functions no longer serve a purpose now that we can get the 9 V8PerContextData directly from the context. Previously we had to find 10 the Frame in order to find the per-context data. 11 12 * bindings/scripts/CodeGeneratorV8.pm: 13 (GenerateConstructorGetter): 14 * bindings/v8/V8DOMWindowShell.cpp: 15 (WebCore::V8DOMWindowShell::installDOMWindow): 16 * bindings/v8/V8DOMWrapper.cpp: 17 (WebCore::V8DOMWrapper::instantiateV8Object): 18 * bindings/v8/V8DOMWrapper.h: 19 (V8DOMWrapper): 20 * bindings/v8/V8PerContextData.cpp: 21 (WebCore::V8PerContextData::from): 22 * bindings/v8/V8PerContextData.h: 23 (V8PerContextData): 24 - Changed this function to accept an arbitrary context rather than 25 requiring the caller to use the current context. 26 1 27 2012-09-12 Sheriff Bot <webkit.review.bot@gmail.com> 2 28 -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm
r128248 r128361 805 805 v8::Handle<v8::Value> data = info.Data(); 806 806 ASSERT(data->IsExternal() || data->IsNumber()); 807 WrapperTypeInfo* type = WrapperTypeInfo::unwrap(data); 808 END 809 810 if ($implClassName eq "DOMWindow") { 811 push(@implContentDecls, <<END); 812 // Get the proxy corresponding to the DOMWindow if possible to 813 // make sure that the constructor function is constructed in the 814 // context of the DOMWindow and not in the context of the caller. 815 return V8DOMWrapper::constructorForType(type, V8DOMWindow::toNative(info.Holder())); 816 END 817 } elsif ($dataNode->extendedAttributes->{"IsWorkerContext"}) { 818 push(@implContentDecls, <<END); 819 return V8DOMWrapper::constructorForType(type, V8WorkerContext::toNative(info.Holder())); 820 END 821 } else { 822 push(@implContentDecls, " return v8Undefined();"); 823 } 824 825 push(@implContentDecls, <<END); 807 V8PerContextData* perContextData = V8PerContextData::from(info.Holder()->CreationContext()); 808 if (!perContextData) 809 return v8Undefined(); 810 return perContextData->constructorForType(WrapperTypeInfo::unwrap(data)); 826 811 } 827 812 -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp
r128251 r128361 1040 1040 v8::Handle<v8::Value> data = info.Data(); 1041 1041 ASSERT(data->IsExternal() || data->IsNumber()); 1042 WrapperTypeInfo* type = WrapperTypeInfo::unwrap(data); 1043 return v8Undefined();} 1042 V8PerContextData* perContextData = V8PerContextData::from(info.Holder()->CreationContext()); 1043 if (!perContextData) 1044 return v8Undefined(); 1045 return perContextData->constructorForType(WrapperTypeInfo::unwrap(data)); 1046 } 1044 1047 1045 1048 static void TestObjReplaceableAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) -
trunk/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp
r128159 r128361 436 436 { 437 437 DOMWindow* window = m_frame->document()->domWindow(); 438 v8::Local<v8::Object> windowWrapper = V8ObjectConstructor::newInstance(V8 DOMWrapper::constructorForType(&V8DOMWindow::info, window));438 v8::Local<v8::Object> windowWrapper = V8ObjectConstructor::newInstance(V8PerContextData::from(m_context.get())->constructorForType(&V8DOMWindow::info)); 439 439 if (windowWrapper.IsEmpty()) 440 440 return false; -
trunk/Source/WebCore/bindings/v8/V8DOMWrapper.cpp
r128303 r128361 87 87 } 88 88 89 v8::Local<v8::Function> V8DOMWrapper::constructorForType(WrapperTypeInfo* type, DOMWindow* window)90 {91 Frame* frame = window->frame();92 if (!frame)93 return v8::Local<v8::Function>();94 95 if (V8PerContextData* contextData = perContextDataForCurrentWorld(frame))96 return contextData->constructorForType(type);97 98 return v8::Local<v8::Function>();99 }100 101 #if ENABLE(WORKERS)102 v8::Local<v8::Function> V8DOMWrapper::constructorForType(WrapperTypeInfo* type, WorkerContext*)103 {104 WorkerScriptController* controller = WorkerScriptController::controllerForContext();105 WorkerContextExecutionProxy* proxy = controller ? controller->proxy() : 0;106 return proxy ? proxy->perContextData()->constructorForType(type) : v8::Local<v8::Function>();107 }108 #endif109 110 89 #if ENABLE(WORKERS) 111 90 V8PerContextData* V8DOMWrapper::perContextData(WorkerContext*) … … 151 130 perContextData = perContextDataForCurrentWorld(document->frame()); 152 131 else 153 perContextData = V8PerContextData:: current();132 perContextData = V8PerContextData::from(v8::Context::GetCurrent()); 154 133 155 134 v8::Local<v8::Object> instance = perContextData ? perContextData->createWrapperFromCache(type) : V8ObjectConstructor::newInstance(type->getTemplate()->GetFunction()); -
trunk/Source/WebCore/bindings/v8/V8DOMWrapper.h
r128242 r128361 94 94 static PassRefPtr<NodeFilter> wrapNativeNodeFilter(v8::Handle<v8::Value>); 95 95 96 static v8::Local<v8::Function> constructorForType(WrapperTypeInfo*, DOMWindow*);97 #if ENABLE(WORKERS)98 static v8::Local<v8::Function> constructorForType(WrapperTypeInfo*, WorkerContext*);99 #endif100 101 96 template<typename T> 102 97 static v8::Persistent<v8::Object> setJSWrapperForDOMObject(PassRefPtr<T>, v8::Handle<v8::Object>, v8::Isolate* = 0); -
trunk/Source/WebCore/bindings/v8/V8PerContextData.cpp
r127972 r128361 38 38 namespace WebCore { 39 39 40 V8PerContextData* V8PerContextData:: current()40 V8PerContextData* V8PerContextData::from(v8::Handle<v8::Context> context) 41 41 { 42 v8::Handle<v8::Value> wrappedPerContextData = toInnerGlobalObject( v8::Context::GetCurrent())->GetHiddenValue(V8HiddenPropertyName::perContextData());42 v8::Handle<v8::Value> wrappedPerContextData = toInnerGlobalObject(context)->GetHiddenValue(V8HiddenPropertyName::perContextData()); 43 43 if (wrappedPerContextData.IsEmpty()) 44 44 return 0; -
trunk/Source/WebCore/bindings/v8/V8PerContextData.h
r127978 r128361 54 54 bool init(); 55 55 56 static V8PerContextData* current();56 static V8PerContextData* from(v8::Handle<v8::Context>); 57 57 58 58 // To create JS Wrapper objects, we create a cache of a 'boiler plate'
Note: See TracChangeset
for help on using the changeset viewer.