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

Side by Side Diff: cc/trees/layer_tree_host_impl.cc

Issue 676953003: cc: Always keep the PictureLayerImpl::twin_layer_ pointer valid. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: twins: anothercheck Created 6 years, 1 month 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 | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/trees/layer_tree_host_impl.h" 5 #include "cc/trees/layer_tree_host_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 1165 matching lines...) Expand 10 before | Expand all | Expand 10 after
1176 active_tree_->DetachLayerTree(); 1176 active_tree_->DetachLayerTree();
1177 active_tree_ = LayerTreeImpl::create(this); 1177 active_tree_ = LayerTreeImpl::create(this);
1178 if (pending_tree_) 1178 if (pending_tree_)
1179 pending_tree_->DetachLayerTree(); 1179 pending_tree_->DetachLayerTree();
1180 pending_tree_ = nullptr; 1180 pending_tree_ = nullptr;
1181 if (recycle_tree_) 1181 if (recycle_tree_)
1182 recycle_tree_->DetachLayerTree(); 1182 recycle_tree_->DetachLayerTree();
1183 recycle_tree_ = nullptr; 1183 recycle_tree_ = nullptr;
1184 } 1184 }
1185 1185
1186 void LayerTreeHostImpl::ResetRecycleTreeForTesting() {
1187 if (recycle_tree_)
1188 recycle_tree_->DetachLayerTree();
1189 recycle_tree_ = nullptr;
1190 }
1191
1192 void LayerTreeHostImpl::EnforceManagedMemoryPolicy( 1186 void LayerTreeHostImpl::EnforceManagedMemoryPolicy(
1193 const ManagedMemoryPolicy& policy) { 1187 const ManagedMemoryPolicy& policy) {
1194 1188
1195 bool evicted_resources = client_->ReduceContentsTextureMemoryOnImplThread( 1189 bool evicted_resources = client_->ReduceContentsTextureMemoryOnImplThread(
1196 visible_ ? policy.bytes_limit_when_visible : 0, 1190 visible_ ? policy.bytes_limit_when_visible : 0,
1197 ManagedMemoryPolicy::PriorityCutoffToValue( 1191 ManagedMemoryPolicy::PriorityCutoffToValue(
1198 visible_ ? policy.priority_cutoff_when_visible 1192 visible_ ? policy.priority_cutoff_when_visible
1199 : gpu::MemoryAllocation::CUTOFF_ALLOW_NOTHING)); 1193 : gpu::MemoryAllocation::CUTOFF_ALLOW_NOTHING));
1200 if (evicted_resources) { 1194 if (evicted_resources) {
1201 active_tree_->SetContentsTexturesPurged(); 1195 active_tree_->SetContentsTexturesPurged();
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
1279 for (std::vector<PictureLayerImpl*>::const_iterator it = 1273 for (std::vector<PictureLayerImpl*>::const_iterator it =
1280 picture_layers_.begin(); 1274 picture_layers_.begin();
1281 it != picture_layers_.end(); 1275 it != picture_layers_.end();
1282 ++it) { 1276 ++it) {
1283 PictureLayerImpl* layer = *it; 1277 PictureLayerImpl* layer = *it;
1284 1278
1285 // TODO(vmpstr): Iterators and should handle this instead. crbug.com/381704 1279 // TODO(vmpstr): Iterators and should handle this instead. crbug.com/381704
1286 if (!layer->HasValidTilePriorities()) 1280 if (!layer->HasValidTilePriorities())
1287 continue; 1281 continue;
1288 1282
1289 PictureLayerImpl* twin_layer = layer->GetTwinLayer(); 1283 PictureLayerImpl* twin_layer = layer->GetPendingOrActiveTwinLayer();
1290 1284
1291 // Ignore the twin layer when tile priorities are invalid. 1285 // Ignore the twin layer when tile priorities are invalid.
1292 // TODO(vmpstr): Iterators should handle this instead. crbug.com/381704 1286 // TODO(vmpstr): Iterators should handle this instead. crbug.com/381704
1293 if (twin_layer && !twin_layer->HasValidTilePriorities()) 1287 if (twin_layer && !twin_layer->HasValidTilePriorities())
1294 twin_layer = NULL; 1288 twin_layer = NULL;
1295 1289
1296 // If the current tree is ACTIVE_TREE, then always generate a layer_pair. 1290 // If the current tree is ACTIVE_TREE, then always generate a layer_pair.
1297 // If current tree is PENDING_TREE, then only generate a layer_pair if 1291 // If current tree is PENDING_TREE, then only generate a layer_pair if
1298 // there is no twin layer. 1292 // there is no twin layer.
1299 if (layer->GetTree() == ACTIVE_TREE) { 1293 if (layer->GetTree() == ACTIVE_TREE) {
(...skipping 2178 matching lines...) Expand 10 before | Expand all | Expand 10 after
3478 } 3472 }
3479 3473
3480 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { 3474 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) {
3481 std::vector<PictureLayerImpl*>::iterator it = 3475 std::vector<PictureLayerImpl*>::iterator it =
3482 std::find(picture_layers_.begin(), picture_layers_.end(), layer); 3476 std::find(picture_layers_.begin(), picture_layers_.end(), layer);
3483 DCHECK(it != picture_layers_.end()); 3477 DCHECK(it != picture_layers_.end());
3484 picture_layers_.erase(it); 3478 picture_layers_.erase(it);
3485 } 3479 }
3486 3480
3487 } // namespace cc 3481 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698