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

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: Address more comments. 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.
93 , m_previousSibling(0) 93 , m_shadowTreeElement(nullptr)
94 , m_nextSibling(0) 94 , m_previousSibling(nullptr)
95 , m_firstChild(0) 95 , m_nextSibling(nullptr)
96 , m_lastChild(0) 96 , m_firstChild(nullptr)
97 , m_lastChild(nullptr)
97 { 98 {
98 ASSERT(m_correspondingUseElement); 99 ASSERT(m_correspondingUseElement);
99 ASSERT(m_element); 100 ASSERT(m_element);
100 ScriptWrappable::init(this); 101 ScriptWrappable::init(this);
101 102
102 #ifndef NDEBUG 103 #ifndef NDEBUG
103 instanceCounter.increment(); 104 instanceCounter.increment();
104 #endif 105 #endif
105 } 106 }
106 107
107 SVGElementInstance::~SVGElementInstance() 108 SVGElementInstance::~SVGElementInstance()
108 { 109 {
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 110 #ifndef NDEBUG
113 instanceCounter.decrement(); 111 instanceCounter.decrement();
114 #endif 112 #endif
115 113
114 #if !ENABLE(OILPAN)
115 // Call detach because we may be deleted directly if we are a child of a det ached instance.
116 detach();
116 m_element = nullptr; 117 m_element = nullptr;
118 #endif
117 } 119 }
118 120
119 // It's important not to inline removedLastRef, because we don't want to inline the code to 121 // 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. 122 // delete an SVGElementInstance at each deref call site.
121 void SVGElementInstance::removedLastRef() 123 void SVGElementInstance::removedLastRef()
122 { 124 {
123 #if !ENABLE(OILPAN) 125 #if !ENABLE(OILPAN)
124 #if SECURITY_ASSERT_ENABLED 126 #if SECURITY_ASSERT_ENABLED
125 m_deletionHasBegun = true; 127 m_deletionHasBegun = true;
126 #endif 128 #endif
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 } 242 }
241 243
242 EventTargetData& SVGElementInstance::ensureEventTargetData() 244 EventTargetData& SVGElementInstance::ensureEventTargetData()
243 { 245 {
244 // EventTarget would use these methods if we were actually using its add/rem oveEventListener logic. 246 // 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. 247 // As we're forwarding those calls to the correspondingElement(), no one sho uld ever call this function.
246 ASSERT_NOT_REACHED(); 248 ASSERT_NOT_REACHED();
247 return *eventTargetData(); 249 return *eventTargetData();
248 } 250 }
249 251
252 void SVGElementInstance::trace(Visitor* visitor)
253 {
254 visitor->trace(m_parentInstance);
255 visitor->trace(m_element);
256 visitor->trace(m_shadowTreeElement);
257 visitor->trace(m_previousSibling);
258 visitor->trace(m_nextSibling);
259 visitor->trace(m_firstChild);
260 visitor->trace(m_lastChild);
261 }
262
250 SVGElementInstance::InstanceUpdateBlocker::InstanceUpdateBlocker(SVGElement* tar getElement) 263 SVGElementInstance::InstanceUpdateBlocker::InstanceUpdateBlocker(SVGElement* tar getElement)
251 : m_targetElement(targetElement) 264 : m_targetElement(targetElement)
252 { 265 {
253 if (m_targetElement) 266 if (m_targetElement)
254 m_targetElement->setInstanceUpdatesBlocked(true); 267 m_targetElement->setInstanceUpdatesBlocked(true);
255 } 268 }
256 269
257 SVGElementInstance::InstanceUpdateBlocker::~InstanceUpdateBlocker() 270 SVGElementInstance::InstanceUpdateBlocker::~InstanceUpdateBlocker()
258 { 271 {
259 if (m_targetElement) 272 if (m_targetElement)
260 m_targetElement->setInstanceUpdatesBlocked(false); 273 m_targetElement->setInstanceUpdatesBlocked(false);
261 } 274 }
262 275
263 } 276 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698