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

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

Issue 262093006: Oilpan: Make the Node hierarchy RefCountedGarbageCollected instead of TreeShared. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Minor cleanup. 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
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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(SVGElementInstance, correspondingElem ent(), selectstart); 79 DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(SVGElementInstance, correspondingElem ent(), selectstart);
80 DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(SVGElementInstance, correspondingElem ent(), submit); 80 DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(SVGElementInstance, correspondingElem ent(), submit);
81 DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(SVGElementInstance, correspondingElem ent(), unload); 81 DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(SVGElementInstance, correspondingElem ent(), unload);
82 82
83 PassRefPtr<SVGElementInstance> SVGElementInstance::create(SVGUseElement* corresp ondingUseElement, SVGUseElement* directUseElement, PassRefPtr<SVGElement> origin alElement) 83 PassRefPtr<SVGElementInstance> SVGElementInstance::create(SVGUseElement* corresp ondingUseElement, SVGUseElement* directUseElement, PassRefPtr<SVGElement> origin alElement)
84 { 84 {
85 return adoptRef(new SVGElementInstance(correspondingUseElement, directUseEle ment, originalElement)); 85 return adoptRef(new SVGElementInstance(correspondingUseElement, directUseEle ment, originalElement));
86 } 86 }
87 87
88 SVGElementInstance::SVGElementInstance(SVGUseElement* correspondingUseElement, S VGUseElement* directUseElement, PassRefPtr<SVGElement> originalElement) 88 SVGElementInstance::SVGElementInstance(SVGUseElement* correspondingUseElement, S VGUseElement* directUseElement, PassRefPtr<SVGElement> originalElement)
89 : m_parentInstance(0) 89 : m_parentInstance(nullptr)
90 , m_correspondingUseElement(correspondingUseElement) 90 , m_correspondingUseElement(correspondingUseElement)
91 , m_directUseElement(directUseElement) 91 , m_directUseElement(directUseElement)
92 , m_element(originalElement) 92 , m_element(originalElement.get()) // FIXME: Oilpan: Remove the .get() call.
sof 2014/05/05 11:27:48 Add m_shadowTreeElement(nullptr) for tidiness?
Mads Ager (chromium) 2014/05/05 11:35:54 You have good eyes! Done. :)
93 , m_previousSibling(0) 93 , m_previousSibling(nullptr)
94 , m_nextSibling(0) 94 , m_nextSibling(nullptr)
95 , m_firstChild(0) 95 , m_firstChild(nullptr)
96 , m_lastChild(0) 96 , m_lastChild(nullptr)
97 { 97 {
98 ASSERT(m_correspondingUseElement); 98 ASSERT(m_correspondingUseElement);
99 ASSERT(m_element); 99 ASSERT(m_element);
100 ScriptWrappable::init(this); 100 ScriptWrappable::init(this);
101 101
102 #ifndef NDEBUG 102 #ifndef NDEBUG
103 instanceCounter.increment(); 103 instanceCounter.increment();
104 #endif 104 #endif
105 } 105 }
106 106
107 SVGElementInstance::~SVGElementInstance() 107 SVGElementInstance::~SVGElementInstance()
108 { 108 {
109 // Call detach because we may be deleted directly if we are a child of a det ached instance.
110 detach();
111
112 #ifndef NDEBUG 109 #ifndef NDEBUG
113 instanceCounter.decrement(); 110 instanceCounter.decrement();
114 #endif 111 #endif
115 112
113 #if !ENABLE(OILPAN)
114 // Call detach because we may be deleted directly if we are a child of a det ached instance.
115 detach();
116 m_element = nullptr; 116 m_element = nullptr;
117 #endif
117 } 118 }
118 119
119 // 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
120 // delete an SVGElementInstance at each deref call site. 121 // delete an SVGElementInstance at each deref call site.
121 void SVGElementInstance::removedLastRef() 122 void SVGElementInstance::removedLastRef()
122 { 123 {
123 #if !ENABLE(OILPAN) 124 #if !ENABLE(OILPAN)
124 #if SECURITY_ASSERT_ENABLED 125 #if SECURITY_ASSERT_ENABLED
125 m_deletionHasBegun = true; 126 m_deletionHasBegun = true;
126 #endif 127 #endif
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 } 241 }
241 242
242 EventTargetData& SVGElementInstance::ensureEventTargetData() 243 EventTargetData& SVGElementInstance::ensureEventTargetData()
243 { 244 {
244 // EventTarget would use these methods if we were actually using its add/rem oveEventListener logic. 245 // EventTarget would use these methods if we were actually using its add/rem oveEventListener logic.
245 // As we're forwarding those calls to the correspondingElement(), no one sho uld ever call this function. 246 // As we're forwarding those calls to the correspondingElement(), no one sho uld ever call this function.
246 ASSERT_NOT_REACHED(); 247 ASSERT_NOT_REACHED();
247 return *eventTargetData(); 248 return *eventTargetData();
248 } 249 }
249 250
251 void SVGElementInstance::trace(Visitor* visitor)
252 {
253 visitor->trace(m_parentInstance);
254 visitor->trace(m_element);
255 visitor->trace(m_shadowTreeElement);
256 visitor->trace(m_previousSibling);
257 visitor->trace(m_nextSibling);
258 visitor->trace(m_firstChild);
259 visitor->trace(m_lastChild);
260 }
261
250 SVGElementInstance::InstanceUpdateBlocker::InstanceUpdateBlocker(SVGElement* tar getElement) 262 SVGElementInstance::InstanceUpdateBlocker::InstanceUpdateBlocker(SVGElement* tar getElement)
251 : m_targetElement(targetElement) 263 : m_targetElement(targetElement)
252 { 264 {
253 if (m_targetElement) 265 if (m_targetElement)
254 m_targetElement->setInstanceUpdatesBlocked(true); 266 m_targetElement->setInstanceUpdatesBlocked(true);
255 } 267 }
256 268
257 SVGElementInstance::InstanceUpdateBlocker::~InstanceUpdateBlocker() 269 SVGElementInstance::InstanceUpdateBlocker::~InstanceUpdateBlocker()
258 { 270 {
259 if (m_targetElement) 271 if (m_targetElement)
260 m_targetElement->setInstanceUpdatesBlocked(false); 272 m_targetElement->setInstanceUpdatesBlocked(false);
261 } 273 }
262 274
263 } 275 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698