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

Side by Side 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: 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 namespace WebCore { 46 namespace WebCore {
47 47
48 void CustomElementRegistrationContext::registerElement(Document* document, Custo mElementConstructorBuilder* constructorBuilder, const AtomicString& type, Custom Element::NameSet validNames, ExceptionState& exceptionState) 48 void CustomElementRegistrationContext::registerElement(Document* document, Custo mElementConstructorBuilder* constructorBuilder, const AtomicString& type, Custom Element::NameSet validNames, ExceptionState& exceptionState)
49 { 49 {
50 CustomElementDefinition* definition = m_registry.registerElement(document, c onstructorBuilder, type, validNames, exceptionState); 50 CustomElementDefinition* definition = m_registry.registerElement(document, c onstructorBuilder, type, validNames, exceptionState);
51 51
52 if (!definition) 52 if (!definition)
53 return; 53 return;
54 54
55 // Upgrade elements that were waiting for this definition. 55 // Upgrade elements that were waiting for this definition.
56 const CustomElementUpgradeCandidateMap::ElementSet& upgradeCandidates = m_ca ndidates.takeUpgradeCandidatesFor(definition->descriptor()); 56 const CustomElementUpgradeCandidateMap::ElementSet& upgradeCandidates = m_ca ndidates->takeUpgradeCandidatesFor(definition->descriptor());
57 for (CustomElementUpgradeCandidateMap::ElementSet::const_iterator it = upgra deCandidates.begin(); it != upgradeCandidates.end(); ++it) 57 for (CustomElementUpgradeCandidateMap::ElementSet::const_iterator it = upgra deCandidates.begin(); it != upgradeCandidates.end(); ++it)
58 CustomElement::define(*it, definition); 58 CustomElement::define(*it, definition);
59 } 59 }
60 60
61 PassRefPtrWillBeRawPtr<Element> CustomElementRegistrationContext::createCustomTa gElement(Document& document, const QualifiedName& tagName) 61 PassRefPtrWillBeRawPtr<Element> CustomElementRegistrationContext::createCustomTa gElement(Document& document, const QualifiedName& tagName)
62 { 62 {
63 ASSERT(CustomElement::isValidName(tagName.localName())); 63 ASSERT(CustomElement::isValidName(tagName.localName()));
64 64
65 RefPtrWillBeRawPtr<Element> element; 65 RefPtrWillBeRawPtr<Element> element;
66 66
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 CustomElementScheduler::resolveOrScheduleResolution(this, element, descripto r); 98 CustomElementScheduler::resolveOrScheduleResolution(this, element, descripto r);
99 } 99 }
100 100
101 void CustomElementRegistrationContext::resolve(Element* element, const CustomEle mentDescriptor& descriptor) 101 void CustomElementRegistrationContext::resolve(Element* element, const CustomEle mentDescriptor& descriptor)
102 { 102 {
103 CustomElementDefinition* definition = m_registry.find(descriptor); 103 CustomElementDefinition* definition = m_registry.find(descriptor);
104 if (definition) { 104 if (definition) {
105 CustomElement::define(element, definition); 105 CustomElement::define(element, definition);
106 } else { 106 } else {
107 ASSERT(element->customElementState() == Element::WaitingForUpgrade); 107 ASSERT(element->customElementState() == Element::WaitingForUpgrade);
108 m_candidates.add(descriptor, element); 108 m_candidates->add(descriptor, element);
109 } 109 }
110 } 110 }
111 111
112 PassRefPtr<CustomElementRegistrationContext> CustomElementRegistrationContext::c reate() 112 PassRefPtrWillBeRawPtr<CustomElementRegistrationContext> CustomElementRegistrati onContext::create()
113 { 113 {
114 return adoptRef(new CustomElementRegistrationContext()); 114 RefPtrWillBeRawPtr<CustomElementRegistrationContext> context = adoptRefWillB eNoop(new CustomElementRegistrationContext());
115 context->m_candidates = CustomElementUpgradeCandidateMap::create();
haraken 2014/05/22 08:24:10 We normally do this kind of initialization in the
sof 2014/05/25 16:30:01 Thanks, shifted over.
116 return context.release();
115 } 117 }
116 118
117 void CustomElementRegistrationContext::setIsAttributeAndTypeExtension(Element* e lement, const AtomicString& type) 119 void CustomElementRegistrationContext::setIsAttributeAndTypeExtension(Element* e lement, const AtomicString& type)
118 { 120 {
119 ASSERT(element); 121 ASSERT(element);
120 ASSERT(!type.isEmpty()); 122 ASSERT(!type.isEmpty());
121 element->setAttribute(HTMLNames::isAttr, type); 123 element->setAttribute(HTMLNames::isAttr, type);
122 setTypeExtension(element, type); 124 setTypeExtension(element, type);
123 } 125 }
124 126
(...skipping 18 matching lines...) Expand all
143 // Custom tags take precedence over type extensions 145 // Custom tags take precedence over type extensions
144 ASSERT(!CustomElement::isValidName(element->localName())); 146 ASSERT(!CustomElement::isValidName(element->localName()));
145 147
146 if (!CustomElement::isValidName(type)) 148 if (!CustomElement::isValidName(type))
147 return; 149 return;
148 150
149 element->setCustomElementState(Element::WaitingForUpgrade); 151 element->setCustomElementState(Element::WaitingForUpgrade);
150 context->didGiveTypeExtension(element, type); 152 context->didGiveTypeExtension(element, type);
151 } 153 }
152 154
155 void CustomElementRegistrationContext::trace(Visitor* visitor)
156 {
157 visitor->trace(m_candidates);
158 }
159
153 } // namespace WebCore 160 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698