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

Side by Side Diff: cc/debug/rasterize_and_record_benchmark_impl.cc

Issue 1531013004: cc: Do solid color analysis before scheduling tiles. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add test. Created 4 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
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/debug/rasterize_and_record_benchmark_impl.h" 5 #include "cc/debug/rasterize_and_record_benchmark_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 24 matching lines...) Expand all
35 const int kWarmupRuns = 0; 35 const int kWarmupRuns = 0;
36 const int kTimeCheckInterval = 1; 36 const int kTimeCheckInterval = 1;
37 37
38 *min_time = base::TimeDelta::Max(); 38 *min_time = base::TimeDelta::Max();
39 for (size_t i = 0; i < repeat_count; ++i) { 39 for (size_t i = 0; i < repeat_count; ++i) {
40 // Run for a minimum amount of time to avoid problems with timer 40 // Run for a minimum amount of time to avoid problems with timer
41 // quantization when the layer is very small. 41 // quantization when the layer is very small.
42 LapTimer timer(kWarmupRuns, 42 LapTimer timer(kWarmupRuns,
43 base::TimeDelta::FromMilliseconds(kTimeLimitMillis), 43 base::TimeDelta::FromMilliseconds(kTimeLimitMillis),
44 kTimeCheckInterval); 44 kTimeCheckInterval);
45 SkColor color = SK_ColorTRANSPARENT;
46 *is_solid_color = raster_source->PerformSolidColorAnalysis(
47 content_rect, contents_scale, &color);
48
45 do { 49 do {
46 SkBitmap bitmap; 50 SkBitmap bitmap;
47 bitmap.allocPixels(SkImageInfo::MakeN32Premul(content_rect.width(), 51 bitmap.allocPixels(SkImageInfo::MakeN32Premul(content_rect.width(),
48 content_rect.height())); 52 content_rect.height()));
49 SkCanvas canvas(bitmap); 53 SkCanvas canvas(bitmap);
50 DisplayListRasterSource::SolidColorAnalysis analysis;
51 54
52 raster_source->PerformSolidColorAnalysis(content_rect, contents_scale,
53 &analysis);
54 raster_source->PlaybackToCanvas(&canvas, content_rect, content_rect, 55 raster_source->PlaybackToCanvas(&canvas, content_rect, content_rect,
55 contents_scale); 56 contents_scale);
56 57
57 *is_solid_color = analysis.is_solid_color;
58
59 timer.NextLap(); 58 timer.NextLap();
60 } while (!timer.HasTimeLimitExpired()); 59 } while (!timer.HasTimeLimitExpired());
61 base::TimeDelta duration = 60 base::TimeDelta duration =
62 base::TimeDelta::FromMillisecondsD(timer.MsPerLap()); 61 base::TimeDelta::FromMillisecondsD(timer.MsPerLap());
63 if (duration < *min_time) 62 if (duration < *min_time)
64 *min_time = duration; 63 *min_time = duration;
65 } 64 }
66 } 65 }
67 66
68 class FixedInvalidationPictureLayerTilingClient 67 class FixedInvalidationPictureLayerTilingClient
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 total_memory_usage(0), 214 total_memory_usage(0),
216 total_layers(0), 215 total_layers(0),
217 total_picture_layers(0), 216 total_picture_layers(0),
218 total_picture_layers_with_no_content(0), 217 total_picture_layers_with_no_content(0),
219 total_picture_layers_off_screen(0) { 218 total_picture_layers_off_screen(0) {
220 } 219 }
221 220
222 RasterizeAndRecordBenchmarkImpl::RasterizeResults::~RasterizeResults() {} 221 RasterizeAndRecordBenchmarkImpl::RasterizeResults::~RasterizeResults() {}
223 222
224 } // namespace cc 223 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/playback/display_list_raster_source.h » ('j') | cc/playback/display_list_raster_source.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698