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

Side by Side Diff: Source/core/dom/custom/CustomElementUpgradeCandidateMap.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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 17 matching lines...) Expand all
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "core/dom/custom/CustomElementUpgradeCandidateMap.h" 32 #include "core/dom/custom/CustomElementUpgradeCandidateMap.h"
33 33
34 #include "core/dom/Element.h" 34 #include "core/dom/Element.h"
35 35
36 namespace WebCore { 36 namespace WebCore {
37 37
38 PassOwnPtrWillBeRawPtr<CustomElementUpgradeCandidateMap> CustomElementUpgradeCan didateMap::create()
39 {
40 return adoptPtrWillBeNoop(new CustomElementUpgradeCandidateMap());
41 }
42
38 CustomElementUpgradeCandidateMap::~CustomElementUpgradeCandidateMap() 43 CustomElementUpgradeCandidateMap::~CustomElementUpgradeCandidateMap()
39 { 44 {
45 #if !ENABLE(OILPAN)
46 // With Oilpan enabled, the observer table keeps a weak reference to the
Mads Ager (chromium) 2014/05/22 08:33:27 The problem is if we have a strong pointer to the
sof 2014/05/25 16:30:01 The registration context (a member on the Document
Mads Ager (chromium) 2014/05/26 10:08:26 That is exactly the right question to ask. :-) An
sof 2014/05/26 14:21:25 Thanks, that's really useful information. So all t
47 // element; no need for explicit removal.
40 UpgradeCandidateMap::const_iterator::Keys end = m_upgradeCandidates.end().ke ys(); 48 UpgradeCandidateMap::const_iterator::Keys end = m_upgradeCandidates.end().ke ys();
41 for (UpgradeCandidateMap::const_iterator::Keys it = m_upgradeCandidates.begi n().keys(); it != end; ++it) 49 for (UpgradeCandidateMap::const_iterator::Keys it = m_upgradeCandidates.begi n().keys(); it != end; ++it)
42 unobserve(*it); 50 unobserve(*it);
51 #endif
43 } 52 }
44 53
45 void CustomElementUpgradeCandidateMap::add(const CustomElementDescriptor& descri ptor, Element* element) 54 void CustomElementUpgradeCandidateMap::add(const CustomElementDescriptor& descri ptor, Element* element)
46 { 55 {
47 observe(element); 56 observe(element);
48 57
49 UpgradeCandidateMap::AddResult result = m_upgradeCandidates.add(element, des criptor); 58 UpgradeCandidateMap::AddResult result = m_upgradeCandidates.add(element, des criptor);
50 ASSERT_UNUSED(result, result.isNewEntry); 59 ASSERT_UNUSED(result, result.isNewEntry);
51 60
52 UnresolvedDefinitionMap::iterator it = m_unresolvedDefinitions.find(descript or); 61 UnresolvedDefinitionMap::iterator it = m_unresolvedDefinitions.find(descript or);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 void CustomElementUpgradeCandidateMap::moveToEnd(Element* element) 100 void CustomElementUpgradeCandidateMap::moveToEnd(Element* element)
92 { 101 {
93 UpgradeCandidateMap::iterator candidate = m_upgradeCandidates.find(element); 102 UpgradeCandidateMap::iterator candidate = m_upgradeCandidates.find(element);
94 ASSERT_WITH_SECURITY_IMPLICATION(candidate != m_upgradeCandidates.end()); 103 ASSERT_WITH_SECURITY_IMPLICATION(candidate != m_upgradeCandidates.end());
95 104
96 UnresolvedDefinitionMap::iterator elements = m_unresolvedDefinitions.find(ca ndidate->value); 105 UnresolvedDefinitionMap::iterator elements = m_unresolvedDefinitions.find(ca ndidate->value);
97 ASSERT_WITH_SECURITY_IMPLICATION(elements != m_unresolvedDefinitions.end()); 106 ASSERT_WITH_SECURITY_IMPLICATION(elements != m_unresolvedDefinitions.end());
98 elements->value.appendOrMoveToLast(element); 107 elements->value.appendOrMoveToLast(element);
99 } 108 }
100 109
101 ListHashSet<Element*> CustomElementUpgradeCandidateMap::takeUpgradeCandidatesFor (const CustomElementDescriptor& descriptor) 110 CustomElementUpgradeCandidateMap::ElementSet CustomElementUpgradeCandidateMap::t akeUpgradeCandidatesFor(const CustomElementDescriptor& descriptor)
102 { 111 {
103 const ListHashSet<Element*>& candidates = m_unresolvedDefinitions.take(descr iptor); 112 const ElementSet& candidates = m_unresolvedDefinitions.take(descriptor);
104 113
105 for (ElementSet::const_iterator candidate = candidates.begin(); candidate != candidates.end(); ++candidate) { 114 for (ElementSet::const_iterator candidate = candidates.begin(); candidate != candidates.end(); ++candidate) {
106 unobserve(*candidate); 115 unobserve(*candidate);
107 m_upgradeCandidates.remove(*candidate); 116 m_upgradeCandidates.remove(*candidate);
108 } 117 }
109 118
110 return candidates; 119 return candidates;
111 } 120 }
112 121
122 void CustomElementUpgradeCandidateMap::trace(Visitor* visitor)
123 {
124 visitor->trace(m_upgradeCandidates);
125 visitor->trace(m_unresolvedDefinitions);
126 CustomElementObserver::trace(visitor);
113 } 127 }
128
129 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698