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..292f86bed06af745541b05496ea41a545bdde531 100644 |
--- a/third_party/WebKit/Source/core/dom/custom/CustomElementsRegistry.h |
+++ b/third_party/WebKit/Source/core/dom/custom/CustomElementsRegistry.h |
@@ -5,18 +5,17 @@ |
#ifndef CustomElementsRegistry_h |
#define CustomElementsRegistry_h |
-#include "bindings/core/v8/ScopedPersistent.h" |
#include "bindings/core/v8/ScriptWrappable.h" |
#include "core/CoreExport.h" |
#include "platform/heap/Handle.h" |
-#include "v8.h" |
-#include "wtf/HashSet.h" |
+#include "wtf/Noncopyable.h" |
#include "wtf/text/AtomicString.h" |
#include "wtf/text/AtomicStringHash.h" |
namespace blink { |
class CustomElementDefinition; |
+class CustomElementDefinitionBuilder; |
class ElementRegistrationOptions; |
class ExceptionState; |
class ScriptState; |
@@ -27,10 +26,9 @@ class CORE_EXPORT CustomElementsRegistry final |
: public GarbageCollectedFinalized<CustomElementsRegistry> |
, public ScriptWrappable { |
DEFINE_WRAPPERTYPEINFO(); |
+ WTF_MAKE_NONCOPYABLE(CustomElementsRegistry); |
public: |
- using Id = uint32_t; |
static CustomElementsRegistry* create( |
- ScriptState*, |
V0CustomElementRegistrationContext*); |
void define( |
@@ -40,37 +38,30 @@ public: |
const ElementRegistrationOptions&, |
ExceptionState&); |
- CustomElementDefinition* definitionForConstructor( |
- ScriptState*, |
- v8::Local<v8::Value> constructor); |
- v8::Local<v8::Object> prototype( |
- ScriptState*, |
- const CustomElementDefinition&); |
+ void define( |
+ const AtomicString& name, |
+ CustomElementDefinitionBuilder&, |
+ const ElementRegistrationOptions&, |
+ ExceptionState&); |
+ |
+ bool nameIsDefined(const AtomicString& name) const |
+ { |
+ return m_definitions.contains(name); |
+ } |
- // TODO(dominicc): Remove this when V0CustomElements are removed. |
- bool nameIsDefined(const AtomicString& name) const; |
+ CustomElementDefinition* definitionForName(const AtomicString& name) const; |
DECLARE_TRACE(); |
private: |
CustomElementsRegistry(const V0CustomElementRegistrationContext*); |
+ bool v0NameIsDefined(const AtomicString&) const; |
- // 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( |
- ScriptState*, |
- v8::Local<v8::Value> constructor, |
- Id&) WARN_UNUSED_RETURN; |
- |
- bool v0NameIsDefined(const AtomicString& name); |
+ using DefinitionMap = |
+ HeapHashMap<AtomicString, Member<CustomElementDefinition>>; |
+ DefinitionMap m_definitions; |
Member<const V0CustomElementRegistrationContext> m_v0; |
- HeapVector<Member<CustomElementDefinition>> m_definitions; |
- HashSet<AtomicString> m_names; |
}; |
} // namespace blink |