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

Unified Diff: Source/core/dom/custom/CustomElementRegistrationContext.cpp

Issue 296703009: Oilpan: move custom element objects to the heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Use LinkedHashSet for ElementSet instead. Created 6 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: Source/core/dom/custom/CustomElementRegistrationContext.cpp
diff --git a/Source/core/dom/custom/CustomElementRegistrationContext.cpp b/Source/core/dom/custom/CustomElementRegistrationContext.cpp
index 678895007f962e9457652206e89b5fc6516491e9..f6ce6c52a1dabfde095eed9afc6239373e261863 100644
--- a/Source/core/dom/custom/CustomElementRegistrationContext.cpp
+++ b/Source/core/dom/custom/CustomElementRegistrationContext.cpp
@@ -45,6 +45,11 @@
namespace WebCore {
+CustomElementRegistrationContext::CustomElementRegistrationContext()
+ : m_candidates(CustomElementUpgradeCandidateMap::create())
+{
+}
+
void CustomElementRegistrationContext::registerElement(Document* document, CustomElementConstructorBuilder* constructorBuilder, const AtomicString& type, CustomElement::NameSet validNames, ExceptionState& exceptionState)
{
CustomElementDefinition* definition = m_registry.registerElement(document, constructorBuilder, type, validNames, exceptionState);
@@ -53,8 +58,11 @@ void CustomElementRegistrationContext::registerElement(Document* document, Custo
return;
// Upgrade elements that were waiting for this definition.
- const CustomElementUpgradeCandidateMap::ElementSet& upgradeCandidates = m_candidates.takeUpgradeCandidatesFor(definition->descriptor());
- for (CustomElementUpgradeCandidateMap::ElementSet::const_iterator it = upgradeCandidates.begin(); it != upgradeCandidates.end(); ++it)
+ const CustomElementUpgradeCandidateMap::ElementSet* upgradeCandidates = m_candidates->takeUpgradeCandidatesFor(definition->descriptor());
+ if (!upgradeCandidates)
+ return;
+
+ for (CustomElementUpgradeCandidateMap::ElementSet::const_iterator it = upgradeCandidates->begin(); it != upgradeCandidates->end(); ++it)
CustomElement::define(*it, definition);
}
@@ -105,15 +113,10 @@ void CustomElementRegistrationContext::resolve(Element* element, const CustomEle
CustomElement::define(element, definition);
} else {
ASSERT(element->customElementState() == Element::WaitingForUpgrade);
- m_candidates.add(descriptor, element);
+ m_candidates->add(descriptor, element);
}
}
-PassRefPtr<CustomElementRegistrationContext> CustomElementRegistrationContext::create()
-{
- return adoptRef(new CustomElementRegistrationContext());
-}
-
void CustomElementRegistrationContext::setIsAttributeAndTypeExtension(Element* element, const AtomicString& type)
{
ASSERT(element);
@@ -150,4 +153,9 @@ void CustomElementRegistrationContext::setTypeExtension(Element* element, const
context->didGiveTypeExtension(element, type);
}
+void CustomElementRegistrationContext::trace(Visitor* visitor)
+{
+ visitor->trace(m_candidates);
+}
+
} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698