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

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

Issue 2170383002: CustomElements: adopt node (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: patch update Created 4 years, 4 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 #include "core/dom/custom/CustomElementsRegistry.h" 5 #include "core/dom/custom/CustomElementsRegistry.h"
6 6
7 #include "bindings/core/v8/ExceptionState.h" 7 #include "bindings/core/v8/ExceptionState.h"
8 #include "bindings/core/v8/ScriptCustomElementDefinitionBuilder.h" 8 #include "bindings/core/v8/ScriptCustomElementDefinitionBuilder.h"
9 #include "bindings/core/v8/ScriptPromise.h" 9 #include "bindings/core/v8/ScriptPromise.h"
10 #include "bindings/core/v8/ScriptPromiseResolver.h" 10 #include "bindings/core/v8/ScriptPromiseResolver.h"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 CHECK(!exceptionState.hadException()); 161 CHECK(!exceptionState.hadException());
162 CHECK(definition->descriptor() == descriptor); 162 CHECK(definition->descriptor() == descriptor);
163 DefinitionMap::AddResult result = 163 DefinitionMap::AddResult result =
164 m_definitions.add(descriptor.name(), definition); 164 m_definitions.add(descriptor.name(), definition);
165 CHECK(result.isNewEntry); 165 CHECK(result.isNewEntry);
166 166
167 HeapVector<Member<Element>> candidates; 167 HeapVector<Member<Element>> candidates;
168 collectCandidates(descriptor, &candidates); 168 collectCandidates(descriptor, &candidates);
169 for (Element* candidate : candidates) 169 for (Element* candidate : candidates)
170 definition->enqueueUpgradeReaction(candidate); 170 definition->enqueueUpgradeReaction(candidate);
171
172 // 19: when-defined promise processing 171 // 19: when-defined promise processing
173 const auto& entry = m_whenDefinedPromiseMap.find(name); 172 const auto& entry = m_whenDefinedPromiseMap.find(name);
174 if (entry == m_whenDefinedPromiseMap.end()) 173 if (entry == m_whenDefinedPromiseMap.end())
175 return; 174 return;
176 entry->value->resolve(); 175 entry->value->resolve();
177 m_whenDefinedPromiseMap.remove(entry); 176 m_whenDefinedPromiseMap.remove(entry);
178 } 177 }
179 178
180 // https://html.spec.whatwg.org/multipage/scripting.html#dom-customelementsregis try-get 179 // https://html.spec.whatwg.org/multipage/scripting.html#dom-customelementsregis try-get
181 ScriptValue CustomElementsRegistry::get(const AtomicString& name) 180 ScriptValue CustomElementsRegistry::get(const AtomicString& name)
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 if (!element || !desc.matches(*element)) 260 if (!element || !desc.matches(*element))
262 continue; 261 continue;
263 sorter.add(element); 262 sorter.add(element);
264 } 263 }
265 264
266 m_upgradeCandidates->remove(it); 265 m_upgradeCandidates->remove(it);
267 sorter.sorted(elements, m_document.get()); 266 sorter.sorted(elements, m_document.get());
268 } 267 }
269 268
270 } // namespace blink 269 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698