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

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

Issue 833243008: Update from https://crrev.com/311145 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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.cc ('k') | cc/layers/picture_layer_impl_unittest.cc » ('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 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/test/fake_impl_proxy.h" 9 #include "cc/test/fake_impl_proxy.h"
9 #include "cc/test/fake_layer_tree_host_impl.h" 10 #include "cc/test/fake_layer_tree_host_impl.h"
10 #include "cc/test/fake_output_surface.h" 11 #include "cc/test/fake_output_surface.h"
11 #include "cc/test/fake_picture_layer_impl.h" 12 #include "cc/test/fake_picture_layer_impl.h"
12 #include "cc/test/fake_picture_pile_impl.h" 13 #include "cc/test/fake_picture_pile_impl.h"
13 #include "cc/test/impl_side_painting_settings.h" 14 #include "cc/test/impl_side_painting_settings.h"
14 #include "cc/test/test_shared_bitmap_manager.h" 15 #include "cc/test/test_shared_bitmap_manager.h"
15 #include "cc/trees/layer_tree_impl.h" 16 #include "cc/trees/layer_tree_impl.h"
16 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
17 #include "testing/perf/perf_test.h" 18 #include "testing/perf/perf_test.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 70
70 void RunRasterQueueConstructAndIterateTest(const std::string& test_name, 71 void RunRasterQueueConstructAndIterateTest(const std::string& test_name,
71 int num_tiles, 72 int num_tiles,
72 const gfx::Size& viewport_size) { 73 const gfx::Size& viewport_size) {
73 host_impl_.SetViewportSize(viewport_size); 74 host_impl_.SetViewportSize(viewport_size);
74 host_impl_.pending_tree()->UpdateDrawProperties(); 75 host_impl_.pending_tree()->UpdateDrawProperties();
75 76
76 timer_.Reset(); 77 timer_.Reset();
77 do { 78 do {
78 int count = num_tiles; 79 int count = num_tiles;
79 scoped_ptr<TilingSetRasterQueue> queue = 80 scoped_ptr<TilingSetRasterQueue> queue(new TilingSetRasterQueueAll(
80 pending_layer_->CreateRasterQueue(false); 81 pending_layer_->picture_layer_tiling_set(), false));
81 while (count--) { 82 while (count--) {
82 ASSERT_TRUE(!queue->IsEmpty()) << "count: " << count; 83 ASSERT_TRUE(!queue->IsEmpty()) << "count: " << count;
83 ASSERT_TRUE(queue->Top() != nullptr) << "count: " << count; 84 ASSERT_TRUE(queue->Top() != nullptr) << "count: " << count;
84 queue->Pop(); 85 queue->Pop();
85 } 86 }
86 timer_.NextLap(); 87 timer_.NextLap();
87 } while (!timer_.HasTimeLimitExpired()); 88 } while (!timer_.HasTimeLimitExpired());
88 89
89 perf_test::PrintResult("tiling_set_raster_queue_construct_and_iterate", "", 90 perf_test::PrintResult("tiling_set_raster_queue_construct_and_iterate", "",
90 test_name, timer_.LapsPerSecond(), "runs/s", true); 91 test_name, timer_.LapsPerSecond(), "runs/s", true);
91 } 92 }
92 93
93 void RunRasterQueueConstructTest(const std::string& test_name, 94 void RunRasterQueueConstructTest(const std::string& test_name,
94 const gfx::Rect& viewport) { 95 const gfx::Rect& viewport) {
95 host_impl_.SetViewportSize(viewport.size()); 96 host_impl_.SetViewportSize(viewport.size());
96 pending_layer_->SetScrollOffset( 97 pending_layer_->SetScrollOffset(
97 gfx::ScrollOffset(viewport.x(), viewport.y())); 98 gfx::ScrollOffset(viewport.x(), viewport.y()));
98 host_impl_.pending_tree()->UpdateDrawProperties(); 99 host_impl_.pending_tree()->UpdateDrawProperties();
99 100
100 timer_.Reset(); 101 timer_.Reset();
101 do { 102 do {
102 scoped_ptr<TilingSetRasterQueue> queue = 103 scoped_ptr<TilingSetRasterQueue> queue(new TilingSetRasterQueueAll(
103 pending_layer_->CreateRasterQueue(false); 104 pending_layer_->picture_layer_tiling_set(), false));
104 timer_.NextLap(); 105 timer_.NextLap();
105 } while (!timer_.HasTimeLimitExpired()); 106 } while (!timer_.HasTimeLimitExpired());
106 107
107 perf_test::PrintResult("tiling_set_raster_queue_construct", "", test_name, 108 perf_test::PrintResult("tiling_set_raster_queue_construct", "", test_name,
108 timer_.LapsPerSecond(), "runs/s", true); 109 timer_.LapsPerSecond(), "runs/s", true);
109 } 110 }
110 111
111 void RunEvictionQueueConstructAndIterateTest( 112 void RunEvictionQueueConstructAndIterateTest(
112 const std::string& test_name, 113 const std::string& test_name,
113 int num_tiles, 114 int num_tiles,
114 const gfx::Size& viewport_size) { 115 const gfx::Size& viewport_size) {
115 host_impl_.SetViewportSize(viewport_size); 116 host_impl_.SetViewportSize(viewport_size);
116 host_impl_.pending_tree()->UpdateDrawProperties(); 117 host_impl_.pending_tree()->UpdateDrawProperties();
117 118
118 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, 119 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES,
119 SMOOTHNESS_TAKES_PRIORITY, 120 SMOOTHNESS_TAKES_PRIORITY,
120 NEW_CONTENT_TAKES_PRIORITY}; 121 NEW_CONTENT_TAKES_PRIORITY};
121 int priority_count = 0; 122 int priority_count = 0;
122 timer_.Reset(); 123 timer_.Reset();
123 do { 124 do {
124 int count = num_tiles; 125 int count = num_tiles;
125 scoped_ptr<TilingSetEvictionQueue> queue = 126 scoped_ptr<TilingSetEvictionQueue> queue(
126 pending_layer_->CreateEvictionQueue(priorities[priority_count]); 127 new TilingSetEvictionQueue(pending_layer_->picture_layer_tiling_set(),
128 priorities[priority_count], false));
127 while (count--) { 129 while (count--) {
128 ASSERT_TRUE(!queue->IsEmpty()) << "count: " << count; 130 ASSERT_TRUE(!queue->IsEmpty()) << "count: " << count;
129 ASSERT_TRUE(queue->Top() != nullptr) << "count: " << count; 131 ASSERT_TRUE(queue->Top() != nullptr) << "count: " << count;
130 queue->Pop(); 132 queue->Pop();
131 } 133 }
132 priority_count = (priority_count + 1) % arraysize(priorities); 134 priority_count = (priority_count + 1) % arraysize(priorities);
133 timer_.NextLap(); 135 timer_.NextLap();
134 } while (!timer_.HasTimeLimitExpired()); 136 } while (!timer_.HasTimeLimitExpired());
135 137
136 perf_test::PrintResult("tiling_set_eviction_queue_construct_and_iterate", 138 perf_test::PrintResult("tiling_set_eviction_queue_construct_and_iterate",
137 "", test_name, timer_.LapsPerSecond(), "runs/s", 139 "", test_name, timer_.LapsPerSecond(), "runs/s",
138 true); 140 true);
139 } 141 }
140 142
141 void RunEvictionQueueConstructTest(const std::string& test_name, 143 void RunEvictionQueueConstructTest(const std::string& test_name,
142 const gfx::Rect& viewport) { 144 const gfx::Rect& viewport) {
143 host_impl_.SetViewportSize(viewport.size()); 145 host_impl_.SetViewportSize(viewport.size());
144 pending_layer_->SetScrollOffset( 146 pending_layer_->SetScrollOffset(
145 gfx::ScrollOffset(viewport.x(), viewport.y())); 147 gfx::ScrollOffset(viewport.x(), viewport.y()));
146 host_impl_.pending_tree()->UpdateDrawProperties(); 148 host_impl_.pending_tree()->UpdateDrawProperties();
147 149
148 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, 150 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES,
149 SMOOTHNESS_TAKES_PRIORITY, 151 SMOOTHNESS_TAKES_PRIORITY,
150 NEW_CONTENT_TAKES_PRIORITY}; 152 NEW_CONTENT_TAKES_PRIORITY};
151 int priority_count = 0; 153 int priority_count = 0;
152 timer_.Reset(); 154 timer_.Reset();
153 do { 155 do {
154 scoped_ptr<TilingSetEvictionQueue> queue = 156 scoped_ptr<TilingSetEvictionQueue> queue(
155 pending_layer_->CreateEvictionQueue(priorities[priority_count]); 157 new TilingSetEvictionQueue(pending_layer_->picture_layer_tiling_set(),
158 priorities[priority_count], false));
156 priority_count = (priority_count + 1) % arraysize(priorities); 159 priority_count = (priority_count + 1) % arraysize(priorities);
157 timer_.NextLap(); 160 timer_.NextLap();
158 } while (!timer_.HasTimeLimitExpired()); 161 } while (!timer_.HasTimeLimitExpired());
159 162
160 perf_test::PrintResult("tiling_set_eviction_queue_construct", "", test_name, 163 perf_test::PrintResult("tiling_set_eviction_queue_construct", "", test_name,
161 timer_.LapsPerSecond(), "runs/s", true); 164 timer_.LapsPerSecond(), "runs/s", true);
162 } 165 }
163 166
164 protected: 167 protected:
165 TestSharedBitmapManager shared_bitmap_manager_; 168 TestSharedBitmapManager shared_bitmap_manager_;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 ASSERT_TRUE(host_impl_.tile_manager() != nullptr); 248 ASSERT_TRUE(host_impl_.tile_manager() != nullptr);
246 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(all_tiles); 249 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(all_tiles);
247 250
248 RunEvictionQueueConstructTest("0_0_100x100", gfx::Rect(0, 0, 100, 100)); 251 RunEvictionQueueConstructTest("0_0_100x100", gfx::Rect(0, 0, 100, 100));
249 RunEvictionQueueConstructTest("5000_0_100x100", gfx::Rect(5000, 0, 100, 100)); 252 RunEvictionQueueConstructTest("5000_0_100x100", gfx::Rect(5000, 0, 100, 100));
250 RunEvictionQueueConstructTest("9999_0_100x100", gfx::Rect(9999, 0, 100, 100)); 253 RunEvictionQueueConstructTest("9999_0_100x100", gfx::Rect(9999, 0, 100, 100));
251 } 254 }
252 255
253 } // namespace 256 } // namespace
254 } // namespace cc 257 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/picture_layer_impl.cc ('k') | cc/layers/picture_layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698