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

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

Issue 2828643002: Make customElements.define faster
Patch Set: Try to make Android builder happy. Created 3 years, 8 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.h
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8PerContextData.h b/third_party/WebKit/Source/bindings/core/v8/V8PerContextData.h
index 8c3a550b3c16f45c893241f5ab777ceb6402295a..2ddc6c2a1a3a1dff757aaf3bdaa140a52bbb8fbb 100644
--- a/third_party/WebKit/Source/bindings/core/v8/V8PerContextData.h
+++ b/third_party/WebKit/Source/bindings/core/v8/V8PerContextData.h
@@ -112,6 +112,16 @@ class CORE_EXPORT V8PerContextData final {
void ClearData(const char* key);
Data* GetData(const char* key);
+ // 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_);
+ }
+
private:
V8PerContextData(v8::Local<v8::Context>);
@@ -135,6 +145,12 @@ class CORE_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.
+ ScopedPersistent<v8::Private> private_custom_element_definition_id_;
+
typedef Vector<std::unique_ptr<V0CustomElementBinding>>
V0CustomElementBindingList;
V0CustomElementBindingList custom_element_bindings_;

Powered by Google App Engine
This is Rietveld 408576698