| 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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 } | 222 } |
| 223 | 223 |
| 224 void LayoutSVGResourceContainer::registerResource() | 224 void LayoutSVGResourceContainer::registerResource() |
| 225 { | 225 { |
| 226 SVGDocumentExtensions& extensions = svgExtensionsFromElement(element()); | 226 SVGDocumentExtensions& extensions = svgExtensionsFromElement(element()); |
| 227 if (!extensions.hasPendingResource(m_id)) { | 227 if (!extensions.hasPendingResource(m_id)) { |
| 228 extensions.addResource(m_id, this); | 228 extensions.addResource(m_id, this); |
| 229 return; | 229 return; |
| 230 } | 230 } |
| 231 | 231 |
| 232 OwnPtrWillBeRawPtr<SVGDocumentExtensions::SVGPendingElements> clients(extens
ions.removePendingResource(m_id)); | 232 RawPtr<SVGDocumentExtensions::SVGPendingElements> clients(extensions.removeP
endingResource(m_id)); |
| 233 | 233 |
| 234 // Cache us with the new id. | 234 // Cache us with the new id. |
| 235 extensions.addResource(m_id, this); | 235 extensions.addResource(m_id, this); |
| 236 | 236 |
| 237 // Update cached resources of pending clients. | 237 // Update cached resources of pending clients. |
| 238 for (const auto& pendingClient : *clients) { | 238 for (const auto& pendingClient : *clients) { |
| 239 ASSERT(pendingClient->hasPendingResources()); | 239 ASSERT(pendingClient->hasPendingResources()); |
| 240 extensions.clearHasPendingResourcesIfPossible(pendingClient); | 240 extensions.clearHasPendingResourcesIfPossible(pendingClient); |
| 241 LayoutObject* layoutObject = pendingClient->layoutObject(); | 241 LayoutObject* layoutObject = pendingClient->layoutObject(); |
| 242 if (!layoutObject) | 242 if (!layoutObject) |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 return; | 282 return; |
| 283 | 283 |
| 284 SVGElementSet* dependencies = toSVGElement(object->node())->setOfIncomingRef
erences(); | 284 SVGElementSet* dependencies = toSVGElement(object->node())->setOfIncomingRef
erences(); |
| 285 if (!dependencies) | 285 if (!dependencies) |
| 286 return; | 286 return; |
| 287 | 287 |
| 288 // We allow cycles in SVGDocumentExtensions reference sets in order to avoid
expensive | 288 // We allow cycles in SVGDocumentExtensions reference sets in order to avoid
expensive |
| 289 // reference graph adjustments on changes, so we need to break possible cycl
es here. | 289 // reference graph adjustments on changes, so we need to break possible cycl
es here. |
| 290 // This strong reference is safe, as it is guaranteed that this set will be
emptied | 290 // This strong reference is safe, as it is guaranteed that this set will be
emptied |
| 291 // at the end of recursion. | 291 // at the end of recursion. |
| 292 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<SVGElementSet>, invalidatingDepen
dencies, (adoptPtrWillBeNoop(new SVGElementSet))); | 292 DEFINE_STATIC_LOCAL(Persistent<SVGElementSet>, invalidatingDependencies, (ad
optPtrWillBeNoop(new SVGElementSet))); |
| 293 | 293 |
| 294 for (SVGElement* element : *dependencies) { | 294 for (SVGElement* element : *dependencies) { |
| 295 if (LayoutObject* layoutObject = element->layoutObject()) { | 295 if (LayoutObject* layoutObject = element->layoutObject()) { |
| 296 if (UNLIKELY(!invalidatingDependencies->add(element).isNewEntry)) { | 296 if (UNLIKELY(!invalidatingDependencies->add(element).isNewEntry)) { |
| 297 // Reference cycle: we are in process of invalidating this depen
dant. | 297 // Reference cycle: we are in process of invalidating this depen
dant. |
| 298 continue; | 298 continue; |
| 299 } | 299 } |
| 300 | 300 |
| 301 LayoutSVGResourceContainer::markForLayoutAndParentResourceInvalidati
on(layoutObject, needsLayout); | 301 LayoutSVGResourceContainer::markForLayoutAndParentResourceInvalidati
on(layoutObject, needsLayout); |
| 302 invalidatingDependencies->remove(element); | 302 invalidatingDependencies->remove(element); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 323 // This will process the rest of the ancestors. | 323 // This will process the rest of the ancestors. |
| 324 toLayoutSVGResourceContainer(current)->removeAllClientsFromCache(); | 324 toLayoutSVGResourceContainer(current)->removeAllClientsFromCache(); |
| 325 break; | 325 break; |
| 326 } | 326 } |
| 327 | 327 |
| 328 current = current->parent(); | 328 current = current->parent(); |
| 329 } | 329 } |
| 330 } | 330 } |
| 331 | 331 |
| 332 } // namespace blink | 332 } // namespace blink |
| OLD | NEW |