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

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

Issue 1994093002: Introduce CustomElementRegistry#get() method (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2016-05-19T17:33:00 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CustomElementsRegistry_h 5 #ifndef CustomElementsRegistry_h
6 #define CustomElementsRegistry_h 6 #define CustomElementsRegistry_h
7 7
8 #include "bindings/core/v8/ScopedPersistent.h" 8 #include "bindings/core/v8/ScopedPersistent.h"
9 #include "bindings/core/v8/ScriptWrappable.h" 9 #include "bindings/core/v8/ScriptWrappable.h"
10 #include "core/CoreExport.h" 10 #include "core/CoreExport.h"
(...skipping 25 matching lines...) Expand all
36 void define( 36 void define(
37 ScriptState*, 37 ScriptState*,
38 const AtomicString& name, 38 const AtomicString& name,
39 const ScriptValue& constructor, 39 const ScriptValue& constructor,
40 const ElementRegistrationOptions&, 40 const ElementRegistrationOptions&,
41 ExceptionState&); 41 ExceptionState&);
42 42
43 CustomElementDefinition* definitionForConstructor( 43 CustomElementDefinition* definitionForConstructor(
44 ScriptState*, 44 ScriptState*,
45 v8::Local<v8::Value> constructor); 45 v8::Local<v8::Value> constructor);
46
47 ScriptValue get(ScriptState*, const AtomicString& name) const;
48
46 v8::Local<v8::Object> prototype( 49 v8::Local<v8::Object> prototype(
47 ScriptState*, 50 ScriptState*,
48 const CustomElementDefinition&); 51 const CustomElementDefinition&);
49 52
50 // TODO(dominicc): Remove this when V0CustomElements are removed. 53 // TODO(dominicc): Remove this when V0CustomElements are removed.
51 bool nameIsDefined(const AtomicString& name) const; 54 bool nameIsDefined(const AtomicString& name) const;
52 55
53 DECLARE_TRACE(); 56 DECLARE_TRACE();
54 57
55 private: 58 private:
56 CustomElementsRegistry(const V0CustomElementRegistrationContext*); 59 CustomElementsRegistry(const V0CustomElementRegistrationContext*);
57 60
58 // Retrieves the Map which, given a constructor, contains the id 61 // Retrieves the Map which, given a constructor, contains the id
59 // of the definition; or given an id, contains the prototype. 62 // of the definition; or given an id, contains the prototype.
60 // Returns true if the map was retrieved; false if the map was 63 // Returns true if the map was retrieved; false if the map was
61 // not initialized yet. 64 // not initialized yet.
62 v8::Local<v8::Map> idMap(ScriptState*); 65 v8::Local<v8::Map> idMap(ScriptState*) const;
63 66
64 bool idForConstructor( 67 bool idForConstructor(
65 ScriptState*, 68 ScriptState*,
66 v8::Local<v8::Value> constructor, 69 v8::Local<v8::Value> constructor,
67 Id&) WARN_UNUSED_RETURN; 70 Id&) WARN_UNUSED_RETURN;
68 71
69 bool v0NameIsDefined(const AtomicString& name); 72 bool v0NameIsDefined(const AtomicString& name);
70 73
71 Member<const V0CustomElementRegistrationContext> m_v0; 74 Member<const V0CustomElementRegistrationContext> m_v0;
72 HeapVector<Member<CustomElementDefinition>> m_definitions; 75 HeapVector<Member<CustomElementDefinition>> m_definitions;
73 HashSet<AtomicString> m_names; 76 HashMap<AtomicString, Id> m_names;
74 }; 77 };
75 78
76 } // namespace blink 79 } // namespace blink
77 80
78 #endif // CustomElementsRegistry_h 81 #endif // CustomElementsRegistry_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698