Chromium Code Reviews| Index: third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp |
| diff --git a/third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp b/third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp |
| index 77d1a1ab3dc07c8734a8aef35a79b05615d20f55..244957087705078247efa0501819c196df166d3b 100644 |
| --- a/third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp |
| +++ b/third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp |
| @@ -31,6 +31,7 @@ |
| #include "bindings/core/v8/GeneratedCodeHelper.h" // just for DCHECK |
| #include "bindings/core/v8/V8ObjectConstructor.h" |
| #include "bindings/core/v8/V8PerContextData.h" |
| +#include "bindings/core/v8/WindowProxy.h" |
| #include "platform/TraceEvent.h" |
| namespace blink { |
| @@ -91,10 +92,10 @@ void installAttributeInternal(v8::Isolate* isolate, v8::Local<v8::Object> instan |
| } |
| template <class FunctionOrTemplate> |
| -v8::Local<FunctionOrTemplate> createAccessorFunctionOrTemplate(v8::Isolate*, v8::FunctionCallback, V8DOMConfiguration::FastAccessorBuilderCallback, v8::Local<v8::Value> data, v8::Local<v8::Signature>, int length); |
| +v8::Local<FunctionOrTemplate> createAccessorFunctionOrTemplate(v8::Isolate*, v8::FunctionCallback, V8DOMConfiguration::FastAccessorBuilderCallback, V8DOMConfiguration::PrivatePropertyCallback, v8::Local<v8::Value> data, v8::Local<v8::Signature>, int length); |
| template <> |
| -v8::Local<v8::FunctionTemplate> createAccessorFunctionOrTemplate<v8::FunctionTemplate>(v8::Isolate* isolate, v8::FunctionCallback callback, V8DOMConfiguration::FastAccessorBuilderCallback fastCallback, v8::Local<v8::Value> data, v8::Local<v8::Signature> signature, int length) |
| +v8::Local<v8::FunctionTemplate> createAccessorFunctionOrTemplate<v8::FunctionTemplate>(v8::Isolate* isolate, v8::FunctionCallback callback, V8DOMConfiguration::FastAccessorBuilderCallback fastCallback, V8DOMConfiguration::PrivatePropertyCallback surrogateProperty, v8::Local<v8::Value> data, v8::Local<v8::Signature> signature, int length) |
| { |
| v8::Local<v8::FunctionTemplate> functionTemplate; |
| if (callback) { |
| @@ -104,7 +105,12 @@ v8::Local<v8::FunctionTemplate> createAccessorFunctionOrTemplate<v8::FunctionTem |
| DCHECK(fab); |
| functionTemplate = v8::FunctionTemplate::NewWithFastHandler(isolate, callback, fab, data, signature, length); |
| } else { |
| - functionTemplate = v8::FunctionTemplate::New(isolate, callback, data, signature, length); |
| + if (surrogateProperty) { |
| + functionTemplate = v8::FunctionTemplate::NewSurrogate(isolate, callback, |
| + surrogateProperty(isolate), data, signature, length); |
| + } else { |
| + functionTemplate = v8::FunctionTemplate::New(isolate, callback, data, signature, length); |
| + } |
| } |
| if (!functionTemplate.IsEmpty()) { |
| @@ -116,12 +122,12 @@ v8::Local<v8::FunctionTemplate> createAccessorFunctionOrTemplate<v8::FunctionTem |
| } |
| template <> |
| -v8::Local<v8::Function> createAccessorFunctionOrTemplate<v8::Function>(v8::Isolate* isolate, v8::FunctionCallback callback, V8DOMConfiguration::FastAccessorBuilderCallback, v8::Local<v8::Value> data, v8::Local<v8::Signature> signature, int length) |
| +v8::Local<v8::Function> createAccessorFunctionOrTemplate<v8::Function>(v8::Isolate* isolate, v8::FunctionCallback callback, V8DOMConfiguration::FastAccessorBuilderCallback, V8DOMConfiguration::PrivatePropertyCallback, v8::Local<v8::Value> data, v8::Local<v8::Signature> signature, int length) |
| { |
| if (!callback) |
| return v8::Local<v8::Function>(); |
| - v8::Local<v8::FunctionTemplate> functionTemplate = createAccessorFunctionOrTemplate<v8::FunctionTemplate>(isolate, callback, nullptr, data, signature, length); |
| + v8::Local<v8::FunctionTemplate> functionTemplate = createAccessorFunctionOrTemplate<v8::FunctionTemplate>(isolate, callback, nullptr, nullptr, data, signature, length); |
| if (functionTemplate.IsEmpty()) |
| return v8::Local<v8::Function>(); |
| @@ -162,8 +168,8 @@ void installAccessorInternal(v8::Isolate* isolate, v8::Local<ObjectOrTemplate> i |
| if (accessor.propertyLocationConfiguration & |
| (V8DOMConfiguration::OnInstance | V8DOMConfiguration::OnPrototype)) { |
| - v8::Local<FunctionOrTemplate> getter = createAccessorFunctionOrTemplate<FunctionOrTemplate>(isolate, getterCallback, fastGetterCallback, data, signature, 0); |
| - v8::Local<FunctionOrTemplate> setter = createAccessorFunctionOrTemplate<FunctionOrTemplate>(isolate, setterCallback, nullptr, data, signature, 1); |
| + v8::Local<FunctionOrTemplate> getter = createAccessorFunctionOrTemplate<FunctionOrTemplate>(isolate, getterCallback, fastGetterCallback, accessor.surrogatePropertyCallback, data, signature, 0); |
| + v8::Local<FunctionOrTemplate> setter = createAccessorFunctionOrTemplate<FunctionOrTemplate>(isolate, setterCallback, nullptr, 0, data, signature, 1); |
|
jochen (gone - plz use gerrit)
2016/09/19 14:54:19
you still have some 0 in your CL that should be nu
haraken
2016/09/20 05:53:25
You don't need to worry about 0 or nullptr in this
|
| if (accessor.propertyLocationConfiguration & V8DOMConfiguration::OnInstance) |
| instanceOrTemplate->SetAccessorProperty(name, getter, setter, static_cast<v8::PropertyAttribute>(accessor.attribute), static_cast<v8::AccessControl>(accessor.settings)); |
| if (accessor.propertyLocationConfiguration & V8DOMConfiguration::OnPrototype) |
| @@ -173,8 +179,8 @@ void installAccessorInternal(v8::Isolate* isolate, v8::Local<ObjectOrTemplate> i |
| // Attributes installed on the interface object must be static |
| // attributes, so no need to specify a signature, i.e. no need to do |
| // type check against a holder. |
| - v8::Local<FunctionOrTemplate> getter = createAccessorFunctionOrTemplate<FunctionOrTemplate>(isolate, getterCallback, fastGetterCallback, data, v8::Local<v8::Signature>(), 0); |
| - v8::Local<FunctionOrTemplate> setter = createAccessorFunctionOrTemplate<FunctionOrTemplate>(isolate, setterCallback, nullptr, data, v8::Local<v8::Signature>(), 1); |
| + v8::Local<FunctionOrTemplate> getter = createAccessorFunctionOrTemplate<FunctionOrTemplate>(isolate, getterCallback, fastGetterCallback, 0, data, v8::Local<v8::Signature>(), 0); |
| + v8::Local<FunctionOrTemplate> setter = createAccessorFunctionOrTemplate<FunctionOrTemplate>(isolate, setterCallback, nullptr, 0, data, v8::Local<v8::Signature>(), 1); |
| interfaceOrTemplate->SetAccessorProperty(name, getter, setter, static_cast<v8::PropertyAttribute>(accessor.attribute), static_cast<v8::AccessControl>(accessor.settings)); |
| } |
| } |