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

Side by Side Diff: third_party/WebKit/Source/core/svg/SVGDocumentExtensions.cpp

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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) 2006 Apple Inc. All rights reserved. 2 * Copyright (C) 2006 Apple Inc. All rights reserved.
3 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> 3 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
4 * Copyright (C) 2007 Rob Buis <buis@kde.org> 4 * Copyright (C) 2007 Rob Buis <buis@kde.org>
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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 void SVGDocumentExtensions::serviceOnAnimationFrame(Document& document, double m onotonicAnimationStartTime) 89 void SVGDocumentExtensions::serviceOnAnimationFrame(Document& document, double m onotonicAnimationStartTime)
90 { 90 {
91 if (!document.svgExtensions()) 91 if (!document.svgExtensions())
92 return; 92 return;
93 document.accessSVGExtensions().serviceAnimations(monotonicAnimationStartTime ); 93 document.accessSVGExtensions().serviceAnimations(monotonicAnimationStartTime );
94 } 94 }
95 95
96 void SVGDocumentExtensions::serviceAnimations(double monotonicAnimationStartTime ) 96 void SVGDocumentExtensions::serviceAnimations(double monotonicAnimationStartTime )
97 { 97 {
98 if (RuntimeEnabledFeatures::smilEnabled()) { 98 if (RuntimeEnabledFeatures::smilEnabled()) {
99 WillBeHeapVector<RefPtrWillBeMember<SVGSVGElement>> timeContainers; 99 HeapVector<Member<SVGSVGElement>> timeContainers;
100 copyToVector(m_timeContainers, timeContainers); 100 copyToVector(m_timeContainers, timeContainers);
101 for (const auto& container : timeContainers) 101 for (const auto& container : timeContainers)
102 container->timeContainer()->serviceAnimations(monotonicAnimationStar tTime); 102 container->timeContainer()->serviceAnimations(monotonicAnimationStar tTime);
103 } 103 }
104 104
105 SVGElementSet webAnimationsPendingSVGElements; 105 SVGElementSet webAnimationsPendingSVGElements;
106 webAnimationsPendingSVGElements.swap(m_webAnimationsPendingSVGElements); 106 webAnimationsPendingSVGElements.swap(m_webAnimationsPendingSVGElements);
107 107
108 // TODO(alancutter): Make SVG animation effect application a separate docume nt lifecycle phase from servicing animations to be responsive to Javascript mani pulation of exposed animation objects. 108 // TODO(alancutter): Make SVG animation effect application a separate docume nt lifecycle phase from servicing animations to be responsive to Javascript mani pulation of exposed animation objects.
109 for (auto& svgElement : webAnimationsPendingSVGElements) 109 for (auto& svgElement : webAnimationsPendingSVGElements)
110 svgElement->applyActiveWebAnimations(); 110 svgElement->applyActiveWebAnimations();
111 111
112 ASSERT(m_webAnimationsPendingSVGElements.isEmpty()); 112 ASSERT(m_webAnimationsPendingSVGElements.isEmpty());
113 } 113 }
114 114
115 void SVGDocumentExtensions::startAnimations() 115 void SVGDocumentExtensions::startAnimations()
116 { 116 {
117 // FIXME: Eventually every "Time Container" will need a way to latch on to s ome global timer 117 // FIXME: Eventually every "Time Container" will need a way to latch on to s ome global timer
118 // starting animations for a document will do this "latching" 118 // starting animations for a document will do this "latching"
119 // FIXME: We hold a ref pointers to prevent a shadow tree from getting remov ed out from underneath us. 119 // FIXME: We hold a ref pointers to prevent a shadow tree from getting remov ed out from underneath us.
120 // In the future we should refactor the use-element to avoid this. See https ://webkit.org/b/53704 120 // In the future we should refactor the use-element to avoid this. See https ://webkit.org/b/53704
121 WillBeHeapVector<RefPtrWillBeMember<SVGSVGElement>> timeContainers; 121 HeapVector<Member<SVGSVGElement>> timeContainers;
122 copyToVector(m_timeContainers, timeContainers); 122 copyToVector(m_timeContainers, timeContainers);
123 for (const auto& container : timeContainers) { 123 for (const auto& container : timeContainers) {
124 SMILTimeContainer* timeContainer = container->timeContainer(); 124 SMILTimeContainer* timeContainer = container->timeContainer();
125 if (!timeContainer->isStarted()) 125 if (!timeContainer->isStarted())
126 timeContainer->begin(); 126 timeContainer->begin();
127 } 127 }
128 } 128 }
129 129
130 void SVGDocumentExtensions::pauseAnimations() 130 void SVGDocumentExtensions::pauseAnimations()
131 { 131 {
132 for (SVGSVGElement* element : m_timeContainers) 132 for (SVGSVGElement* element : m_timeContainers)
133 element->pauseAnimations(); 133 element->pauseAnimations();
134 } 134 }
135 135
136 void SVGDocumentExtensions::dispatchSVGLoadEventToOutermostSVGElements() 136 void SVGDocumentExtensions::dispatchSVGLoadEventToOutermostSVGElements()
137 { 137 {
138 WillBeHeapVector<RefPtrWillBeMember<SVGSVGElement>> timeContainers; 138 HeapVector<Member<SVGSVGElement>> timeContainers;
139 copyToVector(m_timeContainers, timeContainers); 139 copyToVector(m_timeContainers, timeContainers);
140 for (const auto& container : timeContainers) { 140 for (const auto& container : timeContainers) {
141 SVGSVGElement* outerSVG = container.get(); 141 SVGSVGElement* outerSVG = container.get();
142 if (!outerSVG->isOutermostSVGSVGElement()) 142 if (!outerSVG->isOutermostSVGSVGElement())
143 continue; 143 continue;
144 144
145 // don't dispatch the load event document is not wellformed (for XML/sta ndalone svg) 145 // don't dispatch the load event document is not wellformed (for XML/sta ndalone svg)
146 if (outerSVG->document().wellFormed() || !outerSVG->document().isSVGDocu ment()) 146 if (outerSVG->document().wellFormed() || !outerSVG->document().isSVGDocu ment())
147 outerSVG->sendSVGLoadEventIfPossible(); 147 outerSVG->sendSVGLoadEventIfPossible();
148 } 148 }
149 } 149 }
150 150
151 void SVGDocumentExtensions::reportError(const String& message) 151 void SVGDocumentExtensions::reportError(const String& message)
152 { 152 {
153 m_document->addConsoleMessage(ConsoleMessage::create(RenderingMessageSource, ErrorMessageLevel, "Error: " + message)); 153 m_document->addConsoleMessage(ConsoleMessage::create(RenderingMessageSource, ErrorMessageLevel, "Error: " + message));
154 } 154 }
155 155
156 void SVGDocumentExtensions::addPendingResource(const AtomicString& id, Element* element) 156 void SVGDocumentExtensions::addPendingResource(const AtomicString& id, Element* element)
157 { 157 {
158 ASSERT(element); 158 ASSERT(element);
159 ASSERT(element->inDocument()); 159 ASSERT(element->inDocument());
160 160
161 if (id.isEmpty()) 161 if (id.isEmpty())
162 return; 162 return;
163 163
164 WillBeHeapHashMap<AtomicString, OwnPtrWillBeMember<SVGPendingElements>>::Add Result result = m_pendingResources.add(id, nullptr); 164 HeapHashMap<AtomicString, Member<SVGPendingElements>>::AddResult result = m_ pendingResources.add(id, nullptr);
165 if (result.isNewEntry) 165 if (result.isNewEntry)
166 result.storedValue->value = adoptPtrWillBeNoop(new SVGPendingElements); 166 result.storedValue->value = adoptPtrWillBeNoop(new SVGPendingElements);
167 result.storedValue->value->add(element); 167 result.storedValue->value->add(element);
168 168
169 element->setHasPendingResources(); 169 element->setHasPendingResources();
170 } 170 }
171 171
172 bool SVGDocumentExtensions::hasPendingResource(const AtomicString& id) const 172 bool SVGDocumentExtensions::hasPendingResource(const AtomicString& id) const
173 { 173 {
174 if (id.isEmpty()) 174 if (id.isEmpty())
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 if (elements->isEmpty()) 246 if (elements->isEmpty())
247 toBeRemoved.append(entry.key); 247 toBeRemoved.append(entry.key);
248 } 248 }
249 249
250 // We use the removePendingResourceForRemoval function here because it d eals with set lifetime correctly. 250 // We use the removePendingResourceForRemoval function here because it d eals with set lifetime correctly.
251 for (const AtomicString& id : toBeRemoved) 251 for (const AtomicString& id : toBeRemoved)
252 removePendingResourceForRemoval(id); 252 removePendingResourceForRemoval(id);
253 } 253 }
254 } 254 }
255 255
256 PassOwnPtrWillBeRawPtr<SVGDocumentExtensions::SVGPendingElements> SVGDocumentExt ensions::removePendingResource(const AtomicString& id) 256 RawPtr<SVGDocumentExtensions::SVGPendingElements> SVGDocumentExtensions::removeP endingResource(const AtomicString& id)
257 { 257 {
258 ASSERT(m_pendingResources.contains(id)); 258 ASSERT(m_pendingResources.contains(id));
259 return m_pendingResources.take(id); 259 return m_pendingResources.take(id);
260 } 260 }
261 261
262 PassOwnPtrWillBeRawPtr<SVGDocumentExtensions::SVGPendingElements> SVGDocumentExt ensions::removePendingResourceForRemoval(const AtomicString& id) 262 RawPtr<SVGDocumentExtensions::SVGPendingElements> SVGDocumentExtensions::removeP endingResourceForRemoval(const AtomicString& id)
263 { 263 {
264 ASSERT(m_pendingResourcesForRemoval.contains(id)); 264 ASSERT(m_pendingResourcesForRemoval.contains(id));
265 return m_pendingResourcesForRemoval.take(id); 265 return m_pendingResourcesForRemoval.take(id);
266 } 266 }
267 267
268 void SVGDocumentExtensions::markPendingResourcesForRemoval(const AtomicString& i d) 268 void SVGDocumentExtensions::markPendingResourcesForRemoval(const AtomicString& i d)
269 { 269 {
270 if (id.isEmpty()) 270 if (id.isEmpty())
271 return; 271 return;
272 272
273 ASSERT(!m_pendingResourcesForRemoval.contains(id)); 273 ASSERT(!m_pendingResourcesForRemoval.contains(id));
274 274
275 OwnPtrWillBeMember<SVGPendingElements> existing = m_pendingResources.take(id ); 275 Member<SVGPendingElements> existing = m_pendingResources.take(id);
276 if (existing && !existing->isEmpty()) 276 if (existing && !existing->isEmpty())
277 m_pendingResourcesForRemoval.add(id, existing.release()); 277 m_pendingResourcesForRemoval.add(id, existing.release());
278 } 278 }
279 279
280 Element* SVGDocumentExtensions::removeElementFromPendingResourcesForRemoval(cons t AtomicString& id) 280 Element* SVGDocumentExtensions::removeElementFromPendingResourcesForRemoval(cons t AtomicString& id)
281 { 281 {
282 if (id.isEmpty()) 282 if (id.isEmpty())
283 return nullptr; 283 return nullptr;
284 284
285 SVGPendingElements* resourceSet = m_pendingResourcesForRemoval.get(id); 285 SVGPendingElements* resourceSet = m_pendingResourcesForRemoval.get(id);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 visitor->trace(m_document); 362 visitor->trace(m_document);
363 visitor->trace(m_timeContainers); 363 visitor->trace(m_timeContainers);
364 visitor->trace(m_webAnimationsPendingSVGElements); 364 visitor->trace(m_webAnimationsPendingSVGElements);
365 visitor->trace(m_relativeLengthSVGRoots); 365 visitor->trace(m_relativeLengthSVGRoots);
366 visitor->trace(m_pendingResources); 366 visitor->trace(m_pendingResources);
367 visitor->trace(m_pendingResourcesForRemoval); 367 visitor->trace(m_pendingResourcesForRemoval);
368 #endif 368 #endif
369 } 369 }
370 370
371 } // namespace blink 371 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGDocumentExtensions.h ('k') | third_party/WebKit/Source/core/svg/SVGElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698