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..6b2eeda2f96da11a4fc47ed84c96a390270a1ad2 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,12 @@ 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) |
+ OwnPtrWillBeRawPtr<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 +114,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 +154,9 @@ void CustomElementRegistrationContext::setTypeExtension(Element* element, const |
context->didGiveTypeExtension(element, type); |
} |
+void CustomElementRegistrationContext::trace(Visitor* visitor) |
+{ |
+ visitor->trace(m_candidates); |
+} |
+ |
} // namespace WebCore |