| 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 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 tiling->contents_scale()); | 558 tiling->contents_scale()); |
| 559 for (PictureLayerTiling::CoverageIterator iter( | 559 for (PictureLayerTiling::CoverageIterator iter( |
| 560 tiling, | 560 tiling, |
| 561 tiling->contents_scale(), | 561 tiling->contents_scale(), |
| 562 gfx::Rect(tiling->tiling_size())); | 562 gfx::Rect(tiling->tiling_size())); |
| 563 iter; | 563 iter; |
| 564 ++iter) { | 564 ++iter) { |
| 565 EXPECT_TRUE(*iter); | 565 EXPECT_TRUE(*iter); |
| 566 EXPECT_FALSE(iter.geometry_rect().IsEmpty()); | 566 EXPECT_FALSE(iter.geometry_rect().IsEmpty()); |
| 567 if (iter.geometry_rect().Intersects(content_invalidation)) | 567 if (iter.geometry_rect().Intersects(content_invalidation)) |
| 568 EXPECT_EQ(pending_pile, iter->picture_pile()); | 568 EXPECT_EQ(pending_pile.get(), iter->picture_pile()); |
| 569 else | 569 else |
| 570 EXPECT_EQ(active_pile, iter->picture_pile()); | 570 EXPECT_EQ(active_pile.get(), iter->picture_pile()); |
| 571 } | 571 } |
| 572 } | 572 } |
| 573 } | 573 } |
| 574 | 574 |
| 575 TEST_F(PictureLayerImplTest, CloneFullInvalidation) { | 575 TEST_F(PictureLayerImplTest, CloneFullInvalidation) { |
| 576 gfx::Size tile_size(90, 80); | 576 gfx::Size tile_size(90, 80); |
| 577 gfx::Size layer_bounds(300, 500); | 577 gfx::Size layer_bounds(300, 500); |
| 578 | 578 |
| 579 scoped_refptr<FakePicturePileImpl> pending_pile = | 579 scoped_refptr<FakePicturePileImpl> pending_pile = |
| 580 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 580 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 ++iter) { | 627 ++iter) { |
| 628 EXPECT_TRUE(*iter); | 628 EXPECT_TRUE(*iter); |
| 629 EXPECT_FALSE(iter.geometry_rect().IsEmpty()); | 629 EXPECT_FALSE(iter.geometry_rect().IsEmpty()); |
| 630 std::vector<Tile*> active_tiles = | 630 std::vector<Tile*> active_tiles = |
| 631 active_layer_->tilings()->tiling_at(i)->AllTilesForTesting(); | 631 active_layer_->tilings()->tiling_at(i)->AllTilesForTesting(); |
| 632 std::vector<Tile*> pending_tiles = tiling->AllTilesForTesting(); | 632 std::vector<Tile*> pending_tiles = tiling->AllTilesForTesting(); |
| 633 if (iter.geometry_rect().right() >= active_content_bounds.width() || | 633 if (iter.geometry_rect().right() >= active_content_bounds.width() || |
| 634 iter.geometry_rect().bottom() >= active_content_bounds.height() || | 634 iter.geometry_rect().bottom() >= active_content_bounds.height() || |
| 635 active_tiles[0]->content_rect().size() != | 635 active_tiles[0]->content_rect().size() != |
| 636 pending_tiles[0]->content_rect().size()) { | 636 pending_tiles[0]->content_rect().size()) { |
| 637 EXPECT_EQ(pending_pile, iter->picture_pile()); | 637 EXPECT_EQ(pending_pile.get(), iter->picture_pile()); |
| 638 } else { | 638 } else { |
| 639 EXPECT_EQ(active_pile, iter->picture_pile()); | 639 EXPECT_EQ(active_pile.get(), iter->picture_pile()); |
| 640 } | 640 } |
| 641 } | 641 } |
| 642 } | 642 } |
| 643 } | 643 } |
| 644 | 644 |
| 645 TEST_F(PictureLayerImplTest, AddTilesFromNewRecording) { | 645 TEST_F(PictureLayerImplTest, AddTilesFromNewRecording) { |
| 646 gfx::Size tile_size(400, 400); | 646 gfx::Size tile_size(400, 400); |
| 647 gfx::Size layer_bounds(1300, 1900); | 647 gfx::Size layer_bounds(1300, 1900); |
| 648 | 648 |
| 649 scoped_refptr<FakePicturePileImpl> pending_pile = | 649 scoped_refptr<FakePicturePileImpl> pending_pile = |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 iter; | 682 iter; |
| 683 ++iter) { | 683 ++iter) { |
| 684 EXPECT_FALSE(iter.full_tile_geometry_rect().IsEmpty()); | 684 EXPECT_FALSE(iter.full_tile_geometry_rect().IsEmpty()); |
| 685 // Ensure there is a recording for this tile. | 685 // Ensure there is a recording for this tile. |
| 686 bool in_pending = pending_pile->CanRaster(tiling->contents_scale(), | 686 bool in_pending = pending_pile->CanRaster(tiling->contents_scale(), |
| 687 iter.full_tile_geometry_rect()); | 687 iter.full_tile_geometry_rect()); |
| 688 bool in_active = active_pile->CanRaster(tiling->contents_scale(), | 688 bool in_active = active_pile->CanRaster(tiling->contents_scale(), |
| 689 iter.full_tile_geometry_rect()); | 689 iter.full_tile_geometry_rect()); |
| 690 | 690 |
| 691 if (in_pending && !in_active) | 691 if (in_pending && !in_active) |
| 692 EXPECT_EQ(pending_pile, iter->picture_pile()); | 692 EXPECT_EQ(pending_pile.get(), iter->picture_pile()); |
| 693 else if (in_active) | 693 else if (in_active) |
| 694 EXPECT_EQ(active_pile, iter->picture_pile()); | 694 EXPECT_EQ(active_pile.get(), iter->picture_pile()); |
| 695 else | 695 else |
| 696 EXPECT_FALSE(*iter); | 696 EXPECT_FALSE(*iter); |
| 697 } | 697 } |
| 698 } | 698 } |
| 699 } | 699 } |
| 700 | 700 |
| 701 TEST_F(PictureLayerImplTest, ManageTilingsWithNoRecording) { | 701 TEST_F(PictureLayerImplTest, ManageTilingsWithNoRecording) { |
| 702 gfx::Size tile_size(400, 400); | 702 gfx::Size tile_size(400, 400); |
| 703 gfx::Size layer_bounds(1300, 1900); | 703 gfx::Size layer_bounds(1300, 1900); |
| 704 | 704 |
| (...skipping 3286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3991 | 3991 |
| 3992 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(all_tiles); | 3992 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(all_tiles); |
| 3993 | 3993 |
| 3994 VerifyEvictionConsidersOcclusion(pending_layer_, | 3994 VerifyEvictionConsidersOcclusion(pending_layer_, |
| 3995 total_expected_occluded_tile_count); | 3995 total_expected_occluded_tile_count); |
| 3996 VerifyEvictionConsidersOcclusion(active_layer_, | 3996 VerifyEvictionConsidersOcclusion(active_layer_, |
| 3997 total_expected_occluded_tile_count); | 3997 total_expected_occluded_tile_count); |
| 3998 } | 3998 } |
| 3999 } // namespace | 3999 } // namespace |
| 4000 } // namespace cc | 4000 } // namespace cc |
| OLD | NEW |