OLD | NEW |
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.h" | 5 #include "cc/trees/layer_tree_host.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
(...skipping 5066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5077 virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { | 5077 virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { |
5078 ++activation_count_; | 5078 ++activation_count_; |
5079 std::vector<Tile*> tiles = host_impl->tile_manager()->AllTilesForTesting(); | 5079 std::vector<Tile*> tiles = host_impl->tile_manager()->AllTilesForTesting(); |
5080 EXPECT_GT(tiles.size(), 0u); | 5080 EXPECT_GT(tiles.size(), 0u); |
5081 // When activating, ensure that all tiles are ready to draw with a mode | 5081 // When activating, ensure that all tiles are ready to draw with a mode |
5082 // other than rasterize on demand. | 5082 // other than rasterize on demand. |
5083 int resource_tiles_count = 0; | 5083 int resource_tiles_count = 0; |
5084 for (std::vector<Tile*>::iterator it = tiles.begin(); it != tiles.end(); | 5084 for (std::vector<Tile*>::iterator it = tiles.begin(); it != tiles.end(); |
5085 ++it) { | 5085 ++it) { |
5086 Tile* tile = *it; | 5086 Tile* tile = *it; |
5087 const ManagedTileState::TileVersion& tile_version = | 5087 const ManagedTileState::TileDrawInfo& draw_info = tile->GetTileDrawInfo(); |
5088 tile->GetTileVersionForDrawing(); | 5088 EXPECT_TRUE(draw_info.IsReadyToDraw()); |
5089 EXPECT_TRUE(tile_version.IsReadyToDraw()); | 5089 EXPECT_NE(ManagedTileState::TileDrawInfo::PICTURE_PILE_MODE, |
5090 EXPECT_NE(ManagedTileState::TileVersion::PICTURE_PILE_MODE, | 5090 draw_info.mode()); |
5091 tile_version.mode()); | |
5092 resource_tiles_count += | 5091 resource_tiles_count += |
5093 tile_version.mode() == ManagedTileState::TileVersion::RESOURCE_MODE; | 5092 draw_info.mode() == ManagedTileState::TileDrawInfo::RESOURCE_MODE; |
5094 } | 5093 } |
5095 EXPECT_GT(resource_tiles_count, 0); | 5094 EXPECT_GT(resource_tiles_count, 0); |
5096 | 5095 |
5097 EndTest(); | 5096 EndTest(); |
5098 } | 5097 } |
5099 | 5098 |
5100 virtual void AfterTest() OVERRIDE { | 5099 virtual void AfterTest() OVERRIDE { |
5101 // Double check that we activated once. | 5100 // Double check that we activated once. |
5102 EXPECT_EQ(1, activation_count_); | 5101 EXPECT_EQ(1, activation_count_); |
5103 } | 5102 } |
5104 | 5103 |
5105 private: | 5104 private: |
5106 int activation_count_; | 5105 int activation_count_; |
5107 | 5106 |
5108 FakeContentLayerClient client_; | 5107 FakeContentLayerClient client_; |
5109 scoped_refptr<FakePictureLayer> picture_layer_; | 5108 scoped_refptr<FakePictureLayer> picture_layer_; |
5110 }; | 5109 }; |
5111 | 5110 |
5112 // TODO(vmpstr): Enable with single thread impl-side painting. | 5111 // TODO(vmpstr): Enable with single thread impl-side painting. |
5113 MULTI_THREAD_TEST_F(LayerTreeHostTestInvisibleDoesntActivate); | 5112 MULTI_THREAD_TEST_F(LayerTreeHostTestInvisibleDoesntActivate); |
5114 | 5113 |
5115 } // namespace cc | 5114 } // namespace cc |
OLD | NEW |