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

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: rebase 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
« no previous file with comments | « cc/resources/picture_layer_tiling_unittest.cc ('k') | cc/test/fake_picture_layer_impl.h » ('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 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 smoothness_tiles.insert(tile); 180 smoothness_tiles.insert(tile);
189 queue.Pop(); 181 queue.Pop();
190 } 182 }
191 EXPECT_EQ(all_tiles, smoothness_tiles); 183 EXPECT_EQ(all_tiles, smoothness_tiles);
192 EXPECT_TRUE(had_low_res); 184 EXPECT_TRUE(had_low_res);
193 185
194 Region invalidation(gfx::Rect(0, 0, 500, 500)); 186 Region invalidation(gfx::Rect(0, 0, 500, 500));
195 187
196 // Invalidate the pending tree. 188 // Invalidate the pending tree.
197 pending_layer_->set_invalidation(invalidation); 189 pending_layer_->set_invalidation(invalidation);
198 pending_layer_->HighResTiling()->UpdateTilesToCurrentRasterSource( 190 pending_layer_->HighResTiling()->Invalidate(invalidation);
199 pending_layer_->raster_source(), invalidation, gfx::Size(1000, 1000)); 191 pending_layer_->LowResTiling()->Invalidate(invalidation);
200 pending_layer_->LowResTiling()->UpdateTilesToCurrentRasterSource(
201 pending_layer_->raster_source(), invalidation, gfx::Size(1000, 1000));
202 192
203 active_layer_->ResetAllTilesPriorities(); 193 active_layer_->ResetAllTilesPriorities();
204 pending_layer_->ResetAllTilesPriorities(); 194 pending_layer_->ResetAllTilesPriorities();
205 195
206 // Renew all of the tile priorities. 196 // Renew all of the tile priorities.
207 gfx::Rect viewport(50, 50, 100, 100); 197 gfx::Rect viewport(50, 50, 100, 100);
208 pending_layer_->HighResTiling()->ComputeTilePriorityRects(viewport, 1.0f, 1.0, 198 pending_layer_->HighResTiling()->ComputeTilePriorityRects(viewport, 1.0f, 1.0,
209 Occlusion()); 199 Occlusion());
210 pending_layer_->LowResTiling()->ComputeTilePriorityRects(viewport, 1.0f, 1.0, 200 pending_layer_->LowResTiling()->ComputeTilePriorityRects(viewport, 1.0f, 1.0,
211 Occlusion()); 201 Occlusion());
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 } 428 }
439 EXPECT_EQ(all_tiles, smoothness_tiles); 429 EXPECT_EQ(all_tiles, smoothness_tiles);
440 430
441 tile_manager()->ReleaseTileResourcesForTesting( 431 tile_manager()->ReleaseTileResourcesForTesting(
442 std::vector<Tile*>(all_tiles.begin(), all_tiles.end())); 432 std::vector<Tile*>(all_tiles.begin(), all_tiles.end()));
443 433
444 Region invalidation(gfx::Rect(0, 0, 500, 500)); 434 Region invalidation(gfx::Rect(0, 0, 500, 500));
445 435
446 // Invalidate the pending tree. 436 // Invalidate the pending tree.
447 pending_layer_->set_invalidation(invalidation); 437 pending_layer_->set_invalidation(invalidation);
448 pending_layer_->HighResTiling()->UpdateTilesToCurrentRasterSource( 438 pending_layer_->HighResTiling()->Invalidate(invalidation);
449 pending_layer_->raster_source(), invalidation, gfx::Size(1000, 1000)); 439 pending_layer_->LowResTiling()->Invalidate(invalidation);
450 pending_layer_->LowResTiling()->UpdateTilesToCurrentRasterSource(
451 pending_layer_->raster_source(), invalidation, gfx::Size(1000, 1000));
452 440
453 active_layer_->ResetAllTilesPriorities(); 441 active_layer_->ResetAllTilesPriorities();
454 pending_layer_->ResetAllTilesPriorities(); 442 pending_layer_->ResetAllTilesPriorities();
455 443
456 // Renew all of the tile priorities. 444 // Renew all of the tile priorities.
457 gfx::Rect viewport(50, 50, 100, 100); 445 gfx::Rect viewport(50, 50, 100, 100);
458 pending_layer_->HighResTiling()->ComputeTilePriorityRects(viewport, 1.0f, 1.0, 446 pending_layer_->HighResTiling()->ComputeTilePriorityRects(viewport, 1.0f, 1.0,
459 Occlusion()); 447 Occlusion());
460 pending_layer_->LowResTiling()->ComputeTilePriorityRects(viewport, 1.0f, 1.0, 448 pending_layer_->LowResTiling()->ComputeTilePriorityRects(viewport, 1.0f, 1.0,
461 Occlusion()); 449 Occlusion());
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
868 all_tiles.insert(queue.Top()); 856 all_tiles.insert(queue.Top());
869 ++tile_count; 857 ++tile_count;
870 queue.Pop(); 858 queue.Pop();
871 } 859 }
872 EXPECT_EQ(tile_count, all_tiles.size()); 860 EXPECT_EQ(tile_count, all_tiles.size());
873 EXPECT_EQ(16u, tile_count); 861 EXPECT_EQ(16u, tile_count);
874 } 862 }
875 863
876 } // namespace 864 } // namespace
877 } // namespace cc 865 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/picture_layer_tiling_unittest.cc ('k') | cc/test/fake_picture_layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698