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

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

Issue 1075523002: cc: Add UMA stats for record and raster time. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rename histograms Created 5 years, 8 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/resources/display_list_recording_source.h" 5 #include "cc/resources/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/region.h" 10 #include "cc/base/region.h"
10 #include "cc/layers/content_layer_client.h" 11 #include "cc/layers/content_layer_client.h"
11 #include "cc/resources/display_item_list.h" 12 #include "cc/resources/display_item_list.h"
12 #include "cc/resources/display_list_raster_source.h" 13 #include "cc/resources/display_list_raster_source.h"
13 #include "skia/ext/analysis_canvas.h" 14 #include "skia/ext/analysis_canvas.h"
14 15
15 namespace { 16 namespace {
16 17
17 // 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
18 // picture that intersects the visible layer rect expanded by this distance 19 // picture that intersects the visible layer rect expanded by this distance
19 // will be recorded. 20 // will be recorded.
20 const int kPixelDistanceToRecord = 8000; 21 const int kPixelDistanceToRecord = 8000;
21 // 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
22 // operations. 23 // operations.
23 const int kOpCountThatIsOkToAnalyze = 10; 24 const int kOpCountThatIsOkToAnalyze = 10;
24 25
26 DEFINE_SCOPED_UMA_HISTOGRAM_AREA_TIMER(
27 ScopedDisplayListRecordingSourceUpdateTimer,
28 "Renderer4.DisplayListRecordingSourceRecordUs",
29 "Renderer4.DisplayListRecordingSourceRecordedAreaPerMs");
30
25 } // namespace 31 } // namespace
26 32
27 namespace cc { 33 namespace cc {
28 34
29 DisplayListRecordingSource::DisplayListRecordingSource( 35 DisplayListRecordingSource::DisplayListRecordingSource(
30 const gfx::Size& grid_cell_size) 36 const gfx::Size& grid_cell_size)
31 : slow_down_raster_scale_factor_for_debug_(0), 37 : slow_down_raster_scale_factor_for_debug_(0),
32 gather_pixel_refs_(false), 38 gather_pixel_refs_(false),
33 requires_clear_(false), 39 requires_clear_(false),
34 is_solid_color_(false), 40 is_solid_color_(false),
35 solid_color_(SK_ColorTRANSPARENT), 41 solid_color_(SK_ColorTRANSPARENT),
36 background_color_(SK_ColorTRANSPARENT), 42 background_color_(SK_ColorTRANSPARENT),
37 pixel_record_distance_(kPixelDistanceToRecord), 43 pixel_record_distance_(kPixelDistanceToRecord),
38 grid_cell_size_(grid_cell_size), 44 grid_cell_size_(grid_cell_size),
39 is_suitable_for_gpu_rasterization_(true) { 45 is_suitable_for_gpu_rasterization_(true) {
40 } 46 }
41 47
42 DisplayListRecordingSource::~DisplayListRecordingSource() { 48 DisplayListRecordingSource::~DisplayListRecordingSource() {
43 } 49 }
44 50
45 bool DisplayListRecordingSource::UpdateAndExpandInvalidation( 51 bool DisplayListRecordingSource::UpdateAndExpandInvalidation(
46 ContentLayerClient* painter, 52 ContentLayerClient* painter,
47 Region* invalidation, 53 Region* invalidation,
48 const gfx::Size& layer_size, 54 const gfx::Size& layer_size,
49 const gfx::Rect& visible_layer_rect, 55 const gfx::Rect& visible_layer_rect,
50 int frame_number, 56 int frame_number,
51 RecordingMode recording_mode) { 57 RecordingMode recording_mode) {
58 ScopedDisplayListRecordingSourceUpdateTimer timer;
52 bool updated = false; 59 bool updated = false;
53 60
54 if (size_ != layer_size) { 61 if (size_ != layer_size) {
55 size_ = layer_size; 62 size_ = layer_size;
56 updated = true; 63 updated = true;
57 } 64 }
58 65
59 gfx::Rect old_recorded_viewport = recorded_viewport_; 66 gfx::Rect old_recorded_viewport = recorded_viewport_;
60 recorded_viewport_ = visible_layer_rect; 67 recorded_viewport_ = visible_layer_rect;
61 recorded_viewport_.Inset(-pixel_record_distance_, -pixel_record_distance_); 68 recorded_viewport_.Inset(-pixel_record_distance_, -pixel_record_distance_);
62 recorded_viewport_.Intersect(gfx::Rect(GetSize())); 69 recorded_viewport_.Intersect(gfx::Rect(GetSize()));
63 70
64 if (recorded_viewport_ != old_recorded_viewport) { 71 if (recorded_viewport_ != old_recorded_viewport) {
65 // Invalidate newly-exposed and no-longer-exposed areas. 72 // Invalidate newly-exposed and no-longer-exposed areas.
66 Region newly_exposed_region(recorded_viewport_); 73 Region newly_exposed_region(recorded_viewport_);
67 newly_exposed_region.Subtract(old_recorded_viewport); 74 newly_exposed_region.Subtract(old_recorded_viewport);
68 invalidation->Union(newly_exposed_region); 75 invalidation->Union(newly_exposed_region);
69 76
70 Region no_longer_exposed_region(old_recorded_viewport); 77 Region no_longer_exposed_region(old_recorded_viewport);
71 no_longer_exposed_region.Subtract(recorded_viewport_); 78 no_longer_exposed_region.Subtract(recorded_viewport_);
72 invalidation->Union(no_longer_exposed_region); 79 invalidation->Union(no_longer_exposed_region);
73 80
74 updated = true; 81 updated = true;
75 } 82 }
76 83
84 // Count the area that is being invalidated.
85 for (Region::Iterator it(*invalidation); it.has_rect(); it.next())
enne (OOO) 2015/04/13 21:52:26 This is a petty nit, but it's weird to have this i
jbroman 2015/04/14 14:44:36 Prevents the work before the invalidation is avail
enne (OOO) 2015/04/14 16:54:10 Hmm, ok, this is fine. I am not sure whether it m
86 timer.AddArea(it.rect().size().GetArea());
87
77 if (!updated && !invalidation->Intersects(recorded_viewport_)) 88 if (!updated && !invalidation->Intersects(recorded_viewport_))
78 return false; 89 return false;
79 90
80 ContentLayerClient::PaintingControlSetting painting_control = 91 ContentLayerClient::PaintingControlSetting painting_control =
81 ContentLayerClient::PAINTING_BEHAVIOR_NORMAL; 92 ContentLayerClient::PAINTING_BEHAVIOR_NORMAL;
82 93
83 switch (recording_mode) { 94 switch (recording_mode) {
84 case RECORD_NORMALLY: 95 case RECORD_NORMALLY:
85 // Already setup for normal recording. 96 // Already setup for normal recording.
86 break; 97 break;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 is_solid_color_ = canvas.GetColorIfSolid(&solid_color_); 192 is_solid_color_ = canvas.GetColorIfSolid(&solid_color_);
182 } 193 }
183 194
184 void DisplayListRecordingSource::Clear() { 195 void DisplayListRecordingSource::Clear() {
185 recorded_viewport_ = gfx::Rect(); 196 recorded_viewport_ = gfx::Rect();
186 display_list_ = NULL; 197 display_list_ = NULL;
187 is_solid_color_ = false; 198 is_solid_color_ = false;
188 } 199 }
189 200
190 } // namespace cc 201 } // namespace cc
OLDNEW
« no previous file with comments | « cc/cc_tests.gyp ('k') | cc/resources/picture_pile.cc » ('j') | cc/resources/picture_pile.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698