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