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

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

Issue 1028333002: Chromium -> Mojo roll. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: 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
« 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/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"
11 #include "cc/test/fake_output_surface.h" 11 #include "cc/test/fake_output_surface.h"
12 #include "cc/test/fake_picture_layer_impl.h" 12 #include "cc/test/fake_picture_layer_impl.h"
13 #include "cc/test/fake_picture_pile_impl.h" 13 #include "cc/test/fake_picture_pile_impl.h"
14 #include "cc/test/impl_side_painting_settings.h" 14 #include "cc/test/impl_side_painting_settings.h"
15 #include "cc/test/test_shared_bitmap_manager.h" 15 #include "cc/test/test_shared_bitmap_manager.h"
16 #include "cc/test/test_task_graph_runner.h"
16 #include "cc/trees/layer_tree_impl.h" 17 #include "cc/trees/layer_tree_impl.h"
17 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
18 #include "testing/perf/perf_test.h" 19 #include "testing/perf/perf_test.h"
19 20
20 namespace cc { 21 namespace cc {
21 namespace { 22 namespace {
22 23
23 static const int kTimeLimitMillis = 2000; 24 static const int kTimeLimitMillis = 2000;
24 static const int kWarmupRuns = 5; 25 static const int kWarmupRuns = 5;
25 static const int kTimeCheckInterval = 10; 26 static const int kTimeCheckInterval = 10;
26 27
27 void AddTiling(float scale, 28 void AddTiling(float scale,
28 FakePictureLayerImpl* layer, 29 FakePictureLayerImpl* layer,
29 std::vector<Tile*>* all_tiles) { 30 std::vector<Tile*>* all_tiles) {
30 PictureLayerTiling* tiling = layer->AddTiling(scale); 31 PictureLayerTiling* tiling = layer->AddTiling(scale);
31 32
32 tiling->CreateAllTilesForTesting(); 33 tiling->CreateAllTilesForTesting();
33 std::vector<Tile*> tiling_tiles = tiling->AllTilesForTesting(); 34 std::vector<Tile*> tiling_tiles = tiling->AllTilesForTesting();
34 std::copy( 35 std::copy(
35 tiling_tiles.begin(), tiling_tiles.end(), std::back_inserter(*all_tiles)); 36 tiling_tiles.begin(), tiling_tiles.end(), std::back_inserter(*all_tiles));
36 } 37 }
37 38
38 class PictureLayerImplPerfTest : public testing::Test { 39 class PictureLayerImplPerfTest : public testing::Test {
39 public: 40 public:
40 PictureLayerImplPerfTest() 41 PictureLayerImplPerfTest()
41 : proxy_(base::MessageLoopProxy::current()), 42 : proxy_(base::MessageLoopProxy::current()),
42 host_impl_(ImplSidePaintingSettings(), 43 host_impl_(ImplSidePaintingSettings(),
43 &proxy_, 44 &proxy_,
44 &shared_bitmap_manager_), 45 &shared_bitmap_manager_,
46 &task_graph_runner_),
45 timer_(kWarmupRuns, 47 timer_(kWarmupRuns,
46 base::TimeDelta::FromMilliseconds(kTimeLimitMillis), 48 base::TimeDelta::FromMilliseconds(kTimeLimitMillis),
47 kTimeCheckInterval) {} 49 kTimeCheckInterval) {}
48 50
49 void SetUp() override { 51 void SetUp() override {
50 host_impl_.InitializeRenderer(FakeOutputSurface::Create3d()); 52 host_impl_.InitializeRenderer(FakeOutputSurface::Create3d());
51 } 53 }
52 54
53 void SetupPendingTree(const gfx::Size& layer_bounds, 55 void SetupPendingTree(const gfx::Size& layer_bounds,
54 const gfx::Size& tile_size) { 56 const gfx::Size& tile_size) {
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 priority_count = (priority_count + 1) % arraysize(priorities); 165 priority_count = (priority_count + 1) % arraysize(priorities);
164 timer_.NextLap(); 166 timer_.NextLap();
165 } while (!timer_.HasTimeLimitExpired()); 167 } while (!timer_.HasTimeLimitExpired());
166 168
167 perf_test::PrintResult("tiling_set_eviction_queue_construct", "", test_name, 169 perf_test::PrintResult("tiling_set_eviction_queue_construct", "", test_name,
168 timer_.LapsPerSecond(), "runs/s", true); 170 timer_.LapsPerSecond(), "runs/s", true);
169 } 171 }
170 172
171 protected: 173 protected:
172 TestSharedBitmapManager shared_bitmap_manager_; 174 TestSharedBitmapManager shared_bitmap_manager_;
175 TestTaskGraphRunner task_graph_runner_;
173 FakeImplProxy proxy_; 176 FakeImplProxy proxy_;
174 FakeLayerTreeHostImpl host_impl_; 177 FakeLayerTreeHostImpl host_impl_;
175 FakePictureLayerImpl* pending_layer_; 178 FakePictureLayerImpl* pending_layer_;
176 LapTimer timer_; 179 LapTimer timer_;
177 180
178 private: 181 private:
179 DISALLOW_COPY_AND_ASSIGN(PictureLayerImplPerfTest); 182 DISALLOW_COPY_AND_ASSIGN(PictureLayerImplPerfTest);
180 }; 183 };
181 184
182 TEST_F(PictureLayerImplPerfTest, TilingSetRasterQueueConstructAndIterate) { 185 TEST_F(PictureLayerImplPerfTest, TilingSetRasterQueueConstructAndIterate) {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 ASSERT_TRUE(host_impl_.tile_manager() != nullptr); 255 ASSERT_TRUE(host_impl_.tile_manager() != nullptr);
253 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(all_tiles); 256 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(all_tiles);
254 257
255 RunEvictionQueueConstructTest("0_0_100x100", gfx::Rect(0, 0, 100, 100)); 258 RunEvictionQueueConstructTest("0_0_100x100", gfx::Rect(0, 0, 100, 100));
256 RunEvictionQueueConstructTest("5000_0_100x100", gfx::Rect(5000, 0, 100, 100)); 259 RunEvictionQueueConstructTest("5000_0_100x100", gfx::Rect(5000, 0, 100, 100));
257 RunEvictionQueueConstructTest("9999_0_100x100", gfx::Rect(9999, 0, 100, 100)); 260 RunEvictionQueueConstructTest("9999_0_100x100", gfx::Rect(9999, 0, 100, 100));
258 } 261 }
259 262
260 } // namespace 263 } // namespace
261 } // namespace cc 264 } // 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