| 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..87a3851ba6446df5c3e39537be7912e069613f9c 100644
|
| --- a/third_party/WebKit/Source/core/dom/custom/CustomElementsRegistry.h
|
| +++ b/third_party/WebKit/Source/core/dom/custom/CustomElementsRegistry.h
|
| @@ -7,32 +7,59 @@
|
|
|
| #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 CORE_EXPORT CustomElementsRegistry final
|
| - : public GarbageCollected<CustomElementsRegistry>
|
| + : public GarbageCollectedFinalized<CustomElementsRegistry>
|
| , public ScriptWrappable {
|
| DEFINE_WRAPPERTYPEINFO();
|
| public:
|
| - static CustomElementsRegistry* create()
|
| + static CustomElementsRegistry* create(v8::Isolate* isolate)
|
| {
|
| - return new CustomElementsRegistry();
|
| + return new CustomElementsRegistry(isolate);
|
| }
|
|
|
| - 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(
|
| + v8::Handle<v8::Context>,
|
| + v8::Handle<v8::Value>);
|
| +
|
| + // TODO(dominicc): Decide if we need a protocol to drop everything when
|
| + // the document goes away. It feels dangerous for cycles, this being
|
| + // a wrapper.
|
| +
|
| DECLARE_TRACE();
|
|
|
| private:
|
| - CustomElementsRegistry();
|
| + CustomElementsRegistry(v8::Isolate*);
|
| +
|
| + // This maps Custom Element constructors to an index in the list
|
| + // of defined elements. This handle is not weak because it does
|
| + // not keep user-accessible objects alive: the keys are already
|
| + // weak (it is a weak map) and the values are numbers (not
|
| + // NumberObjects) which don't refer to anything else.
|
| + v8::Persistent<v8::NativeWeakMap> m_constructorIdMap;
|
| +
|
| + HeapVector<Member<CustomElementDefinition>> m_definitions;
|
| + HashSet<AtomicString> m_names;
|
| };
|
|
|
| } // namespace blink
|
|
|