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

Side by Side Diff: Source/core/layout/compositing/CompositedDeprecatedPaintLayerMapping.cpp

Issue 1227763002: Avoid clearing pointers on layers still in the mapping's vector of layers. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 2284 matching lines...) Expand 10 before | Expand all | Expand 10 after
2295 break; 2295 break;
2296 2296
2297 if (layerIndex == m_squashedLayers.size()) 2297 if (layerIndex == m_squashedLayers.size())
2298 return; 2298 return;
2299 2299
2300 m_squashedLayers.remove(layerIndex); 2300 m_squashedLayers.remove(layerIndex);
2301 } 2301 }
2302 2302
2303 void CompositedDeprecatedPaintLayerMapping::finishAccumulatingSquashingLayers(si ze_t nextSquashedLayerIndex) 2303 void CompositedDeprecatedPaintLayerMapping::finishAccumulatingSquashingLayers(si ze_t nextSquashedLayerIndex)
2304 { 2304 {
2305 // Any additional squashed Layers in the array no longer exist, and removing invalidates the
2306 // squashingLayer contents.
2307 if (nextSquashedLayerIndex < m_squashedLayers.size()) { 2305 if (nextSquashedLayerIndex < m_squashedLayers.size()) {
2308 for (size_t i = m_squashedLayers.size(); i > nextSquashedLayerIndex; --i ) 2306 // Any additional squashed Layers in the array no longer belong here, bu t they might have been
2309 m_squashedLayers[i-1].paintLayer->setGroupedMapping(nullptr, Depreca tedPaintLayer::DoNotInvalidateLayerAndRemoveFromMapping); 2307 // added already at an earlier index. Clear pointers on those that do no t appear in the valid set
2308 // before removing all the extra entries.
2309 for (size_t i = nextSquashedLayerIndex; i < m_squashedLayers.size(); ++i ) {
2310 DeprecatedPaintLayer* layerToRemove = m_squashedLayers[i].paintLayer ;
2311 size_t previousIndex = 0;
2312 for (; previousIndex < nextSquashedLayerIndex; ++previousIndex) {
2313 if (m_squashedLayers[previousIndex].paintLayer == layerToRemove)
2314 break;
2315 }
2316 if (previousIndex == nextSquashedLayerIndex)
2317 layerToRemove->setGroupedMapping(nullptr, DeprecatedPaintLayer:: DoNotInvalidateLayerAndRemoveFromMapping);
2318 }
2310 m_squashedLayers.remove(nextSquashedLayerIndex, m_squashedLayers.size() - nextSquashedLayerIndex); 2319 m_squashedLayers.remove(nextSquashedLayerIndex, m_squashedLayers.size() - nextSquashedLayerIndex);
2311 } 2320 }
2312 } 2321 }
2313 2322
2314 String CompositedDeprecatedPaintLayerMapping::debugName(const GraphicsLayer* gra phicsLayer) 2323 String CompositedDeprecatedPaintLayerMapping::debugName(const GraphicsLayer* gra phicsLayer)
2315 { 2324 {
2316 String name; 2325 String name;
2317 if (graphicsLayer == m_graphicsLayer.get()) { 2326 if (graphicsLayer == m_graphicsLayer.get()) {
2318 name = m_owningLayer.debugName(); 2327 name = m_owningLayer.debugName();
2319 } else if (graphicsLayer == m_squashingContainmentLayer.get()) { 2328 } else if (graphicsLayer == m_squashingContainmentLayer.get()) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2351 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { 2360 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) {
2352 name = "Scrolling Block Selection Layer"; 2361 name = "Scrolling Block Selection Layer";
2353 } else { 2362 } else {
2354 ASSERT_NOT_REACHED(); 2363 ASSERT_NOT_REACHED();
2355 } 2364 }
2356 2365
2357 return name; 2366 return name;
2358 } 2367 }
2359 2368
2360 } // namespace blink 2369 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698