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

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

Issue 666273002: cc: Added raster source. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update Created 6 years, 1 month 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/resources/picture_pile_impl.h" 5 #include "cc/resources/picture_pile_impl.h"
6 6
7 #include "cc/debug/lap_timer.h" 7 #include "cc/debug/lap_timer.h"
8 #include "cc/test/fake_picture_pile_impl.h" 8 #include "cc/test/fake_picture_pile_impl.h"
9 #include "cc/test/fake_rendering_stats_instrumentation.h" 9 #include "cc/test/fake_rendering_stats_instrumentation.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 15 matching lines...) Expand all
26 : timer_(kWarmupRuns, 26 : timer_(kWarmupRuns,
27 base::TimeDelta::FromMilliseconds(kTimeLimitMillis), 27 base::TimeDelta::FromMilliseconds(kTimeLimitMillis),
28 kTimeCheckInterval) {} 28 kTimeCheckInterval) {}
29 29
30 void RunAnalyzeTest(const std::string& test_name, float contents_scale) { 30 void RunAnalyzeTest(const std::string& test_name, float contents_scale) {
31 scoped_refptr<PicturePileImpl> pile = FakePicturePileImpl::CreateFilledPile( 31 scoped_refptr<PicturePileImpl> pile = FakePicturePileImpl::CreateFilledPile(
32 gfx::Size(kTileSize, kTileSize), gfx::Size(kLayerSize, kLayerSize)); 32 gfx::Size(kTileSize, kTileSize), gfx::Size(kLayerSize, kLayerSize));
33 // Content rect that will align with top-left tile at scale 1.0. 33 // Content rect that will align with top-left tile at scale 1.0.
34 gfx::Rect content_rect(0, 0, kTileSize, kTileSize); 34 gfx::Rect content_rect(0, 0, kTileSize, kTileSize);
35 35
36 PicturePileImpl::Analysis analysis; 36 RasterSource::SolidColorAnalysis analysis;
37 timer_.Reset(); 37 timer_.Reset();
38 do { 38 do {
39 pile->AnalyzeInRect(content_rect, contents_scale, &analysis); 39 pile->AnalyzeInRect(content_rect, contents_scale, &analysis, nullptr);
40 timer_.NextLap(); 40 timer_.NextLap();
41 } while (!timer_.HasTimeLimitExpired()); 41 } while (!timer_.HasTimeLimitExpired());
42 42
43 perf_test::PrintResult( 43 perf_test::PrintResult(
44 "analyze", "", test_name, timer_.LapsPerSecond(), "runs/s", true); 44 "analyze", "", test_name, timer_.LapsPerSecond(), "runs/s", true);
45 } 45 }
46 46
47 void RunRasterTest(const std::string& test_name, float contents_scale) { 47 void RunRasterTest(const std::string& test_name, float contents_scale) {
48 scoped_refptr<PicturePileImpl> pile = FakePicturePileImpl::CreateFilledPile( 48 scoped_refptr<PicturePileImpl> pile = FakePicturePileImpl::CreateFilledPile(
49 gfx::Size(kTileSize, kTileSize), gfx::Size(kLayerSize, kLayerSize)); 49 gfx::Size(kTileSize, kTileSize), gfx::Size(kLayerSize, kLayerSize));
50 // Content rect that will align with top-left tile at scale 1.0. 50 // Content rect that will align with top-left tile at scale 1.0.
51 gfx::Rect content_rect(0, 0, kTileSize, kTileSize); 51 gfx::Rect content_rect(0, 0, kTileSize, kTileSize);
52 52
53 SkBitmap bitmap; 53 SkBitmap bitmap;
54 bitmap.allocN32Pixels(1, 1); 54 bitmap.allocN32Pixels(1, 1);
55 SkCanvas canvas(bitmap); 55 SkCanvas canvas(bitmap);
56 56
57 FakeRenderingStatsInstrumentation rendering_stats_instrumentation; 57 FakeRenderingStatsInstrumentation rendering_stats_instrumentation;
58 timer_.Reset(); 58 timer_.Reset();
59 do { 59 do {
60 pile->RasterToBitmap(&canvas, 60 pile->PlaybackToCanvas(&canvas,
61 content_rect, 61 content_rect,
62 contents_scale, 62 contents_scale,
63 &rendering_stats_instrumentation); 63 &rendering_stats_instrumentation);
64 timer_.NextLap(); 64 timer_.NextLap();
65 } while (!timer_.HasTimeLimitExpired()); 65 } while (!timer_.HasTimeLimitExpired());
66 66
67 perf_test::PrintResult( 67 perf_test::PrintResult(
68 "raster", "", test_name, timer_.LapsPerSecond(), "runs/s", true); 68 "raster", "", test_name, timer_.LapsPerSecond(), "runs/s", true);
69 } 69 }
70 70
71 private: 71 private:
72 LapTimer timer_; 72 LapTimer timer_;
73 }; 73 };
74 74
75 TEST_F(PicturePileImplPerfTest, Analyze) { 75 TEST_F(PicturePileImplPerfTest, Analyze) {
76 RunAnalyzeTest("1", 1.0f); 76 RunAnalyzeTest("1", 1.0f);
77 RunAnalyzeTest("4", 0.5f); 77 RunAnalyzeTest("4", 0.5f);
78 RunAnalyzeTest("100", 0.1f); 78 RunAnalyzeTest("100", 0.1f);
79 } 79 }
80 80
81 TEST_F(PicturePileImplPerfTest, Raster) { 81 TEST_F(PicturePileImplPerfTest, Raster) {
82 RunRasterTest("1", 1.0f); 82 RunRasterTest("1", 1.0f);
83 RunRasterTest("4", 0.5f); 83 RunRasterTest("4", 0.5f);
84 RunRasterTest("100", 0.1f); 84 RunRasterTest("100", 0.1f);
85 } 85 }
86 86
87 } // namespace 87 } // namespace
88 } // namespace cc 88 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698