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

Side by Side Diff: Source/core/svg/SVGElementInstance.cpp

Issue 267303004: Oilpan: cleanup based on review comments after removal of TreeShared. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix typo and merge 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/svg/SVGElementInstance.h ('k') | Source/core/svg/SVGElementRareData.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 3 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
4 * Copyright (C) 2011 Torch Mobile (Beijing) Co. Ltd. All rights reserved. 4 * Copyright (C) 2011 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 112
113 #if !ENABLE(OILPAN) 113 #if !ENABLE(OILPAN)
114 // Call detach because we may be deleted directly if we are a child of a det ached instance. 114 // Call detach because we may be deleted directly if we are a child of a det ached instance.
115 detach(); 115 detach();
116 m_element = nullptr; 116 m_element = nullptr;
117 #endif 117 #endif
118 } 118 }
119 119
120 // It's important not to inline removedLastRef, because we don't want to inline the code to 120 // It's important not to inline removedLastRef, because we don't want to inline the code to
121 // delete an SVGElementInstance at each deref call site. 121 // delete an SVGElementInstance at each deref call site.
122 #if !ENABLE(OILPAN)
122 void SVGElementInstance::removedLastRef() 123 void SVGElementInstance::removedLastRef()
123 { 124 {
124 #if !ENABLE(OILPAN)
125 #if SECURITY_ASSERT_ENABLED 125 #if SECURITY_ASSERT_ENABLED
126 m_deletionHasBegun = true; 126 m_deletionHasBegun = true;
127 #endif 127 #endif
128 delete this; 128 delete this;
129 }
129 #endif 130 #endif
130 }
131 131
132 void SVGElementInstance::detach() 132 void SVGElementInstance::detach()
133 { 133 {
134 // Clear all pointers. When the node is detached from the shadow DOM it shou ld be removed but, 134 // Clear all pointers. When the node is detached from the shadow DOM it shou ld be removed but,
135 // due to ref counting, it may not be. So clear everything to avoid dangling pointers. 135 // due to ref counting, it may not be. So clear everything to avoid dangling pointers.
136 136
137 for (SVGElementInstance* node = firstChild(); node; node = node->nextSibling ()) 137 for (SVGElementInstance* node = firstChild(); node; node = node->nextSibling ())
138 node->detach(); 138 node->detach();
139 139
140 // Deregister as instance for passed element, if we haven't already. 140 // Deregister as instance for passed element, if we haven't already.
141 if (shadowTreeElement() && m_element->instancesForElement().contains(shadowT reeElement())) 141 if (shadowTreeElement() && m_element->instancesForElement().contains(shadowT reeElement()))
142 m_element->removeInstanceMapping(shadowTreeElement()); 142 m_element->removeInstanceMapping(shadowTreeElement());
143 // DO NOT clear ref to m_element because JavaScriptCore uses it for garbage collection
144 143
145 m_shadowTreeElement = nullptr; 144 m_shadowTreeElement = nullptr;
146 145
147 m_directUseElement = 0; 146 m_directUseElement = nullptr;
148 m_correspondingUseElement = 0; 147 m_correspondingUseElement = nullptr;
149 148
150 #if !ENABLE(OILPAN) 149 #if !ENABLE(OILPAN)
151 removeDetachedChildrenInContainer<SVGElementInstance, SVGElementInstance>(*t his); 150 removeDetachedChildrenInContainer<SVGElementInstance, SVGElementInstance>(*t his);
152 #endif 151 #endif
153 } 152 }
154 153
155 void SVGElementInstance::setShadowTreeElement(SVGElement* element) 154 void SVGElementInstance::setShadowTreeElement(SVGElement* element)
156 { 155 {
157 ASSERT(element); 156 ASSERT(element);
158 m_shadowTreeElement = element; 157 m_shadowTreeElement = element;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 { 219 {
221 // EventTarget would use these methods if we were actually using its add/rem oveEventListener logic. 220 // EventTarget would use these methods if we were actually using its add/rem oveEventListener logic.
222 // As we're forwarding those calls to the correspondingElement(), no one sho uld ever call this function. 221 // As we're forwarding those calls to the correspondingElement(), no one sho uld ever call this function.
223 ASSERT_NOT_REACHED(); 222 ASSERT_NOT_REACHED();
224 return *eventTargetData(); 223 return *eventTargetData();
225 } 224 }
226 225
227 void SVGElementInstance::trace(Visitor* visitor) 226 void SVGElementInstance::trace(Visitor* visitor)
228 { 227 {
229 visitor->trace(m_parentInstance); 228 visitor->trace(m_parentInstance);
229 visitor->trace(m_correspondingUseElement);
230 visitor->trace(m_directUseElement);
230 visitor->trace(m_element); 231 visitor->trace(m_element);
231 visitor->trace(m_shadowTreeElement); 232 visitor->trace(m_shadowTreeElement);
232 visitor->trace(m_previousSibling); 233 visitor->trace(m_previousSibling);
233 visitor->trace(m_nextSibling); 234 visitor->trace(m_nextSibling);
234 visitor->trace(m_firstChild); 235 visitor->trace(m_firstChild);
235 visitor->trace(m_lastChild); 236 visitor->trace(m_lastChild);
236 } 237 }
237 238
238 } 239 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGElementInstance.h ('k') | Source/core/svg/SVGElementRareData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698