Chromium Code Reviews| Index: third_party/WebKit/Source/platform/bindings/V8PerContextData.h |
| diff --git a/third_party/WebKit/Source/platform/bindings/V8PerContextData.h b/third_party/WebKit/Source/platform/bindings/V8PerContextData.h |
| index b3bf2a737dc63c24d25e4d02826294997edc23d0..ae3229bb5e9448b02ffbe43524131f1c654d0fe6 100644 |
| --- a/third_party/WebKit/Source/platform/bindings/V8PerContextData.h |
| +++ b/third_party/WebKit/Source/platform/bindings/V8PerContextData.h |
| @@ -97,6 +97,16 @@ class PLATFORM_EXPORT V8PerContextData final { |
| v8::Local<v8::Object>* prototype_object, |
| v8::Local<v8::Function>* interface_object); |
| + // Gets a Private to store custom element definition IDs on a |
| + // function in use as a custom element constructor in this context. |
| + v8::Local<v8::Private> GetPrivateCustomElementDefinitionId() { |
| + if (UNLIKELY(private_custom_element_definition_id_.IsEmpty())) { |
| + private_custom_element_definition_id_.Set(isolate_, |
| + v8::Private::New(isolate_)); |
| + } |
| + return private_custom_element_definition_id_.NewLocal(isolate_); |
| + } |
| + |
| void AddCustomElementBinding(std::unique_ptr<V0CustomElementBinding>); |
| V8DOMActivityLogger* ActivityLogger() const { return activity_logger_; } |
| @@ -136,6 +146,12 @@ class PLATFORM_EXPORT V8PerContextData final { |
| ScopedPersistent<v8::Context> context_; |
| ScopedPersistent<v8::Value> error_prototype_; |
| + // One function may be defined as a custom element constructor |
| + // across multiple contexts simultaneously. Each context tags the |
| + // constructor with a different Private to map the constructor back |
| + // to its definition. |
|
haraken
2017/04/28 08:49:30
Can we use V8PrivateProperty instead?
|
| + ScopedPersistent<v8::Private> private_custom_element_definition_id_; |
| + |
| typedef Vector<std::unique_ptr<V0CustomElementBinding>> |
| V0CustomElementBindingList; |
| V0CustomElementBindingList custom_element_bindings_; |