OLD | NEW |
---|---|
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/layers/picture_layer_impl.h" | 5 #include "cc/layers/picture_layer_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <set> | 9 #include <set> |
10 #include <utility> | 10 #include <utility> |
(...skipping 2480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2491 | 2491 |
2492 SetContentsScaleOnBothLayers(contents_scale, | 2492 SetContentsScaleOnBothLayers(contents_scale, |
2493 device_scale, | 2493 device_scale, |
2494 page_scale, | 2494 page_scale, |
2495 maximum_animation_scale, | 2495 maximum_animation_scale, |
2496 animating_transform); | 2496 animating_transform); |
2497 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 4.f); | 2497 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 4.f); |
2498 } | 2498 } |
2499 | 2499 |
2500 TEST_F(PictureLayerImplTest, LayerRasterTileIterator) { | 2500 TEST_F(PictureLayerImplTest, LayerRasterTileIterator) { |
2501 base::TimeTicks time_ticks; | |
2502 time_ticks += base::TimeDelta::FromMilliseconds(1); | |
2503 host_impl_.SetCurrentBeginFrameArgs( | |
2504 CreateBeginFrameArgsForTesting(time_ticks)); | |
2505 | |
2501 gfx::Size tile_size(100, 100); | 2506 gfx::Size tile_size(100, 100); |
2502 gfx::Size layer_bounds(1000, 1000); | 2507 gfx::Size layer_bounds(1000, 1000); |
2503 | 2508 |
2504 scoped_refptr<FakePicturePileImpl> pending_pile = | 2509 scoped_refptr<FakePicturePileImpl> pending_pile = |
2505 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 2510 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
2506 | 2511 |
2507 SetupPendingTree(pending_pile); | 2512 SetupPendingTree(pending_pile); |
2508 | 2513 |
2509 ASSERT_TRUE(pending_layer_->CanHaveTilings()); | 2514 ASSERT_TRUE(pending_layer_->CanHaveTilings()); |
2510 | 2515 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2556 unique_tiles.insert(tile); | 2561 unique_tiles.insert(tile); |
2557 } | 2562 } |
2558 | 2563 |
2559 EXPECT_TRUE(reached_prepaint); | 2564 EXPECT_TRUE(reached_prepaint); |
2560 EXPECT_EQ(0u, non_ideal_tile_count); | 2565 EXPECT_EQ(0u, non_ideal_tile_count); |
2561 EXPECT_EQ(1u, low_res_tile_count); | 2566 EXPECT_EQ(1u, low_res_tile_count); |
2562 EXPECT_EQ(16u, high_res_tile_count); | 2567 EXPECT_EQ(16u, high_res_tile_count); |
2563 EXPECT_EQ(low_res_tile_count + high_res_tile_count + non_ideal_tile_count, | 2568 EXPECT_EQ(low_res_tile_count + high_res_tile_count + non_ideal_tile_count, |
2564 unique_tiles.size()); | 2569 unique_tiles.size()); |
2565 | 2570 |
2571 // No NOW tiles. | |
2572 time_ticks += base::TimeDelta::FromMilliseconds(200); | |
2573 host_impl_.SetCurrentBeginFrameArgs( | |
2574 CreateBeginFrameArgsForTesting(time_ticks)); | |
2575 | |
2576 pending_layer_->draw_properties().visible_content_rect = | |
vmpstr
2014/09/10 15:49:05
This works. I just wanted it to be a simple one li
| |
2577 gfx::Rect(1100, 1100, 500, 500); | |
2578 pending_layer_->UpdateTiles(NULL); | |
2579 | |
2580 unique_tiles.clear(); | |
2581 high_res_tile_count = 0u; | |
2582 for (it = PictureLayerImpl::LayerRasterTileIterator(pending_layer_, false); | |
2583 it; | |
2584 ++it) { | |
2585 Tile* tile = *it; | |
2586 TilePriority priority = tile->priority(PENDING_TREE); | |
2587 | |
2588 EXPECT_TRUE(tile); | |
2589 | |
2590 // Non-high res tiles only get visible tiles. | |
2591 EXPECT_EQ(HIGH_RESOLUTION, priority.resolution); | |
2592 EXPECT_NE(TilePriority::NOW, priority.priority_bin); | |
2593 | |
2594 high_res_tile_count += priority.resolution == HIGH_RESOLUTION; | |
2595 | |
2596 unique_tiles.insert(tile); | |
2597 } | |
2598 | |
2599 EXPECT_EQ(16u, high_res_tile_count); | |
2600 EXPECT_EQ(high_res_tile_count, unique_tiles.size()); | |
2601 | |
2602 time_ticks += base::TimeDelta::FromMilliseconds(200); | |
2603 host_impl_.SetCurrentBeginFrameArgs( | |
2604 CreateBeginFrameArgsForTesting(time_ticks)); | |
2605 | |
2606 pending_layer_->draw_properties().visible_content_rect = | |
2607 gfx::Rect(0, 0, 500, 500); | |
2608 pending_layer_->UpdateTiles(NULL); | |
2609 | |
2566 std::vector<Tile*> high_res_tiles = high_res_tiling->AllTilesForTesting(); | 2610 std::vector<Tile*> high_res_tiles = high_res_tiling->AllTilesForTesting(); |
2567 for (std::vector<Tile*>::iterator tile_it = high_res_tiles.begin(); | 2611 for (std::vector<Tile*>::iterator tile_it = high_res_tiles.begin(); |
2568 tile_it != high_res_tiles.end(); | 2612 tile_it != high_res_tiles.end(); |
2569 ++tile_it) { | 2613 ++tile_it) { |
2570 Tile* tile = *tile_it; | 2614 Tile* tile = *tile_it; |
2571 ManagedTileState::TileVersion& tile_version = | 2615 ManagedTileState::TileVersion& tile_version = |
2572 tile->GetTileVersionForTesting( | 2616 tile->GetTileVersionForTesting( |
2573 tile->DetermineRasterModeForTree(ACTIVE_TREE)); | 2617 tile->DetermineRasterModeForTree(ACTIVE_TREE)); |
2574 tile_version.SetSolidColorForTesting(SK_ColorRED); | 2618 tile_version.SetSolidColorForTesting(SK_ColorRED); |
2575 } | 2619 } |
(...skipping 1597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4173 ActivateTree(); | 4217 ActivateTree(); |
4174 EXPECT_TRUE(active_layer_->GetRecycledTwinLayer()); | 4218 EXPECT_TRUE(active_layer_->GetRecycledTwinLayer()); |
4175 EXPECT_EQ(old_pending_layer_, active_layer_->GetRecycledTwinLayer()); | 4219 EXPECT_EQ(old_pending_layer_, active_layer_->GetRecycledTwinLayer()); |
4176 | 4220 |
4177 host_impl_.ResetRecycleTreeForTesting(); | 4221 host_impl_.ResetRecycleTreeForTesting(); |
4178 EXPECT_FALSE(active_layer_->GetRecycledTwinLayer()); | 4222 EXPECT_FALSE(active_layer_->GetRecycledTwinLayer()); |
4179 } | 4223 } |
4180 | 4224 |
4181 } // namespace | 4225 } // namespace |
4182 } // namespace cc | 4226 } // namespace cc |
OLD | NEW |