Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: cc/layers/picture_layer_impl_unittest.cc

Issue 816453008: cc: Split tiling set raster queues into all and required. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/layers/picture_layer_impl_perftest.cc ('k') | cc/resources/picture_layer_tiling.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
11 11
12 #include "cc/base/math_util.h" 12 #include "cc/base/math_util.h"
13 #include "cc/layers/append_quads_data.h" 13 #include "cc/layers/append_quads_data.h"
14 #include "cc/layers/picture_layer.h" 14 #include "cc/layers/picture_layer.h"
15 #include "cc/quads/draw_quad.h" 15 #include "cc/quads/draw_quad.h"
16 #include "cc/quads/tile_draw_quad.h" 16 #include "cc/quads/tile_draw_quad.h"
17 #include "cc/resources/tiling_set_raster_queue_all.h"
18 #include "cc/resources/tiling_set_raster_queue_required.h"
17 #include "cc/test/begin_frame_args_test.h" 19 #include "cc/test/begin_frame_args_test.h"
18 #include "cc/test/fake_content_layer_client.h" 20 #include "cc/test/fake_content_layer_client.h"
19 #include "cc/test/fake_impl_proxy.h" 21 #include "cc/test/fake_impl_proxy.h"
20 #include "cc/test/fake_layer_tree_host_impl.h" 22 #include "cc/test/fake_layer_tree_host_impl.h"
21 #include "cc/test/fake_output_surface.h" 23 #include "cc/test/fake_output_surface.h"
22 #include "cc/test/fake_picture_layer_impl.h" 24 #include "cc/test/fake_picture_layer_impl.h"
23 #include "cc/test/fake_picture_pile_impl.h" 25 #include "cc/test/fake_picture_pile_impl.h"
24 #include "cc/test/geometry_test_utils.h" 26 #include "cc/test/geometry_test_utils.h"
25 #include "cc/test/impl_side_painting_settings.h" 27 #include "cc/test/impl_side_painting_settings.h"
26 #include "cc/test/layer_test_common.h" 28 #include "cc/test/layer_test_common.h"
(...skipping 1579 matching lines...) Expand 10 before | Expand all | Expand 10 after
1606 1608
1607 base::TimeTicks time_ticks; 1609 base::TimeTicks time_ticks;
1608 time_ticks += base::TimeDelta::FromMilliseconds(1); 1610 time_ticks += base::TimeDelta::FromMilliseconds(1);
1609 host_impl_.SetCurrentBeginFrameArgs( 1611 host_impl_.SetCurrentBeginFrameArgs(
1610 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); 1612 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks));
1611 pending_layer_->UpdateTiles(Occlusion(), resourceless_software_draw); 1613 pending_layer_->UpdateTiles(Occlusion(), resourceless_software_draw);
1612 1614
1613 int num_visible = 0; 1615 int num_visible = 0;
1614 int num_offscreen = 0; 1616 int num_offscreen = 0;
1615 1617
1616 scoped_ptr<TilingSetRasterQueue> queue = 1618 scoped_ptr<TilingSetRasterQueue> queue(new TilingSetRasterQueueAll(
1617 pending_layer_->CreateRasterQueue(false); 1619 pending_layer_->picture_layer_tiling_set(), false));
1618 for (; !queue->IsEmpty(); queue->Pop()) { 1620 for (; !queue->IsEmpty(); queue->Pop()) {
1619 const Tile* tile = queue->Top(); 1621 const Tile* tile = queue->Top();
1620 DCHECK(tile); 1622 DCHECK(tile);
1621 if (tile->priority(PENDING_TREE).distance_to_visible == 0.f) { 1623 if (tile->priority(PENDING_TREE).distance_to_visible == 0.f) {
1622 EXPECT_TRUE(tile->required_for_activation()); 1624 EXPECT_TRUE(tile->required_for_activation());
1623 num_visible++; 1625 num_visible++;
1624 } else { 1626 } else {
1625 EXPECT_FALSE(tile->required_for_activation()); 1627 EXPECT_FALSE(tile->required_for_activation());
1626 num_offscreen++; 1628 num_offscreen++;
1627 } 1629 }
(...skipping 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after
2737 } 2739 }
2738 2740
2739 TEST_F(PictureLayerImplTest, TilingSetRasterQueue) { 2741 TEST_F(PictureLayerImplTest, TilingSetRasterQueue) {
2740 base::TimeTicks time_ticks; 2742 base::TimeTicks time_ticks;
2741 time_ticks += base::TimeDelta::FromMilliseconds(1); 2743 time_ticks += base::TimeDelta::FromMilliseconds(1);
2742 host_impl_.SetCurrentBeginFrameArgs( 2744 host_impl_.SetCurrentBeginFrameArgs(
2743 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); 2745 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks));
2744 2746
2745 host_impl_.SetViewportSize(gfx::Size(500, 500)); 2747 host_impl_.SetViewportSize(gfx::Size(500, 500));
2746 2748
2747 gfx::Size tile_size(100, 100); 2749 gfx::Size recording_tile_size(100, 100);
2748 gfx::Size layer_bounds(1000, 1000); 2750 gfx::Size layer_bounds(1000, 1000);
2749 2751
2750 scoped_refptr<FakePicturePileImpl> pending_pile = 2752 scoped_refptr<FakePicturePileImpl> pending_pile =
2751 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 2753 FakePicturePileImpl::CreateFilledPile(recording_tile_size, layer_bounds);
2752 2754
2753 SetupPendingTree(pending_pile); 2755 SetupPendingTree(pending_pile);
2754 EXPECT_EQ(2u, pending_layer_->num_tilings()); 2756 EXPECT_EQ(2u, pending_layer_->num_tilings());
2755 2757
2756 scoped_ptr<TilingSetRasterQueue> queue =
2757 pending_layer_->CreateRasterQueue(false);
2758
2759 std::set<Tile*> unique_tiles; 2758 std::set<Tile*> unique_tiles;
2760 bool reached_prepaint = false; 2759 bool reached_prepaint = false;
2761 size_t non_ideal_tile_count = 0u; 2760 int non_ideal_tile_count = 0u;
2762 size_t low_res_tile_count = 0u; 2761 int low_res_tile_count = 0u;
2763 size_t high_res_tile_count = 0u; 2762 int high_res_tile_count = 0u;
2764 queue = pending_layer_->CreateRasterQueue(false); 2763 int high_res_now_tiles = 0u;
2764 scoped_ptr<TilingSetRasterQueue> queue(new TilingSetRasterQueueAll(
2765 pending_layer_->picture_layer_tiling_set(), false));
2765 while (!queue->IsEmpty()) { 2766 while (!queue->IsEmpty()) {
2766 Tile* tile = queue->Top(); 2767 Tile* tile = queue->Top();
2767 TilePriority priority = tile->priority(PENDING_TREE); 2768 TilePriority priority = tile->priority(PENDING_TREE);
2768 2769
2769 EXPECT_TRUE(tile); 2770 EXPECT_TRUE(tile);
2770 2771
2771 // Non-high res tiles only get visible tiles. Also, prepaint should only 2772 // Non-high res tiles only get visible tiles. Also, prepaint should only
2772 // come at the end of the iteration. 2773 // come at the end of the iteration.
2773 if (priority.resolution != HIGH_RESOLUTION) 2774 if (priority.resolution != HIGH_RESOLUTION) {
2774 EXPECT_EQ(TilePriority::NOW, priority.priority_bin); 2775 EXPECT_EQ(TilePriority::NOW, priority.priority_bin);
2775 else if (reached_prepaint) 2776 } else if (reached_prepaint) {
2776 EXPECT_NE(TilePriority::NOW, priority.priority_bin); 2777 EXPECT_NE(TilePriority::NOW, priority.priority_bin);
2777 else 2778 } else {
2778 reached_prepaint = priority.priority_bin != TilePriority::NOW; 2779 reached_prepaint = priority.priority_bin != TilePriority::NOW;
2780 if (!reached_prepaint)
2781 ++high_res_now_tiles;
2782 }
2779 2783
2780 non_ideal_tile_count += priority.resolution == NON_IDEAL_RESOLUTION; 2784 non_ideal_tile_count += priority.resolution == NON_IDEAL_RESOLUTION;
2781 low_res_tile_count += priority.resolution == LOW_RESOLUTION; 2785 low_res_tile_count += priority.resolution == LOW_RESOLUTION;
2782 high_res_tile_count += priority.resolution == HIGH_RESOLUTION; 2786 high_res_tile_count += priority.resolution == HIGH_RESOLUTION;
2783 2787
2784 unique_tiles.insert(tile); 2788 unique_tiles.insert(tile);
2785 queue->Pop(); 2789 queue->Pop();
2786 } 2790 }
2787 2791
2788 EXPECT_TRUE(reached_prepaint); 2792 EXPECT_TRUE(reached_prepaint);
2789 EXPECT_EQ(0u, non_ideal_tile_count); 2793 EXPECT_EQ(0, non_ideal_tile_count);
2790 EXPECT_EQ(0u, low_res_tile_count); 2794 EXPECT_EQ(0, low_res_tile_count);
2791 EXPECT_EQ(16u, high_res_tile_count); 2795
2796 // With layer size being 1000x1000 and default tile size 256x256, we expect to
2797 // see 4 now tiles out of 16 total high res tiles.
2798 EXPECT_EQ(16, high_res_tile_count);
2799 EXPECT_EQ(4, high_res_now_tiles);
2792 EXPECT_EQ(low_res_tile_count + high_res_tile_count + non_ideal_tile_count, 2800 EXPECT_EQ(low_res_tile_count + high_res_tile_count + non_ideal_tile_count,
2793 unique_tiles.size()); 2801 static_cast<int>(unique_tiles.size()));
2802
2803 queue.reset(new TilingSetRasterQueueRequired(
2804 pending_layer_->picture_layer_tiling_set(),
2805 RasterTilePriorityQueue::Type::REQUIRED_FOR_DRAW));
2806 EXPECT_TRUE(queue->IsEmpty());
2807
2808 queue.reset(new TilingSetRasterQueueRequired(
2809 pending_layer_->picture_layer_tiling_set(),
2810 RasterTilePriorityQueue::Type::REQUIRED_FOR_ACTIVATION));
2811 EXPECT_FALSE(queue->IsEmpty());
2812 int required_for_activation_count = 0;
2813 while (!queue->IsEmpty()) {
2814 Tile* tile = queue->Top();
2815 EXPECT_TRUE(tile->required_for_activation());
2816 EXPECT_FALSE(tile->IsReadyToDraw());
2817 ++required_for_activation_count;
2818 queue->Pop();
2819 }
2820
2821 // All of the high res tiles should be required for activation, since there is
2822 // no active twin.
2823 EXPECT_EQ(high_res_now_tiles, required_for_activation_count);
2794 2824
2795 // No NOW tiles. 2825 // No NOW tiles.
2796 time_ticks += base::TimeDelta::FromMilliseconds(200); 2826 time_ticks += base::TimeDelta::FromMilliseconds(200);
2797 host_impl_.SetCurrentBeginFrameArgs( 2827 host_impl_.SetCurrentBeginFrameArgs(
2798 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); 2828 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks));
2799 2829
2800 pending_layer_->draw_properties().visible_content_rect = 2830 pending_layer_->draw_properties().visible_content_rect =
2801 gfx::Rect(1100, 1100, 500, 500); 2831 gfx::Rect(1100, 1100, 500, 500);
2802 bool resourceless_software_draw = false; 2832 bool resourceless_software_draw = false;
2803 pending_layer_->UpdateTiles(Occlusion(), resourceless_software_draw); 2833 pending_layer_->UpdateTiles(Occlusion(), resourceless_software_draw);
2804 2834
2805 unique_tiles.clear(); 2835 unique_tiles.clear();
2806 high_res_tile_count = 0u; 2836 high_res_tile_count = 0u;
2807 queue = pending_layer_->CreateRasterQueue(false); 2837 queue.reset(new TilingSetRasterQueueAll(
2838 pending_layer_->picture_layer_tiling_set(), false));
2808 while (!queue->IsEmpty()) { 2839 while (!queue->IsEmpty()) {
2809 Tile* tile = queue->Top(); 2840 Tile* tile = queue->Top();
2810 TilePriority priority = tile->priority(PENDING_TREE); 2841 TilePriority priority = tile->priority(PENDING_TREE);
2811 2842
2812 EXPECT_TRUE(tile); 2843 EXPECT_TRUE(tile);
2813 2844
2814 // Non-high res tiles only get visible tiles. 2845 // Non-high res tiles only get visible tiles.
2815 EXPECT_EQ(HIGH_RESOLUTION, priority.resolution); 2846 EXPECT_EQ(HIGH_RESOLUTION, priority.resolution);
2816 EXPECT_NE(TilePriority::NOW, priority.priority_bin); 2847 EXPECT_NE(TilePriority::NOW, priority.priority_bin);
2817 2848
2818 high_res_tile_count += priority.resolution == HIGH_RESOLUTION; 2849 high_res_tile_count += priority.resolution == HIGH_RESOLUTION;
2819 2850
2820 unique_tiles.insert(tile); 2851 unique_tiles.insert(tile);
2821 queue->Pop(); 2852 queue->Pop();
2822 } 2853 }
2823 2854
2824 EXPECT_EQ(16u, high_res_tile_count); 2855 EXPECT_EQ(16, high_res_tile_count);
2825 EXPECT_EQ(high_res_tile_count, unique_tiles.size()); 2856 EXPECT_EQ(high_res_tile_count, static_cast<int>(unique_tiles.size()));
2826 2857
2827 time_ticks += base::TimeDelta::FromMilliseconds(200); 2858 time_ticks += base::TimeDelta::FromMilliseconds(200);
2828 host_impl_.SetCurrentBeginFrameArgs( 2859 host_impl_.SetCurrentBeginFrameArgs(
2829 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); 2860 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks));
2830 2861
2831 pending_layer_->draw_properties().visible_content_rect = 2862 pending_layer_->draw_properties().visible_content_rect =
2832 gfx::Rect(0, 0, 500, 500); 2863 gfx::Rect(0, 0, 500, 500);
2833 pending_layer_->UpdateTiles(Occlusion(), resourceless_software_draw); 2864 pending_layer_->UpdateTiles(Occlusion(), resourceless_software_draw);
2834 2865
2835 std::vector<Tile*> high_res_tiles = 2866 std::vector<Tile*> high_res_tiles =
2836 pending_layer_->HighResTiling()->AllTilesForTesting(); 2867 pending_layer_->HighResTiling()->AllTilesForTesting();
2837 for (std::vector<Tile*>::iterator tile_it = high_res_tiles.begin(); 2868 for (std::vector<Tile*>::iterator tile_it = high_res_tiles.begin();
2838 tile_it != high_res_tiles.end(); 2869 tile_it != high_res_tiles.end();
2839 ++tile_it) { 2870 ++tile_it) {
2840 Tile* tile = *tile_it; 2871 Tile* tile = *tile_it;
2841 TileDrawInfo& draw_info = tile->draw_info(); 2872 TileDrawInfo& draw_info = tile->draw_info();
2842 draw_info.SetSolidColorForTesting(SK_ColorRED); 2873 draw_info.SetSolidColorForTesting(SK_ColorRED);
2843 } 2874 }
2844 2875
2845 non_ideal_tile_count = 0; 2876 non_ideal_tile_count = 0;
2846 low_res_tile_count = 0; 2877 low_res_tile_count = 0;
2847 high_res_tile_count = 0; 2878 high_res_tile_count = 0;
2848 queue = pending_layer_->CreateRasterQueue(true); 2879 queue.reset(new TilingSetRasterQueueAll(
2880 pending_layer_->picture_layer_tiling_set(), true));
2849 while (!queue->IsEmpty()) { 2881 while (!queue->IsEmpty()) {
2850 Tile* tile = queue->Top(); 2882 Tile* tile = queue->Top();
2851 TilePriority priority = tile->priority(PENDING_TREE); 2883 TilePriority priority = tile->priority(PENDING_TREE);
2852 2884
2853 EXPECT_TRUE(tile); 2885 EXPECT_TRUE(tile);
2854 2886
2855 non_ideal_tile_count += priority.resolution == NON_IDEAL_RESOLUTION; 2887 non_ideal_tile_count += priority.resolution == NON_IDEAL_RESOLUTION;
2856 low_res_tile_count += priority.resolution == LOW_RESOLUTION; 2888 low_res_tile_count += priority.resolution == LOW_RESOLUTION;
2857 high_res_tile_count += priority.resolution == HIGH_RESOLUTION; 2889 high_res_tile_count += priority.resolution == HIGH_RESOLUTION;
2858 queue->Pop(); 2890 queue->Pop();
2859 } 2891 }
2860 2892
2861 EXPECT_EQ(0u, non_ideal_tile_count); 2893 EXPECT_EQ(0, non_ideal_tile_count);
2862 EXPECT_EQ(1u, low_res_tile_count); 2894 EXPECT_EQ(1, low_res_tile_count);
2863 EXPECT_EQ(0u, high_res_tile_count); 2895 EXPECT_EQ(0, high_res_tile_count);
2896 }
2897
2898 TEST_F(PictureLayerImplTest, TilingSetRasterQueueActiveTree) {
2899 base::TimeTicks time_ticks;
2900 time_ticks += base::TimeDelta::FromMilliseconds(1);
2901 host_impl_.SetCurrentBeginFrameArgs(
2902 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks));
2903
2904 host_impl_.SetViewportSize(gfx::Size(500, 500));
2905
2906 gfx::Size tile_size(100, 100);
2907 gfx::Size layer_bounds(1000, 1000);
2908
2909 scoped_refptr<FakePicturePileImpl> pending_pile =
2910 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
2911
2912 SetupPendingTree(pending_pile);
2913 ActivateTree();
2914 EXPECT_EQ(2u, active_layer_->num_tilings());
2915
2916 scoped_ptr<TilingSetRasterQueue> queue(new TilingSetRasterQueueRequired(
2917 active_layer_->picture_layer_tiling_set(),
2918 RasterTilePriorityQueue::Type::REQUIRED_FOR_DRAW));
2919 EXPECT_FALSE(queue->IsEmpty());
2920 while (!queue->IsEmpty()) {
2921 Tile* tile = queue->Top();
2922 EXPECT_TRUE(tile->required_for_draw());
2923 EXPECT_FALSE(tile->IsReadyToDraw());
2924 queue->Pop();
2925 }
2926
2927 queue.reset(new TilingSetRasterQueueRequired(
2928 active_layer_->picture_layer_tiling_set(),
2929 RasterTilePriorityQueue::Type::REQUIRED_FOR_ACTIVATION));
2930 EXPECT_TRUE(queue->IsEmpty());
2864 } 2931 }
2865 2932
2866 TEST_F(PictureLayerImplTest, TilingSetEvictionQueue) { 2933 TEST_F(PictureLayerImplTest, TilingSetEvictionQueue) {
2867 gfx::Size tile_size(100, 100); 2934 gfx::Size tile_size(100, 100);
2868 gfx::Size layer_bounds(1000, 1000); 2935 gfx::Size layer_bounds(1000, 1000);
2869 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor; 2936 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor;
2870 2937
2871 host_impl_.SetViewportSize(gfx::Size(500, 500)); 2938 host_impl_.SetViewportSize(gfx::Size(500, 500));
2872 2939
2873 scoped_refptr<FakePicturePileImpl> pending_pile = 2940 scoped_refptr<FakePicturePileImpl> pending_pile =
(...skipping 947 matching lines...) Expand 10 before | Expand all | Expand 10 after
3821 gfx::Point occluding_layer_position(310, 0); 3888 gfx::Point occluding_layer_position(310, 0);
3822 3889
3823 host_impl_.SetViewportSize(viewport_size); 3890 host_impl_.SetViewportSize(viewport_size);
3824 3891
3825 scoped_refptr<FakePicturePileImpl> pending_pile = 3892 scoped_refptr<FakePicturePileImpl> pending_pile =
3826 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 3893 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
3827 SetupPendingTreeWithFixedTileSize(pending_pile, tile_size, Region()); 3894 SetupPendingTreeWithFixedTileSize(pending_pile, tile_size, Region());
3828 3895
3829 // No occlusion. 3896 // No occlusion.
3830 int unoccluded_tile_count = 0; 3897 int unoccluded_tile_count = 0;
3831 scoped_ptr<TilingSetRasterQueue> queue = 3898 scoped_ptr<TilingSetRasterQueue> queue(new TilingSetRasterQueueAll(
3832 pending_layer_->CreateRasterQueue(false); 3899 pending_layer_->picture_layer_tiling_set(), false));
3833 while (!queue->IsEmpty()) { 3900 while (!queue->IsEmpty()) {
3834 Tile* tile = queue->Top(); 3901 Tile* tile = queue->Top();
3835 3902
3836 // Occluded tiles should not be iterated over. 3903 // Occluded tiles should not be iterated over.
3837 EXPECT_FALSE(tile->is_occluded(PENDING_TREE)); 3904 EXPECT_FALSE(tile->is_occluded(PENDING_TREE));
3838 3905
3839 // Some tiles may not be visible (i.e. outside the viewport). The rest are 3906 // Some tiles may not be visible (i.e. outside the viewport). The rest are
3840 // visible and at least partially unoccluded, verified by the above expect. 3907 // visible and at least partially unoccluded, verified by the above expect.
3841 bool tile_is_visible = 3908 bool tile_is_visible =
3842 tile->content_rect().Intersects(pending_layer_->visible_content_rect()); 3909 tile->content_rect().Intersects(pending_layer_->visible_content_rect());
(...skipping 11 matching lines...) Expand all
3854 layer1->SetDrawsContent(true); 3921 layer1->SetDrawsContent(true);
3855 layer1->SetContentsOpaque(true); 3922 layer1->SetContentsOpaque(true);
3856 layer1->SetPosition(occluding_layer_position); 3923 layer1->SetPosition(occluding_layer_position);
3857 3924
3858 time_ticks += base::TimeDelta::FromMilliseconds(200); 3925 time_ticks += base::TimeDelta::FromMilliseconds(200);
3859 host_impl_.SetCurrentBeginFrameArgs( 3926 host_impl_.SetCurrentBeginFrameArgs(
3860 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); 3927 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks));
3861 host_impl_.pending_tree()->UpdateDrawProperties(); 3928 host_impl_.pending_tree()->UpdateDrawProperties();
3862 3929
3863 unoccluded_tile_count = 0; 3930 unoccluded_tile_count = 0;
3864 queue = pending_layer_->CreateRasterQueue(false); 3931 queue.reset(new TilingSetRasterQueueAll(
3932 pending_layer_->picture_layer_tiling_set(), false));
3865 while (!queue->IsEmpty()) { 3933 while (!queue->IsEmpty()) {
3866 Tile* tile = queue->Top(); 3934 Tile* tile = queue->Top();
3867 3935
3868 EXPECT_FALSE(tile->is_occluded(PENDING_TREE)); 3936 EXPECT_FALSE(tile->is_occluded(PENDING_TREE));
3869 3937
3870 bool tile_is_visible = 3938 bool tile_is_visible =
3871 tile->content_rect().Intersects(pending_layer_->visible_content_rect()); 3939 tile->content_rect().Intersects(pending_layer_->visible_content_rect());
3872 if (tile_is_visible) 3940 if (tile_is_visible)
3873 unoccluded_tile_count++; 3941 unoccluded_tile_count++;
3874 queue->Pop(); 3942 queue->Pop();
3875 } 3943 }
3876 EXPECT_EQ(20, unoccluded_tile_count); 3944 EXPECT_EQ(20, unoccluded_tile_count);
3877 3945
3878 // Full occlusion. 3946 // Full occlusion.
3879 layer1->SetPosition(gfx::Point(0, 0)); 3947 layer1->SetPosition(gfx::Point(0, 0));
3880 3948
3881 time_ticks += base::TimeDelta::FromMilliseconds(200); 3949 time_ticks += base::TimeDelta::FromMilliseconds(200);
3882 host_impl_.SetCurrentBeginFrameArgs( 3950 host_impl_.SetCurrentBeginFrameArgs(
3883 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); 3951 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks));
3884 host_impl_.pending_tree()->UpdateDrawProperties(); 3952 host_impl_.pending_tree()->UpdateDrawProperties();
3885 3953
3886 unoccluded_tile_count = 0; 3954 unoccluded_tile_count = 0;
3887 queue = pending_layer_->CreateRasterQueue(false); 3955 queue.reset(new TilingSetRasterQueueAll(
3956 pending_layer_->picture_layer_tiling_set(), false));
3888 while (!queue->IsEmpty()) { 3957 while (!queue->IsEmpty()) {
3889 Tile* tile = queue->Top(); 3958 Tile* tile = queue->Top();
3890 3959
3891 EXPECT_FALSE(tile->is_occluded(PENDING_TREE)); 3960 EXPECT_FALSE(tile->is_occluded(PENDING_TREE));
3892 3961
3893 bool tile_is_visible = 3962 bool tile_is_visible =
3894 tile->content_rect().Intersects(pending_layer_->visible_content_rect()); 3963 tile->content_rect().Intersects(pending_layer_->visible_content_rect());
3895 if (tile_is_visible) 3964 if (tile_is_visible)
3896 unoccluded_tile_count++; 3965 unoccluded_tile_count++;
3897 queue->Pop(); 3966 queue->Pop();
(...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after
4732 result = layer->CalculateTileSize(gfx::Size(447, 400)); 4801 result = layer->CalculateTileSize(gfx::Size(447, 400));
4733 EXPECT_EQ(result.width(), 448); 4802 EXPECT_EQ(result.width(), 448);
4734 EXPECT_EQ(result.height(), 448); 4803 EXPECT_EQ(result.height(), 448);
4735 result = layer->CalculateTileSize(gfx::Size(500, 499)); 4804 result = layer->CalculateTileSize(gfx::Size(500, 499));
4736 EXPECT_EQ(result.width(), 512); 4805 EXPECT_EQ(result.width(), 512);
4737 EXPECT_EQ(result.height(), 500 + 2); 4806 EXPECT_EQ(result.height(), 500 + 2);
4738 } 4807 }
4739 4808
4740 } // namespace 4809 } // namespace
4741 } // namespace cc 4810 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/picture_layer_impl_perftest.cc ('k') | cc/resources/picture_layer_tiling.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698