OLD | NEW |
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 #include "core/dom/custom/CustomElementsRegistry.h" | 5 #include "core/dom/custom/CustomElementsRegistry.h" |
6 | 6 |
7 // TODO(dominicc): Stop including Document.h when | 7 // TODO(dominicc): Stop including Document.h when |
8 // v0CustomElementIsDefined has been removed. | 8 // v0CustomElementIsDefined has been removed. |
9 #include "bindings/core/v8/DOMWrapperWorld.h" | 9 #include "bindings/core/v8/DOMWrapperWorld.h" |
10 #include "bindings/core/v8/ExceptionState.h" | 10 #include "bindings/core/v8/ExceptionState.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 } | 123 } |
124 v8::Local<v8::Object> prototype = prototypeValue.As<v8::Object>(); | 124 v8::Local<v8::Object> prototype = prototypeValue.As<v8::Object>(); |
125 | 125 |
126 // TODO(dominicc): Implement steps: | 126 // TODO(dominicc): Implement steps: |
127 // 12-13: connected callback | 127 // 12-13: connected callback |
128 // 14-15: disconnected callback | 128 // 14-15: disconnected callback |
129 // 16-17: attribute changed callback | 129 // 16-17: attribute changed callback |
130 | 130 |
131 Id id = m_definitions.size(); | 131 Id id = m_definitions.size(); |
132 v8::Local<v8::Value> idValue = v8::Integer::NewFromUnsigned(isolate, id); | 132 v8::Local<v8::Value> idValue = v8::Integer::NewFromUnsigned(isolate, id); |
133 m_definitions.append(new CustomElementDefinition(this, id, name)); | 133 m_definitions.append(new CustomElementDefinition( |
| 134 this, |
| 135 id, |
| 136 CustomElementDescriptor(name, name))); |
134 // This map is stored in a hidden reference from the | 137 // This map is stored in a hidden reference from the |
135 // CustomElementsRegistry wrapper. | 138 // CustomElementsRegistry wrapper. |
136 v8::Local<v8::Map> map = idMap(scriptState); | 139 v8::Local<v8::Map> map = idMap(scriptState); |
137 // The map keeps the constructor and prototypes alive. | 140 // The map keeps the constructor and prototypes alive. |
138 v8CallOrCrash(map->Set(context, constructor, idValue)); | 141 v8CallOrCrash(map->Set(context, constructor, idValue)); |
139 v8CallOrCrash(map->Set(context, idValue, prototype)); | 142 v8CallOrCrash(map->Set(context, idValue, prototype)); |
140 m_names.add(name); | 143 m_names.add(name); |
141 | 144 |
142 // TODO(dominicc): Implement steps: | 145 // TODO(dominicc): Implement steps: |
143 // 20: when-defined promise processing | 146 // 20: when-defined promise processing |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 return m_v0.get() && m_v0->nameIsDefined(name); | 202 return m_v0.get() && m_v0->nameIsDefined(name); |
200 } | 203 } |
201 | 204 |
202 DEFINE_TRACE(CustomElementsRegistry) | 205 DEFINE_TRACE(CustomElementsRegistry) |
203 { | 206 { |
204 visitor->trace(m_definitions); | 207 visitor->trace(m_definitions); |
205 visitor->trace(m_v0); | 208 visitor->trace(m_v0); |
206 } | 209 } |
207 | 210 |
208 } // namespace blink | 211 } // namespace blink |
OLD | NEW |