| 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 5818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5829 | 5829 |
| 5830 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 5830 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 5831 | 5831 |
| 5832 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 5832 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
| 5833 LayerTreeHostImpl::FrameData* frame_data, | 5833 LayerTreeHostImpl::FrameData* frame_data, |
| 5834 DrawResult draw_result) override { | 5834 DrawResult draw_result) override { |
| 5835 EXPECT_EQ(4u, host_impl->resource_provider()->num_resources()); | 5835 EXPECT_EQ(4u, host_impl->resource_provider()->num_resources()); |
| 5836 | 5836 |
| 5837 // Verify which tiles got resources using an eviction iterator, which has to | 5837 // Verify which tiles got resources using an eviction iterator, which has to |
| 5838 // return all tiles that have resources. | 5838 // return all tiles that have resources. |
| 5839 EvictionTilePriorityQueue eviction_queue; | 5839 scoped_ptr<EvictionTilePriorityQueue> eviction_queue( |
| 5840 host_impl->BuildEvictionQueue(&eviction_queue, | 5840 host_impl->BuildEvictionQueue(SAME_PRIORITY_FOR_BOTH_TREES)); |
| 5841 SAME_PRIORITY_FOR_BOTH_TREES); | |
| 5842 int tile_count = 0; | 5841 int tile_count = 0; |
| 5843 for (; !eviction_queue.IsEmpty(); eviction_queue.Pop()) { | 5842 for (; !eviction_queue->IsEmpty(); eviction_queue->Pop()) { |
| 5844 Tile* tile = eviction_queue.Top(); | 5843 Tile* tile = eviction_queue->Top(); |
| 5845 // Ensure this tile is within the viewport. | 5844 // Ensure this tile is within the viewport. |
| 5846 EXPECT_TRUE(tile->content_rect().Intersects(gfx::Rect(viewport_size_))); | 5845 EXPECT_TRUE(tile->content_rect().Intersects(gfx::Rect(viewport_size_))); |
| 5847 // Ensure that the tile is 1/4 of the viewport tall (plus padding). | 5846 // Ensure that the tile is 1/4 of the viewport tall (plus padding). |
| 5848 EXPECT_EQ(tile->content_rect().height(), | 5847 EXPECT_EQ(tile->content_rect().height(), |
| 5849 (viewport_size_.height() / 4) + 2); | 5848 (viewport_size_.height() / 4) + 2); |
| 5850 ++tile_count; | 5849 ++tile_count; |
| 5851 } | 5850 } |
| 5852 EXPECT_EQ(4, tile_count); | 5851 EXPECT_EQ(4, tile_count); |
| 5853 EndTest(); | 5852 EndTest(); |
| 5854 return draw_result; | 5853 return draw_result; |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6171 | 6170 |
| 6172 void AfterTest() override { EXPECT_TRUE(did_commit_); } | 6171 void AfterTest() override { EXPECT_TRUE(did_commit_); } |
| 6173 | 6172 |
| 6174 private: | 6173 private: |
| 6175 bool did_commit_; | 6174 bool did_commit_; |
| 6176 }; | 6175 }; |
| 6177 | 6176 |
| 6178 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoTasksBetweenWillAndDidCommit); | 6177 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoTasksBetweenWillAndDidCommit); |
| 6179 | 6178 |
| 6180 } // namespace cc | 6179 } // namespace cc |
| OLD | NEW |