Chromium Code Reviews| Index: third_party/WebKit/Source/core/dom/custom/CustomElementsRegistry.h |
| diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementsRegistry.h b/third_party/WebKit/Source/core/dom/custom/CustomElementsRegistry.h |
| index de7d2aaa98ccb722181a7683df4dfefd92421b95..1973aa24a8e76a0233cd78c8551d3af57079a7a2 100644 |
| --- a/third_party/WebKit/Source/core/dom/custom/CustomElementsRegistry.h |
| +++ b/third_party/WebKit/Source/core/dom/custom/CustomElementsRegistry.h |
| @@ -29,9 +29,8 @@ class CORE_EXPORT CustomElementsRegistry final |
| DEFINE_WRAPPERTYPEINFO(); |
| public: |
| using Id = uint32_t; |
| - static CustomElementsRegistry* create( |
| - ScriptState*, |
| - V0CustomElementRegistrationContext*); |
| + |
| + static CustomElementsRegistry* create(V0CustomElementRegistrationContext*); |
| void define( |
| ScriptState*, |
| @@ -55,10 +54,15 @@ public: |
| private: |
| CustomElementsRegistry(const V0CustomElementRegistrationContext*); |
| + void ensureScriptInitialized(ScriptState* scriptState) |
| + { |
| + if (State::ScriptNotInitialized == m_state) |
| + initializeScript(scriptState); |
| + } |
| + void initializeScript(ScriptState*); |
| + |
| // Retrieves the Map which, given a constructor, contains the id |
| // of the definition; or given an id, contains the prototype. |
| - // Returns true if the map was retrieved; false if the map was |
| - // not initialized yet. |
| v8::Local<v8::Map> idMap(ScriptState*); |
| bool idForConstructor( |
| @@ -68,6 +72,12 @@ private: |
| bool v0NameIsDefined(const AtomicString& name); |
| + enum class State { |
|
esprehn
2016/05/21 01:47:02
We should be able to null check something instead,
|
| + ScriptNotInitialized, |
| + ScriptInitialized |
| + }; |
| + State m_state; |
| + |
| Member<const V0CustomElementRegistrationContext> m_v0; |
| HeapVector<Member<CustomElementDefinition>> m_definitions; |
| HashSet<AtomicString> m_names; |