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

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

Issue 1850413002: Improve DEFINE_STATIC_LOCAL()'s handling of Blink GCed objects. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address compilation failure 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) 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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(Persistent<SVGElementSet>, invalidatingDependencies, (ne w SVGElementSet)); 292 DEFINE_STATIC_LOCAL(SVGElementSet, invalidatingDependencies, (new SVGElement Set));
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);
303 } 303 }
304 } 304 }
305 } 305 }
306 306
307 void LayoutSVGResourceContainer::markForLayoutAndParentResourceInvalidation(Layo utObject* object, bool needsLayout) 307 void LayoutSVGResourceContainer::markForLayoutAndParentResourceInvalidation(Layo utObject* object, bool needsLayout)
308 { 308 {
309 ASSERT(object); 309 ASSERT(object);
310 ASSERT(object->node()); 310 ASSERT(object->node());
311 311
312 if (needsLayout && !object->documentBeingDestroyed()) 312 if (needsLayout && !object->documentBeingDestroyed())
(...skipping 10 matching lines...) Expand all
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
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutTestHelper.cpp ('k') | third_party/WebKit/Source/core/loader/EmptyClients.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698