| 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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 PictureLayerTiling* tiling = tilings->tiling_at(i); | 399 PictureLayerTiling* tiling = tilings->tiling_at(i); |
| 400 EXPECT_EQ( | 400 EXPECT_EQ( |
| 401 tiling->GetCurrentVisibleRectForTesting(), | 401 tiling->GetCurrentVisibleRectForTesting(), |
| 402 gfx::ScaleToEnclosingRect(viewport_rect_for_tile_priority_in_view_space, | 402 gfx::ScaleToEnclosingRect(viewport_rect_for_tile_priority_in_view_space, |
| 403 tiling->contents_scale())); | 403 tiling->contents_scale())); |
| 404 } | 404 } |
| 405 } | 405 } |
| 406 | 406 |
| 407 TEST_F(PictureLayerImplTest, InvalidViewportForPrioritizingTiles) { | 407 TEST_F(PictureLayerImplTest, InvalidViewportForPrioritizingTiles) { |
| 408 base::TimeTicks time_ticks; | 408 base::TimeTicks time_ticks; |
| 409 time_ticks += base::TimeDelta::FromMilliseconds(1); |
| 409 host_impl_.SetCurrentFrameTimeTicks(time_ticks); | 410 host_impl_.SetCurrentFrameTimeTicks(time_ticks); |
| 410 | 411 |
| 411 gfx::Size tile_size(100, 100); | 412 gfx::Size tile_size(100, 100); |
| 412 gfx::Size layer_bounds(400, 400); | 413 gfx::Size layer_bounds(400, 400); |
| 413 | 414 |
| 414 scoped_refptr<FakePicturePileImpl> pending_pile = | 415 scoped_refptr<FakePicturePileImpl> pending_pile = |
| 415 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 416 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
| 416 scoped_refptr<FakePicturePileImpl> active_pile = | 417 scoped_refptr<FakePicturePileImpl> active_pile = |
| 417 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 418 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
| 418 | 419 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 EXPECT_FALSE(visible_rect_for_tile_priority == | 488 EXPECT_FALSE(visible_rect_for_tile_priority == |
| 488 active_layer_->visible_rect_for_tile_priority()); | 489 active_layer_->visible_rect_for_tile_priority()); |
| 489 EXPECT_FALSE(viewport_rect_for_tile_priority == | 490 EXPECT_FALSE(viewport_rect_for_tile_priority == |
| 490 active_layer_->viewport_rect_for_tile_priority()); | 491 active_layer_->viewport_rect_for_tile_priority()); |
| 491 EXPECT_FALSE(screen_space_transform_for_tile_priority == | 492 EXPECT_FALSE(screen_space_transform_for_tile_priority == |
| 492 active_layer_->screen_space_transform_for_tile_priority()); | 493 active_layer_->screen_space_transform_for_tile_priority()); |
| 493 } | 494 } |
| 494 | 495 |
| 495 TEST_F(PictureLayerImplTest, InvalidViewportAfterReleaseResources) { | 496 TEST_F(PictureLayerImplTest, InvalidViewportAfterReleaseResources) { |
| 496 base::TimeTicks time_ticks; | 497 base::TimeTicks time_ticks; |
| 498 time_ticks += base::TimeDelta::FromMilliseconds(1); |
| 497 host_impl_.SetCurrentFrameTimeTicks(time_ticks); | 499 host_impl_.SetCurrentFrameTimeTicks(time_ticks); |
| 498 | 500 |
| 499 gfx::Size tile_size(100, 100); | 501 gfx::Size tile_size(100, 100); |
| 500 gfx::Size layer_bounds(400, 400); | 502 gfx::Size layer_bounds(400, 400); |
| 501 | 503 |
| 502 scoped_refptr<FakePicturePileImpl> pending_pile = | 504 scoped_refptr<FakePicturePileImpl> pending_pile = |
| 503 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 505 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
| 504 scoped_refptr<FakePicturePileImpl> active_pile = | 506 scoped_refptr<FakePicturePileImpl> active_pile = |
| 505 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 507 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
| 506 | 508 |
| (...skipping 2160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2667 // Since the active layer has no tiles at all, the pending layer doesn't | 2669 // Since the active layer has no tiles at all, the pending layer doesn't |
| 2668 // need content in order to activate. | 2670 // need content in order to activate. |
| 2669 pending_layer_->MarkVisibleResourcesAsRequired(); | 2671 pending_layer_->MarkVisibleResourcesAsRequired(); |
| 2670 AssertNoTilesRequired(pending_layer_->HighResTiling()); | 2672 AssertNoTilesRequired(pending_layer_->HighResTiling()); |
| 2671 if (host_impl_.settings().create_low_res_tiling) | 2673 if (host_impl_.settings().create_low_res_tiling) |
| 2672 AssertNoTilesRequired(pending_layer_->LowResTiling()); | 2674 AssertNoTilesRequired(pending_layer_->LowResTiling()); |
| 2673 } | 2675 } |
| 2674 | 2676 |
| 2675 TEST_F(NoLowResPictureLayerImplTest, InvalidViewportForPrioritizingTiles) { | 2677 TEST_F(NoLowResPictureLayerImplTest, InvalidViewportForPrioritizingTiles) { |
| 2676 base::TimeTicks time_ticks; | 2678 base::TimeTicks time_ticks; |
| 2679 time_ticks += base::TimeDelta::FromMilliseconds(1); |
| 2677 host_impl_.SetCurrentFrameTimeTicks(time_ticks); | 2680 host_impl_.SetCurrentFrameTimeTicks(time_ticks); |
| 2678 | 2681 |
| 2679 gfx::Size tile_size(100, 100); | 2682 gfx::Size tile_size(100, 100); |
| 2680 gfx::Size layer_bounds(400, 400); | 2683 gfx::Size layer_bounds(400, 400); |
| 2681 | 2684 |
| 2682 scoped_refptr<FakePicturePileImpl> pending_pile = | 2685 scoped_refptr<FakePicturePileImpl> pending_pile = |
| 2683 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 2686 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
| 2684 scoped_refptr<FakePicturePileImpl> active_pile = | 2687 scoped_refptr<FakePicturePileImpl> active_pile = |
| 2685 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 2688 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
| 2686 | 2689 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2755 EXPECT_FALSE(visible_rect_for_tile_priority == | 2758 EXPECT_FALSE(visible_rect_for_tile_priority == |
| 2756 active_layer_->visible_rect_for_tile_priority()); | 2759 active_layer_->visible_rect_for_tile_priority()); |
| 2757 EXPECT_FALSE(viewport_rect_for_tile_priority == | 2760 EXPECT_FALSE(viewport_rect_for_tile_priority == |
| 2758 active_layer_->viewport_rect_for_tile_priority()); | 2761 active_layer_->viewport_rect_for_tile_priority()); |
| 2759 EXPECT_FALSE(screen_space_transform_for_tile_priority == | 2762 EXPECT_FALSE(screen_space_transform_for_tile_priority == |
| 2760 active_layer_->screen_space_transform_for_tile_priority()); | 2763 active_layer_->screen_space_transform_for_tile_priority()); |
| 2761 } | 2764 } |
| 2762 | 2765 |
| 2763 TEST_F(NoLowResPictureLayerImplTest, InvalidViewportAfterReleaseResources) { | 2766 TEST_F(NoLowResPictureLayerImplTest, InvalidViewportAfterReleaseResources) { |
| 2764 base::TimeTicks time_ticks; | 2767 base::TimeTicks time_ticks; |
| 2768 time_ticks += base::TimeDelta::FromMilliseconds(1); |
| 2765 host_impl_.SetCurrentFrameTimeTicks(time_ticks); | 2769 host_impl_.SetCurrentFrameTimeTicks(time_ticks); |
| 2766 | 2770 |
| 2767 gfx::Size tile_size(100, 100); | 2771 gfx::Size tile_size(100, 100); |
| 2768 gfx::Size layer_bounds(400, 400); | 2772 gfx::Size layer_bounds(400, 400); |
| 2769 | 2773 |
| 2770 scoped_refptr<FakePicturePileImpl> pending_pile = | 2774 scoped_refptr<FakePicturePileImpl> pending_pile = |
| 2771 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 2775 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
| 2772 scoped_refptr<FakePicturePileImpl> active_pile = | 2776 scoped_refptr<FakePicturePileImpl> active_pile = |
| 2773 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 2777 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
| 2774 | 2778 |
| (...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3705 | 3709 |
| 3706 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(all_tiles); | 3710 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(all_tiles); |
| 3707 | 3711 |
| 3708 VerifyEvictionConsidersOcclusion(pending_layer_, | 3712 VerifyEvictionConsidersOcclusion(pending_layer_, |
| 3709 total_expected_occluded_tile_count); | 3713 total_expected_occluded_tile_count); |
| 3710 VerifyEvictionConsidersOcclusion(active_layer_, | 3714 VerifyEvictionConsidersOcclusion(active_layer_, |
| 3711 total_expected_occluded_tile_count); | 3715 total_expected_occluded_tile_count); |
| 3712 } | 3716 } |
| 3713 } // namespace | 3717 } // namespace |
| 3714 } // namespace cc | 3718 } // namespace cc |
| OLD | NEW |