Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(940)

Unified Diff: third_party/WebKit/Source/bindings/core/v8/V8PerContextData.cpp

Issue 1372373002: bindings: Reduces the custom registration of methods. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/bindings/core/v8/V8PerContextData.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8PerContextData.cpp b/third_party/WebKit/Source/bindings/core/v8/V8PerContextData.cpp
index e4b8696a00fb904d662541a0f30b4d997e7e4ed0..e1b8f4d892017bbeecec0da1ee14b0438f7b9398 100644
--- a/third_party/WebKit/Source/bindings/core/v8/V8PerContextData.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/V8PerContextData.cpp
@@ -83,11 +83,11 @@ v8::Local<v8::Object> V8PerContextData::createWrapperFromCacheSlowCase(const Wra
ASSERT(!m_errorPrototype.isEmpty());
v8::Context::Scope scope(context());
- v8::Local<v8::Function> function = constructorForType(type);
- if (function.IsEmpty())
+ v8::Local<v8::Function> interfaceObject = constructorForType(type);
+ if (interfaceObject.IsEmpty())
return v8::Local<v8::Object>();
v8::Local<v8::Object> instanceTemplate;
- if (!V8ObjectConstructor::newInstance(m_isolate, function).ToLocal(&instanceTemplate))
+ if (!V8ObjectConstructor::newInstance(m_isolate, interfaceObject).ToLocal(&instanceTemplate))
return v8::Local<v8::Object>();
m_wrapperBoilerplates.Set(type, instanceTemplate);
return instanceTemplate->Clone();
@@ -102,33 +102,33 @@ v8::Local<v8::Function> V8PerContextData::constructorForTypeSlowCase(const Wrapp
// We shouldn't reach this point for the types that are implemented in v8 such as typed arrays and
// hence don't have domTemplateFunction.
ASSERT(type->domTemplateFunction);
- v8::Local<v8::FunctionTemplate> functionTemplate = type->domTemplate(m_isolate);
+ v8::Local<v8::FunctionTemplate> interfaceTemplate = type->domTemplate(m_isolate);
// Getting the function might fail if we're running out of stack or memory.
- v8::Local<v8::Function> function;
- if (!functionTemplate->GetFunction(currentContext).ToLocal(&function))
+ v8::Local<v8::Function> interfaceObject;
+ if (!interfaceTemplate->GetFunction(currentContext).ToLocal(&interfaceObject))
return v8::Local<v8::Function>();
if (type->parentClass) {
v8::Local<v8::Object> prototypeTemplate = constructorForType(type->parentClass);
if (prototypeTemplate.IsEmpty())
return v8::Local<v8::Function>();
- if (!v8CallBoolean(function->SetPrototype(currentContext, prototypeTemplate)))
+ if (!v8CallBoolean(interfaceObject->SetPrototype(currentContext, prototypeTemplate)))
return v8::Local<v8::Function>();
}
- v8::Local<v8::Object> prototypeObject = function->Get(currentContext, v8AtomicString(m_isolate, "prototype")).ToLocalChecked().As<v8::Object>();
+ v8::Local<v8::Object> prototypeObject = interfaceObject->Get(currentContext, v8AtomicString(m_isolate, "prototype")).ToLocalChecked().As<v8::Object>();
if (prototypeObject->InternalFieldCount() == v8PrototypeInternalFieldcount
&& type->wrapperTypePrototype == WrapperTypeInfo::WrapperTypeObjectPrototype)
prototypeObject->SetAlignedPointerInInternalField(v8PrototypeTypeIndex, const_cast<WrapperTypeInfo*>(type));
- type->preparePrototypeObject(m_isolate, prototypeObject, functionTemplate);
+ type->preparePrototypeAndInterfaceObject(m_isolate, prototypeObject, interfaceObject, interfaceTemplate);
if (type->wrapperTypePrototype == WrapperTypeInfo::WrapperTypeExceptionPrototype) {
if (!v8CallBoolean(prototypeObject->SetPrototype(currentContext, m_errorPrototype.newLocal(m_isolate))))
return v8::Local<v8::Function>();
}
- m_constructorMap.Set(type, function);
+ m_constructorMap.Set(type, interfaceObject);
- return function;
+ return interfaceObject;
}
v8::Local<v8::Object> V8PerContextData::prototypeForType(const WrapperTypeInfo* type)

Powered by Google App Engine
This is Rietveld 408576698