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

Side by Side Diff: cc/playback/display_list_recording_source.cc

Issue 1146813012: cc: Add tests for DisplayListRasterSource. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: displaytest: . Created 5 years, 6 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 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/playback/display_list_recording_source.h" 5 #include "cc/playback/display_list_recording_source.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "cc/base/histograms.h" 9 #include "cc/base/histograms.h"
10 #include "cc/base/region.h" 10 #include "cc/base/region.h"
11 #include "cc/layers/content_layer_client.h" 11 #include "cc/layers/content_layer_client.h"
12 #include "cc/playback/display_item_list.h" 12 #include "cc/playback/display_item_list.h"
13 #include "cc/playback/display_list_raster_source.h" 13 #include "cc/playback/display_list_raster_source.h"
14 #include "skia/ext/analysis_canvas.h" 14 #include "skia/ext/analysis_canvas.h"
15 15
16 namespace { 16 namespace {
17 17
18 // Layout pixel buffer around the visible layer rect to record. Any base 18 // Layout pixel buffer around the visible layer rect to record. Any base
19 // picture that intersects the visible layer rect expanded by this distance 19 // picture that intersects the visible layer rect expanded by this distance
20 // will be recorded. 20 // will be recorded.
21 const int kPixelDistanceToRecord = 8000; 21 const int kPixelDistanceToRecord = 8000;
22 // We don't perform solid color analysis on images that have more than 10 skia 22 // We don't perform solid color analysis on images that have more than 10 skia
23 // operations. 23 // operations.
24 const int kOpCountThatIsOkToAnalyze = 10; 24 const int kOpCountThatIsOkToAnalyze = 10;
25 25
26 #ifdef NDEBUG
27 const bool kDefaultClearCanvasSetting = false;
28 #else
29 const bool kDefaultClearCanvasSetting = true;
30 #endif
31
26 DEFINE_SCOPED_UMA_HISTOGRAM_AREA_TIMER( 32 DEFINE_SCOPED_UMA_HISTOGRAM_AREA_TIMER(
27 ScopedDisplayListRecordingSourceUpdateTimer, 33 ScopedDisplayListRecordingSourceUpdateTimer,
28 "Compositing.DisplayListRecordingSource.UpdateUs", 34 "Compositing.DisplayListRecordingSource.UpdateUs",
29 "Compositing.DisplayListRecordingSource.UpdateInvalidatedAreaPerMs"); 35 "Compositing.DisplayListRecordingSource.UpdateInvalidatedAreaPerMs");
30 36
31 } // namespace 37 } // namespace
32 38
33 namespace cc { 39 namespace cc {
34 40
35 DisplayListRecordingSource::DisplayListRecordingSource( 41 DisplayListRecordingSource::DisplayListRecordingSource(
36 const gfx::Size& grid_cell_size) 42 const gfx::Size& grid_cell_size)
37 : slow_down_raster_scale_factor_for_debug_(0), 43 : slow_down_raster_scale_factor_for_debug_(0),
38 gather_pixel_refs_(false), 44 gather_pixel_refs_(false),
39 requires_clear_(false), 45 requires_clear_(false),
40 is_solid_color_(false), 46 is_solid_color_(false),
47 clear_canvas_with_debug_color_(kDefaultClearCanvasSetting),
41 solid_color_(SK_ColorTRANSPARENT), 48 solid_color_(SK_ColorTRANSPARENT),
42 background_color_(SK_ColorTRANSPARENT), 49 background_color_(SK_ColorTRANSPARENT),
43 pixel_record_distance_(kPixelDistanceToRecord), 50 pixel_record_distance_(kPixelDistanceToRecord),
44 grid_cell_size_(grid_cell_size), 51 grid_cell_size_(grid_cell_size),
45 is_suitable_for_gpu_rasterization_(true) { 52 is_suitable_for_gpu_rasterization_(true) {
46 } 53 }
47 54
48 DisplayListRecordingSource::~DisplayListRecordingSource() { 55 DisplayListRecordingSource::~DisplayListRecordingSource() {
49 } 56 }
50 57
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 default: 116 default:
110 // case RecordingSource::RECORD_WITH_SK_NULL_CANVAS should not be reached 117 // case RecordingSource::RECORD_WITH_SK_NULL_CANVAS should not be reached
111 NOTREACHED(); 118 NOTREACHED();
112 } 119 }
113 120
114 int repeat_count = 1; 121 int repeat_count = 1;
115 if (slow_down_raster_scale_factor_for_debug_ > 1) { 122 if (slow_down_raster_scale_factor_for_debug_ > 1) {
116 repeat_count = slow_down_raster_scale_factor_for_debug_; 123 repeat_count = slow_down_raster_scale_factor_for_debug_;
117 painting_control = ContentLayerClient::DISPLAY_LIST_CACHING_DISABLED; 124 painting_control = ContentLayerClient::DISPLAY_LIST_CACHING_DISABLED;
118 } 125 }
126
119 for (int i = 0; i < repeat_count; ++i) { 127 for (int i = 0; i < repeat_count; ++i) {
120 display_list_ = painter->PaintContentsToDisplayList(recorded_viewport_, 128 display_list_ = painter->PaintContentsToDisplayList(recorded_viewport_,
121 painting_control); 129 painting_control);
122 } 130 }
123 131
124 is_suitable_for_gpu_rasterization_ = 132 is_suitable_for_gpu_rasterization_ =
125 display_list_->IsSuitableForGpuRasterization(); 133 display_list_->IsSuitableForGpuRasterization();
126 DetermineIfSolidColor(); 134 DetermineIfSolidColor();
127 display_list_->EmitTraceSnapshot(); 135 display_list_->EmitTraceSnapshot();
128 if (gather_pixel_refs_) 136 if (gather_pixel_refs_)
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 is_solid_color_ = canvas.GetColorIfSolid(&solid_color_); 197 is_solid_color_ = canvas.GetColorIfSolid(&solid_color_);
190 } 198 }
191 199
192 void DisplayListRecordingSource::Clear() { 200 void DisplayListRecordingSource::Clear() {
193 recorded_viewport_ = gfx::Rect(); 201 recorded_viewport_ = gfx::Rect();
194 display_list_ = NULL; 202 display_list_ = NULL;
195 is_solid_color_ = false; 203 is_solid_color_ = false;
196 } 204 }
197 205
198 } // namespace cc 206 } // namespace cc
OLDNEW
« no previous file with comments | « cc/playback/display_list_recording_source.h ('k') | cc/playback/display_list_recording_source_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698