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 6ba91f90f2b367f41ae0b675ab5120949308f498..fcbfe30665c93732a58fbb67a0a89ef6936f5e67 100644 |
--- a/third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp |
+++ b/third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp |
@@ -157,6 +157,7 @@ v8::Local<FunctionOrTemplate> CreateAccessorFunctionOrTemplate( |
v8::Isolate*, |
v8::FunctionCallback, |
V8DOMConfiguration::CachedPropertyKey, |
+ V8DOMConfiguration::CachedAccessorInitCallback, |
v8::Local<v8::Value> data, |
v8::Local<v8::Signature>, |
int length); |
@@ -167,15 +168,23 @@ CreateAccessorFunctionOrTemplate<v8::FunctionTemplate>( |
v8::Isolate* isolate, |
v8::FunctionCallback callback, |
V8DOMConfiguration::CachedPropertyKey cached_property_key, |
+ V8DOMConfiguration::CachedAccessorInitCallback |
+ cached_accessor_init_callback, |
v8::Local<v8::Value> data, |
v8::Local<v8::Signature> signature, |
int length) { |
v8::Local<v8::FunctionTemplate> function_template; |
if (callback) { |
if (cached_property_key) { |
- function_template = v8::FunctionTemplate::NewWithCache( |
- isolate, callback, cached_property_key(isolate), data, signature, |
- length); |
+ if (cached_accessor_init_callback) { |
+ function_template = v8::FunctionTemplate::NewWithLazyCache( |
+ isolate, callback, cached_property_key(isolate), |
+ cached_accessor_init_callback, data, signature, length); |
+ } else { |
+ function_template = v8::FunctionTemplate::NewWithCache( |
+ isolate, callback, cached_property_key(isolate), data, signature, |
+ length); |
+ } |
} else { |
function_template = |
v8::FunctionTemplate::New(isolate, callback, data, signature, length); |
@@ -194,6 +203,7 @@ v8::Local<v8::Function> CreateAccessorFunctionOrTemplate<v8::Function>( |
v8::Isolate* isolate, |
v8::FunctionCallback callback, |
V8DOMConfiguration::CachedPropertyKey, |
+ V8DOMConfiguration::CachedAccessorInitCallback, |
v8::Local<v8::Value> data, |
v8::Local<v8::Signature> signature, |
int length) { |
@@ -202,7 +212,7 @@ v8::Local<v8::Function> CreateAccessorFunctionOrTemplate<v8::Function>( |
v8::Local<v8::FunctionTemplate> function_template = |
CreateAccessorFunctionOrTemplate<v8::FunctionTemplate>( |
- isolate, callback, nullptr, data, signature, length); |
+ isolate, callback, nullptr, nullptr, data, signature, length); |
if (function_template.IsEmpty()) |
return v8::Local<v8::Function>(); |
@@ -228,8 +238,11 @@ void InstallAccessorInternal( |
v8::FunctionCallback getter_callback = accessor.getter; |
v8::FunctionCallback setter_callback = accessor.setter; |
V8DOMConfiguration::CachedPropertyKey cached_property_key = nullptr; |
+ V8DOMConfiguration::CachedAccessorInitCallback cached_accessor_init_callback = |
+ nullptr; |
if (world.IsMainWorld()) { |
cached_property_key = accessor.cached_property_key; |
+ cached_accessor_init_callback = accessor.cached_accessor_init_callback; |
} |
// Support [LenientThis] by not specifying the signature. V8 does not do |
@@ -246,10 +259,11 @@ void InstallAccessorInternal( |
(V8DOMConfiguration::kOnInstance | V8DOMConfiguration::kOnPrototype)) { |
v8::Local<FunctionOrTemplate> getter = |
CreateAccessorFunctionOrTemplate<FunctionOrTemplate>( |
- isolate, getter_callback, cached_property_key, data, signature, 0); |
+ isolate, getter_callback, cached_property_key, |
+ cached_accessor_init_callback, data, signature, 0); |
v8::Local<FunctionOrTemplate> setter = |
CreateAccessorFunctionOrTemplate<FunctionOrTemplate>( |
- isolate, setter_callback, nullptr, data, signature, 1); |
+ isolate, setter_callback, nullptr, nullptr, data, signature, 1); |
if (accessor.property_location_configuration & |
V8DOMConfiguration::kOnInstance) { |
instance_or_template->SetAccessorProperty( |
@@ -270,12 +284,12 @@ void InstallAccessorInternal( |
// type check against a holder. |
v8::Local<FunctionOrTemplate> getter = |
CreateAccessorFunctionOrTemplate<FunctionOrTemplate>( |
- isolate, getter_callback, nullptr, data, v8::Local<v8::Signature>(), |
- 0); |
+ isolate, getter_callback, nullptr, nullptr, data, |
+ v8::Local<v8::Signature>(), 0); |
v8::Local<FunctionOrTemplate> setter = |
CreateAccessorFunctionOrTemplate<FunctionOrTemplate>( |
- isolate, setter_callback, nullptr, data, v8::Local<v8::Signature>(), |
- 1); |
+ isolate, setter_callback, nullptr, nullptr, data, |
+ v8::Local<v8::Signature>(), 1); |
interface_or_template->SetAccessorProperty( |
name, getter, setter, |
static_cast<v8::PropertyAttribute>(accessor.attribute)); |