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

Side by Side Diff: cc/resources/picture_layer_tiling_perftest.cc

Issue 62283012: cc: Added tile bundles (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years 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 | Annotate | Revision Log
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/resources/picture_layer_tiling.h" 5 #include "cc/resources/picture_layer_tiling.h"
6 #include "cc/test/fake_picture_layer_tiling_client.h" 6 #include "cc/test/fake_picture_layer_tiling_client.h"
7 #include "cc/test/fake_tile_manager.h"
8 #include "cc/test/fake_tile_manager_client.h"
7 9
8 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
9 #include "testing/perf/perf_test.h" 11 #include "testing/perf/perf_test.h"
10 12
11 namespace cc { 13 namespace cc {
12 14
13 namespace { 15 namespace {
14 16
15 static const int kTimeLimitMillis = 2000; 17 static const int kTimeLimitMillis = 2000;
16 static const int kWarmupRuns = 5; 18 static const int kWarmupRuns = 5;
17 static const int kTimeCheckInterval = 10; 19 static const int kTimeCheckInterval = 10;
18 20
19 class PictureLayerTilingPerfTest : public testing::Test { 21 class PictureLayerTilingPerfTest : public testing::Test {
20 public: 22 public:
21 PictureLayerTilingPerfTest() : num_runs_(0) {} 23 PictureLayerTilingPerfTest() : num_runs_(0) {
24 tile_manager_ = make_scoped_ptr(new FakeTileManager(&tile_manager_client_));
25 picture_layer_tiling_client_ =
26 make_scoped_ptr(new FakePictureLayerTilingClient(tile_manager_.get()));
27 }
22 28
23 virtual void SetUp() OVERRIDE { 29 virtual void SetUp() OVERRIDE {
24 picture_layer_tiling_client_.SetTileSize(gfx::Size(256, 256)); 30 picture_layer_tiling_client_->SetTileSize(gfx::Size(256, 256));
25 picture_layer_tiling_ = PictureLayerTiling::Create( 31 picture_layer_tiling_ = PictureLayerTiling::Create(
26 1, gfx::Size(256 * 50, 256 * 50), &picture_layer_tiling_client_); 32 1, gfx::Size(256 * 50, 256 * 50), picture_layer_tiling_client_.get());
27 picture_layer_tiling_->CreateAllTilesForTesting(); 33 picture_layer_tiling_->CreateTilesForTesting(PENDING_TREE);
28 } 34 }
29 35
30 virtual void TearDown() OVERRIDE { 36 virtual void TearDown() OVERRIDE {
31 picture_layer_tiling_.reset(NULL); 37 picture_layer_tiling_.reset(NULL);
32 } 38 }
33 39
34 void EndTest() { 40 void EndTest() {
35 elapsed_ = base::TimeTicks::HighResNow() - start_time_; 41 elapsed_ = base::TimeTicks::HighResNow() - start_time_;
36 } 42 }
37 43
(...skipping 25 matching lines...) Expand all
63 69
64 void RunUpdateTilePrioritiesStationaryTest( 70 void RunUpdateTilePrioritiesStationaryTest(
65 const std::string& test_name, 71 const std::string& test_name,
66 const gfx::Transform& transform) { 72 const gfx::Transform& transform) {
67 start_time_ = base::TimeTicks(); 73 start_time_ = base::TimeTicks();
68 num_runs_ = 0; 74 num_runs_ = 0;
69 75
70 gfx::Size layer_bounds(50 * 256, 50 * 256); 76 gfx::Size layer_bounds(50 * 256, 50 * 256);
71 do { 77 do {
72 picture_layer_tiling_->UpdateTilePriorities( 78 picture_layer_tiling_->UpdateTilePriorities(
73 ACTIVE_TREE, 79 PENDING_TREE,
74 layer_bounds, 80 layer_bounds,
75 gfx::Rect(layer_bounds), 81 gfx::Rect(layer_bounds),
76 gfx::Rect(layer_bounds), 82 gfx::Rect(layer_bounds),
77 layer_bounds, 83 layer_bounds,
78 layer_bounds, 84 layer_bounds,
79 1.f, 85 1.f,
80 1.f, 86 1.f,
81 transform, 87 transform,
82 transform, 88 transform,
83 num_runs_ + 1, 89 num_runs_ + 1,
(...skipping 13 matching lines...) Expand all
97 gfx::Size layer_bounds(50 * 256, 50 * 256); 103 gfx::Size layer_bounds(50 * 256, 50 * 256);
98 gfx::Size viewport_size(1024, 768); 104 gfx::Size viewport_size(1024, 768);
99 gfx::Rect viewport_rect(viewport_size); 105 gfx::Rect viewport_rect(viewport_size);
100 int xoffsets[] = {10, 0, -10, 0}; 106 int xoffsets[] = {10, 0, -10, 0};
101 int yoffsets[] = {0, 10, 0, -10}; 107 int yoffsets[] = {0, 10, 0, -10};
102 int offsetIndex = 0; 108 int offsetIndex = 0;
103 int offsetCount = 0; 109 int offsetCount = 0;
104 const int maxOffsetCount = 1000; 110 const int maxOffsetCount = 1000;
105 do { 111 do {
106 picture_layer_tiling_->UpdateTilePriorities( 112 picture_layer_tiling_->UpdateTilePriorities(
107 ACTIVE_TREE, 113 PENDING_TREE,
108 viewport_size, 114 viewport_size,
109 viewport_rect, 115 viewport_rect,
110 gfx::Rect(layer_bounds), 116 gfx::Rect(layer_bounds),
111 layer_bounds, 117 layer_bounds,
112 layer_bounds, 118 layer_bounds,
113 1.f, 119 1.f,
114 1.f, 120 1.f,
115 transform, 121 transform,
116 transform, 122 transform,
117 num_runs_ + 1, 123 num_runs_ + 1,
118 250); 124 250);
119 125
120 viewport_rect = gfx::Rect( 126 viewport_rect = gfx::Rect(
121 viewport_rect.x() + xoffsets[offsetIndex], 127 viewport_rect.x() + xoffsets[offsetIndex],
122 viewport_rect.y() + yoffsets[offsetIndex], 128 viewport_rect.y() + yoffsets[offsetIndex],
123 viewport_rect.width(), 129 viewport_rect.width(),
124 viewport_rect.height()); 130 viewport_rect.height());
125 131
126 if (++offsetCount > maxOffsetCount) { 132 if (++offsetCount > maxOffsetCount) {
127 offsetCount = 0; 133 offsetCount = 0;
128 offsetIndex = (offsetIndex + 1) % 4; 134 offsetIndex = (offsetIndex + 1) % 4;
129 } 135 }
130 } while (DidRun()); 136 } while (DidRun());
131 137
132 perf_test::PrintResult("update_tile_priorities_scrolling", "", test_name, 138 perf_test::PrintResult("update_tile_priorities_scrolling", "", test_name,
133 num_runs_ / elapsed_.InSecondsF(), "runs/s", true); 139 num_runs_ / elapsed_.InSecondsF(), "runs/s", true);
134 } 140 }
135 141
136 private: 142 private:
137 FakePictureLayerTilingClient picture_layer_tiling_client_; 143 FakeTileManagerClient tile_manager_client_;
144 scoped_ptr<FakeTileManager> tile_manager_;
145 scoped_ptr<FakePictureLayerTilingClient> picture_layer_tiling_client_;
138 scoped_ptr<PictureLayerTiling> picture_layer_tiling_; 146 scoped_ptr<PictureLayerTiling> picture_layer_tiling_;
139 147
140 base::TimeTicks start_time_; 148 base::TimeTicks start_time_;
141 base::TimeDelta elapsed_; 149 base::TimeDelta elapsed_;
142 int num_runs_; 150 int num_runs_;
143 }; 151 };
144 152
145 TEST_F(PictureLayerTilingPerfTest, Invalidate) { 153 TEST_F(PictureLayerTilingPerfTest, Invalidate) {
146 Region one_tile(gfx::Rect(256, 256)); 154 Region one_tile(gfx::Rect(256, 256));
147 RunInvalidateTest("1x1", one_tile); 155 RunInvalidateTest("1x1", one_tile);
(...skipping 20 matching lines...) Expand all
168 RunUpdateTilePrioritiesScrollingTest("rotation", transform); 176 RunUpdateTilePrioritiesScrollingTest("rotation", transform);
169 177
170 transform.ApplyPerspectiveDepth(10); 178 transform.ApplyPerspectiveDepth(10);
171 RunUpdateTilePrioritiesStationaryTest("perspective", transform); 179 RunUpdateTilePrioritiesStationaryTest("perspective", transform);
172 RunUpdateTilePrioritiesScrollingTest("perspective", transform); 180 RunUpdateTilePrioritiesScrollingTest("perspective", transform);
173 } 181 }
174 182
175 } // namespace 183 } // namespace
176 184
177 } // namespace cc 185 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698