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

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

Issue 1013273003: cc: Force an update on tile size after viewport resize (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: attempt 3? Created 5 years, 9 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "cc/debug/lap_timer.h" 7 #include "cc/debug/lap_timer.h"
8 #include "cc/resources/tiling_set_raster_queue_all.h" 8 #include "cc/resources/tiling_set_raster_queue_all.h"
9 #include "cc/test/fake_impl_proxy.h" 9 #include "cc/test/fake_impl_proxy.h"
10 #include "cc/test/fake_layer_tree_host_impl.h" 10 #include "cc/test/fake_layer_tree_host_impl.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 pending_tree->SetRootLayer(pending_layer.Pass()); 65 pending_tree->SetRootLayer(pending_layer.Pass());
66 66
67 pending_layer_ = static_cast<FakePictureLayerImpl*>( 67 pending_layer_ = static_cast<FakePictureLayerImpl*>(
68 host_impl_.pending_tree()->LayerById(7)); 68 host_impl_.pending_tree()->LayerById(7));
69 } 69 }
70 70
71 void RunRasterQueueConstructAndIterateTest(const std::string& test_name, 71 void RunRasterQueueConstructAndIterateTest(const std::string& test_name,
72 int num_tiles, 72 int num_tiles,
73 const gfx::Size& viewport_size) { 73 const gfx::Size& viewport_size) {
74 host_impl_.SetViewportSize(viewport_size); 74 host_impl_.SetViewportSize(viewport_size);
75 bool update_lcd_text = false; 75 bool first_update_after_commit = false;
76 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); 76 host_impl_.pending_tree()->UpdateDrawProperties(first_update_after_commit);
77 77
78 timer_.Reset(); 78 timer_.Reset();
79 do { 79 do {
80 int count = num_tiles; 80 int count = num_tiles;
81 scoped_ptr<TilingSetRasterQueueAll> queue(new TilingSetRasterQueueAll( 81 scoped_ptr<TilingSetRasterQueueAll> queue(new TilingSetRasterQueueAll(
82 pending_layer_->picture_layer_tiling_set(), false)); 82 pending_layer_->picture_layer_tiling_set(), false));
83 while (count--) { 83 while (count--) {
84 ASSERT_TRUE(!queue->IsEmpty()) << "count: " << count; 84 ASSERT_TRUE(!queue->IsEmpty()) << "count: " << count;
85 ASSERT_TRUE(queue->Top() != nullptr) << "count: " << count; 85 ASSERT_TRUE(queue->Top() != nullptr) << "count: " << count;
86 queue->Pop(); 86 queue->Pop();
87 } 87 }
88 timer_.NextLap(); 88 timer_.NextLap();
89 } while (!timer_.HasTimeLimitExpired()); 89 } while (!timer_.HasTimeLimitExpired());
90 90
91 perf_test::PrintResult("tiling_set_raster_queue_construct_and_iterate", "", 91 perf_test::PrintResult("tiling_set_raster_queue_construct_and_iterate", "",
92 test_name, timer_.LapsPerSecond(), "runs/s", true); 92 test_name, timer_.LapsPerSecond(), "runs/s", true);
93 } 93 }
94 94
95 void RunRasterQueueConstructTest(const std::string& test_name, 95 void RunRasterQueueConstructTest(const std::string& test_name,
96 const gfx::Rect& viewport) { 96 const gfx::Rect& viewport) {
97 host_impl_.SetViewportSize(viewport.size()); 97 host_impl_.SetViewportSize(viewport.size());
98 pending_layer_->PushScrollOffsetFromMainThread( 98 pending_layer_->PushScrollOffsetFromMainThread(
99 gfx::ScrollOffset(viewport.x(), viewport.y())); 99 gfx::ScrollOffset(viewport.x(), viewport.y()));
100 bool update_lcd_text = false; 100 bool first_update_after_commit = false;
101 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); 101 host_impl_.pending_tree()->UpdateDrawProperties(first_update_after_commit);
102 102
103 timer_.Reset(); 103 timer_.Reset();
104 do { 104 do {
105 scoped_ptr<TilingSetRasterQueueAll> queue(new TilingSetRasterQueueAll( 105 scoped_ptr<TilingSetRasterQueueAll> queue(new TilingSetRasterQueueAll(
106 pending_layer_->picture_layer_tiling_set(), false)); 106 pending_layer_->picture_layer_tiling_set(), false));
107 timer_.NextLap(); 107 timer_.NextLap();
108 } while (!timer_.HasTimeLimitExpired()); 108 } while (!timer_.HasTimeLimitExpired());
109 109
110 perf_test::PrintResult("tiling_set_raster_queue_construct", "", test_name, 110 perf_test::PrintResult("tiling_set_raster_queue_construct", "", test_name,
111 timer_.LapsPerSecond(), "runs/s", true); 111 timer_.LapsPerSecond(), "runs/s", true);
112 } 112 }
113 113
114 void RunEvictionQueueConstructAndIterateTest( 114 void RunEvictionQueueConstructAndIterateTest(
115 const std::string& test_name, 115 const std::string& test_name,
116 int num_tiles, 116 int num_tiles,
117 const gfx::Size& viewport_size) { 117 const gfx::Size& viewport_size) {
118 host_impl_.SetViewportSize(viewport_size); 118 host_impl_.SetViewportSize(viewport_size);
119 bool update_lcd_text = false; 119 bool first_update_after_commit = false;
120 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); 120 host_impl_.pending_tree()->UpdateDrawProperties(first_update_after_commit);
121 121
122 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, 122 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES,
123 SMOOTHNESS_TAKES_PRIORITY, 123 SMOOTHNESS_TAKES_PRIORITY,
124 NEW_CONTENT_TAKES_PRIORITY}; 124 NEW_CONTENT_TAKES_PRIORITY};
125 int priority_count = 0; 125 int priority_count = 0;
126 timer_.Reset(); 126 timer_.Reset();
127 do { 127 do {
128 int count = num_tiles; 128 int count = num_tiles;
129 scoped_ptr<TilingSetEvictionQueue> queue( 129 scoped_ptr<TilingSetEvictionQueue> queue(
130 new TilingSetEvictionQueue(pending_layer_->picture_layer_tiling_set(), 130 new TilingSetEvictionQueue(pending_layer_->picture_layer_tiling_set(),
(...skipping 10 matching lines...) Expand all
141 perf_test::PrintResult("tiling_set_eviction_queue_construct_and_iterate", 141 perf_test::PrintResult("tiling_set_eviction_queue_construct_and_iterate",
142 "", test_name, timer_.LapsPerSecond(), "runs/s", 142 "", test_name, timer_.LapsPerSecond(), "runs/s",
143 true); 143 true);
144 } 144 }
145 145
146 void RunEvictionQueueConstructTest(const std::string& test_name, 146 void RunEvictionQueueConstructTest(const std::string& test_name,
147 const gfx::Rect& viewport) { 147 const gfx::Rect& viewport) {
148 host_impl_.SetViewportSize(viewport.size()); 148 host_impl_.SetViewportSize(viewport.size());
149 pending_layer_->PushScrollOffsetFromMainThread( 149 pending_layer_->PushScrollOffsetFromMainThread(
150 gfx::ScrollOffset(viewport.x(), viewport.y())); 150 gfx::ScrollOffset(viewport.x(), viewport.y()));
151 bool update_lcd_text = false; 151 bool first_update_after_commit = false;
152 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); 152 host_impl_.pending_tree()->UpdateDrawProperties(first_update_after_commit);
153 153
154 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, 154 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES,
155 SMOOTHNESS_TAKES_PRIORITY, 155 SMOOTHNESS_TAKES_PRIORITY,
156 NEW_CONTENT_TAKES_PRIORITY}; 156 NEW_CONTENT_TAKES_PRIORITY};
157 int priority_count = 0; 157 int priority_count = 0;
158 timer_.Reset(); 158 timer_.Reset();
159 do { 159 do {
160 scoped_ptr<TilingSetEvictionQueue> queue( 160 scoped_ptr<TilingSetEvictionQueue> queue(
161 new TilingSetEvictionQueue(pending_layer_->picture_layer_tiling_set(), 161 new TilingSetEvictionQueue(pending_layer_->picture_layer_tiling_set(),
162 priorities[priority_count], false)); 162 priorities[priority_count], false));
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 ASSERT_TRUE(host_impl_.tile_manager() != nullptr); 252 ASSERT_TRUE(host_impl_.tile_manager() != nullptr);
253 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(all_tiles); 253 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(all_tiles);
254 254
255 RunEvictionQueueConstructTest("0_0_100x100", gfx::Rect(0, 0, 100, 100)); 255 RunEvictionQueueConstructTest("0_0_100x100", gfx::Rect(0, 0, 100, 100));
256 RunEvictionQueueConstructTest("5000_0_100x100", gfx::Rect(5000, 0, 100, 100)); 256 RunEvictionQueueConstructTest("5000_0_100x100", gfx::Rect(5000, 0, 100, 100));
257 RunEvictionQueueConstructTest("9999_0_100x100", gfx::Rect(9999, 0, 100, 100)); 257 RunEvictionQueueConstructTest("9999_0_100x100", gfx::Rect(9999, 0, 100, 100));
258 } 258 }
259 259
260 } // namespace 260 } // namespace
261 } // namespace cc 261 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698