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

Side by Side Diff: cc/resources/tile_manager_unittest.cc

Issue 640063010: cc: Don't swap PictureLayerTilingSet on activate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: noswap: maskconstructor Created 6 years 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 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/resources/eviction_tile_priority_queue.h" 5 #include "cc/resources/eviction_tile_priority_queue.h"
6 #include "cc/resources/raster_tile_priority_queue.h" 6 #include "cc/resources/raster_tile_priority_queue.h"
7 #include "cc/resources/tile.h" 7 #include "cc/resources/tile.h"
8 #include "cc/resources/tile_priority.h" 8 #include "cc/resources/tile_priority.h"
9 #include "cc/test/fake_impl_proxy.h" 9 #include "cc/test/fake_impl_proxy.h"
10 #include "cc/test/fake_layer_tree_host_impl.h" 10 #include "cc/test/fake_layer_tree_host_impl.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 LayerTreeImpl* pending_tree = host_impl_.pending_tree(); 102 LayerTreeImpl* pending_tree = host_impl_.pending_tree();
103 103
104 // Steal from the recycled tree. 104 // Steal from the recycled tree.
105 scoped_ptr<LayerImpl> old_pending_root = pending_tree->DetachLayerTree(); 105 scoped_ptr<LayerImpl> old_pending_root = pending_tree->DetachLayerTree();
106 DCHECK_IMPLIES(old_pending_root, old_pending_root->id() == id_); 106 DCHECK_IMPLIES(old_pending_root, old_pending_root->id() == id_);
107 107
108 scoped_ptr<FakePictureLayerImpl> pending_layer; 108 scoped_ptr<FakePictureLayerImpl> pending_layer;
109 if (old_pending_root) { 109 if (old_pending_root) {
110 pending_layer.reset( 110 pending_layer.reset(
111 static_cast<FakePictureLayerImpl*>(old_pending_root.release())); 111 static_cast<FakePictureLayerImpl*>(old_pending_root.release()));
112 pending_layer->SetRasterSource(pile); 112 pending_layer->SetRasterSourceOnPending(pile, Region());
113 } else { 113 } else {
114 pending_layer = 114 pending_layer =
115 FakePictureLayerImpl::CreateWithRasterSource(pending_tree, id_, pile); 115 FakePictureLayerImpl::CreateWithRasterSource(pending_tree, id_, pile);
116 pending_layer->SetDrawsContent(true); 116 pending_layer->SetDrawsContent(true);
117 } 117 }
118 // The bounds() just mirror the pile size. 118 // The bounds() just mirror the pile size.
119 pending_layer->SetBounds(pending_layer->raster_source()->GetSize()); 119 pending_layer->SetBounds(pending_layer->raster_source()->GetSize());
120 pending_tree->SetRootLayer(pending_layer.Pass()); 120 pending_tree->SetRootLayer(pending_layer.Pass());
121 121
122 pending_layer_ = static_cast<FakePictureLayerImpl*>( 122 pending_layer_ = static_cast<FakePictureLayerImpl*>(
123 host_impl_.pending_tree()->LayerById(id_)); 123 host_impl_.pending_tree()->LayerById(id_));
124 pending_layer_->DoPostCommitInitializationIfNeeded(); 124 pending_layer_->DoPostCommitInitializationIfNeeded();
125 } 125 }
126 126
127 void CreateHighLowResAndSetAllTilesVisible() {
128 // Active layer must get updated first so pending layer can share from it.
129 active_layer_->CreateDefaultTilingsAndTiles();
130 active_layer_->SetAllTilesVisible();
131 pending_layer_->CreateDefaultTilingsAndTiles();
132 pending_layer_->SetAllTilesVisible();
133 }
134
135 TileManager* tile_manager() { return host_impl_.tile_manager(); } 127 TileManager* tile_manager() { return host_impl_.tile_manager(); }
136 128
137 protected: 129 protected:
138 GlobalStateThatImpactsTilePriority global_state_; 130 GlobalStateThatImpactsTilePriority global_state_;
139 131
140 TestSharedBitmapManager shared_bitmap_manager_; 132 TestSharedBitmapManager shared_bitmap_manager_;
141 TileMemoryLimitPolicy memory_limit_policy_; 133 TileMemoryLimitPolicy memory_limit_policy_;
142 int max_tiles_; 134 int max_tiles_;
143 bool ready_to_activate_; 135 bool ready_to_activate_;
144 int id_; 136 int id_;
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after
868 all_tiles.insert(queue.Top()); 860 all_tiles.insert(queue.Top());
869 ++tile_count; 861 ++tile_count;
870 queue.Pop(); 862 queue.Pop();
871 } 863 }
872 EXPECT_EQ(tile_count, all_tiles.size()); 864 EXPECT_EQ(tile_count, all_tiles.size());
873 EXPECT_EQ(16u, tile_count); 865 EXPECT_EQ(16u, tile_count);
874 } 866 }
875 867
876 } // namespace 868 } // namespace
877 } // namespace cc 869 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698