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

Unified Diff: third_party/WebKit/Source/core/dom/custom/CustomElementsRegistry.h

Issue 1952893003: Implement custom element construction and some 'define' checks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove defunct stuff. Created 4 years, 7 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/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 2d78fdf14ae2c61e98158f65c52d807b868eeef2..de7d2aaa98ccb722181a7683df4dfefd92421b95 100644
--- a/third_party/WebKit/Source/core/dom/custom/CustomElementsRegistry.h
+++ b/third_party/WebKit/Source/core/dom/custom/CustomElementsRegistry.h
@@ -5,34 +5,72 @@
#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/text/AtomicString.h"
+#include "wtf/text/AtomicStringHash.h"
namespace blink {
+class CustomElementDefinition;
class ElementRegistrationOptions;
class ExceptionState;
class ScriptState;
class ScriptValue;
+class V0CustomElementRegistrationContext;
class CORE_EXPORT CustomElementsRegistry final
- : public GarbageCollected<CustomElementsRegistry>
+ : public GarbageCollectedFinalized<CustomElementsRegistry>
, public ScriptWrappable {
DEFINE_WRAPPERTYPEINFO();
public:
- static CustomElementsRegistry* create()
- {
- return new CustomElementsRegistry();
- }
+ using Id = uint32_t;
+ static CustomElementsRegistry* create(
+ ScriptState*,
+ V0CustomElementRegistrationContext*);
- void define(ScriptState*, const AtomicString& name,
- const ScriptValue& constructor, const ElementRegistrationOptions&,
+ void define(
+ ScriptState*,
+ const AtomicString& name,
+ const ScriptValue& constructor,
+ const ElementRegistrationOptions&,
ExceptionState&);
+ CustomElementDefinition* definitionForConstructor(
+ ScriptState*,
+ v8::Local<v8::Value> constructor);
+ v8::Local<v8::Object> prototype(
+ ScriptState*,
+ const CustomElementDefinition&);
+
+ // TODO(dominicc): Remove this when V0CustomElements are removed.
+ bool nameIsDefined(const AtomicString& name) const;
+
DECLARE_TRACE();
private:
- CustomElementsRegistry();
+ CustomElementsRegistry(const V0CustomElementRegistrationContext*);
+
+ // 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);
+
+ Member<const V0CustomElementRegistrationContext> m_v0;
+ HeapVector<Member<CustomElementDefinition>> m_definitions;
+ HashSet<AtomicString> m_names;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698