| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 } | 224 } |
| 225 | 225 |
| 226 void LayoutSVGResourceContainer::registerResource() | 226 void LayoutSVGResourceContainer::registerResource() |
| 227 { | 227 { |
| 228 SVGDocumentExtensions& extensions = svgExtensionsFromElement(element()); | 228 SVGDocumentExtensions& extensions = svgExtensionsFromElement(element()); |
| 229 if (!extensions.hasPendingResource(m_id)) { | 229 if (!extensions.hasPendingResource(m_id)) { |
| 230 extensions.addResource(m_id, this); | 230 extensions.addResource(m_id, this); |
| 231 return; | 231 return; |
| 232 } | 232 } |
| 233 | 233 |
| 234 OwnPtrWillBeRawPtr<SVGDocumentExtensions::SVGPendingElements> clients(extens
ions.removePendingResource(m_id)); | 234 RawPtr<SVGDocumentExtensions::SVGPendingElements> clients(extensions.removeP
endingResource(m_id)); |
| 235 | 235 |
| 236 // Cache us with the new id. | 236 // Cache us with the new id. |
| 237 extensions.addResource(m_id, this); | 237 extensions.addResource(m_id, this); |
| 238 | 238 |
| 239 // Update cached resources of pending clients. | 239 // Update cached resources of pending clients. |
| 240 for (const auto& pendingClient : *clients) { | 240 for (const auto& pendingClient : *clients) { |
| 241 ASSERT(pendingClient->hasPendingResources()); | 241 ASSERT(pendingClient->hasPendingResources()); |
| 242 extensions.clearHasPendingResourcesIfPossible(pendingClient); | 242 extensions.clearHasPendingResourcesIfPossible(pendingClient); |
| 243 LayoutObject* layoutObject = pendingClient->layoutObject(); | 243 LayoutObject* layoutObject = pendingClient->layoutObject(); |
| 244 if (!layoutObject) | 244 if (!layoutObject) |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 return; | 284 return; |
| 285 | 285 |
| 286 SVGElementSet* dependencies = toSVGElement(object->node())->setOfIncomingRef
erences(); | 286 SVGElementSet* dependencies = toSVGElement(object->node())->setOfIncomingRef
erences(); |
| 287 if (!dependencies) | 287 if (!dependencies) |
| 288 return; | 288 return; |
| 289 | 289 |
| 290 // We allow cycles in SVGDocumentExtensions reference sets in order to avoid
expensive | 290 // We allow cycles in SVGDocumentExtensions reference sets in order to avoid
expensive |
| 291 // reference graph adjustments on changes, so we need to break possible cycl
es here. | 291 // reference graph adjustments on changes, so we need to break possible cycl
es here. |
| 292 // This strong reference is safe, as it is guaranteed that this set will be
emptied | 292 // This strong reference is safe, as it is guaranteed that this set will be
emptied |
| 293 // at the end of recursion. | 293 // at the end of recursion. |
| 294 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<SVGElementSet>, invalidatingDepen
dencies, (adoptPtrWillBeNoop(new SVGElementSet))); | 294 DEFINE_STATIC_LOCAL(Persistent<SVGElementSet>, invalidatingDependencies, ((n
ew SVGElementSet))); |
| 295 | 295 |
| 296 for (SVGElement* element : *dependencies) { | 296 for (SVGElement* element : *dependencies) { |
| 297 if (LayoutObject* layoutObject = element->layoutObject()) { | 297 if (LayoutObject* layoutObject = element->layoutObject()) { |
| 298 if (UNLIKELY(!invalidatingDependencies->add(element).isNewEntry)) { | 298 if (UNLIKELY(!invalidatingDependencies->add(element).isNewEntry)) { |
| 299 // Reference cycle: we are in process of invalidating this depen
dant. | 299 // Reference cycle: we are in process of invalidating this depen
dant. |
| 300 continue; | 300 continue; |
| 301 } | 301 } |
| 302 | 302 |
| 303 LayoutSVGResourceContainer::markForLayoutAndParentResourceInvalidati
on(layoutObject, needsLayout); | 303 LayoutSVGResourceContainer::markForLayoutAndParentResourceInvalidati
on(layoutObject, needsLayout); |
| 304 invalidatingDependencies->remove(element); | 304 invalidatingDependencies->remove(element); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 325 // This will process the rest of the ancestors. | 325 // This will process the rest of the ancestors. |
| 326 toLayoutSVGResourceContainer(current)->removeAllClientsFromCache(); | 326 toLayoutSVGResourceContainer(current)->removeAllClientsFromCache(); |
| 327 break; | 327 break; |
| 328 } | 328 } |
| 329 | 329 |
| 330 current = current->parent(); | 330 current = current->parent(); |
| 331 } | 331 } |
| 332 } | 332 } |
| 333 | 333 |
| 334 } // namespace blink | 334 } // namespace blink |
| OLD | NEW |