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

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

Issue 1139743004: cc: Reland "Add UMA stats for record and raster time." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge with master (conflicts with cc/resources move) Created 5 years, 7 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/picture_pile.h" 5 #include "cc/playback/picture_pile.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <vector> 9 #include <vector>
10 10
11 #include "cc/base/histograms.h"
11 #include "cc/base/region.h" 12 #include "cc/base/region.h"
12 #include "cc/playback/picture_pile_impl.h" 13 #include "cc/playback/picture_pile_impl.h"
13 #include "skia/ext/analysis_canvas.h" 14 #include "skia/ext/analysis_canvas.h"
14 15
15 namespace { 16 namespace {
16 // Layout pixel buffer around the visible layer rect to record. Any base 17 // Layout pixel buffer around the visible layer rect to record. Any base
17 // picture that intersects the visible layer rect expanded by this distance 18 // picture that intersects the visible layer rect expanded by this distance
18 // will be recorded. 19 // will be recorded.
19 const int kPixelDistanceToRecord = 8000; 20 const int kPixelDistanceToRecord = 8000;
20 // We don't perform solid color analysis on images that have more than 10 skia 21 // We don't perform solid color analysis on images that have more than 10 skia
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 143
143 *record_rects = vertical_clustering; 144 *record_rects = vertical_clustering;
144 } 145 }
145 146
146 #ifdef NDEBUG 147 #ifdef NDEBUG
147 const bool kDefaultClearCanvasSetting = false; 148 const bool kDefaultClearCanvasSetting = false;
148 #else 149 #else
149 const bool kDefaultClearCanvasSetting = true; 150 const bool kDefaultClearCanvasSetting = true;
150 #endif 151 #endif
151 152
153 DEFINE_SCOPED_UMA_HISTOGRAM_AREA_TIMER(
154 ScopedPicturePileUpdateTimer,
155 "Compositing.PicturePile.UpdateUs",
156 "Compositing.PicturePile.UpdateInvalidatedAreaPerMs");
157
152 } // namespace 158 } // namespace
153 159
154 namespace cc { 160 namespace cc {
155 161
156 PicturePile::PicturePile(float min_contents_scale, 162 PicturePile::PicturePile(float min_contents_scale,
157 const gfx::Size& tile_grid_size) 163 const gfx::Size& tile_grid_size)
158 : min_contents_scale_(0), 164 : min_contents_scale_(0),
159 slow_down_raster_scale_factor_for_debug_(0), 165 slow_down_raster_scale_factor_for_debug_(0),
160 gather_pixel_refs_(false), 166 gather_pixel_refs_(false),
161 has_any_recordings_(false), 167 has_any_recordings_(false),
(...skipping 12 matching lines...) Expand all
174 PicturePile::~PicturePile() { 180 PicturePile::~PicturePile() {
175 } 181 }
176 182
177 bool PicturePile::UpdateAndExpandInvalidation( 183 bool PicturePile::UpdateAndExpandInvalidation(
178 ContentLayerClient* painter, 184 ContentLayerClient* painter,
179 Region* invalidation, 185 Region* invalidation,
180 const gfx::Size& layer_size, 186 const gfx::Size& layer_size,
181 const gfx::Rect& visible_layer_rect, 187 const gfx::Rect& visible_layer_rect,
182 int frame_number, 188 int frame_number,
183 RecordingSource::RecordingMode recording_mode) { 189 RecordingSource::RecordingMode recording_mode) {
190 ScopedPicturePileUpdateTimer timer;
191
184 gfx::Rect interest_rect = visible_layer_rect; 192 gfx::Rect interest_rect = visible_layer_rect;
185 interest_rect.Inset(-pixel_record_distance_, -pixel_record_distance_); 193 interest_rect.Inset(-pixel_record_distance_, -pixel_record_distance_);
186 recorded_viewport_ = interest_rect; 194 recorded_viewport_ = interest_rect;
187 recorded_viewport_.Intersect(gfx::Rect(layer_size)); 195 recorded_viewport_.Intersect(gfx::Rect(layer_size));
188 196
189 bool updated = ApplyInvalidationAndResize(interest_rect, invalidation, 197 bool updated = ApplyInvalidationAndResize(interest_rect, invalidation,
190 layer_size, frame_number); 198 layer_size, frame_number);
199
200 // Count the area that is being invalidated.
201 Region recorded_invalidation(*invalidation);
202 recorded_invalidation.Intersect(recorded_viewport_);
203 for (Region::Iterator it(recorded_invalidation); it.has_rect(); it.next())
204 timer.AddArea(it.rect().size().GetArea());
205
191 std::vector<gfx::Rect> invalid_tiles; 206 std::vector<gfx::Rect> invalid_tiles;
192 GetInvalidTileRects(interest_rect, &invalid_tiles); 207 GetInvalidTileRects(interest_rect, &invalid_tiles);
193 std::vector<gfx::Rect> record_rects; 208 std::vector<gfx::Rect> record_rects;
194 ClusterTiles(invalid_tiles, &record_rects); 209 ClusterTiles(invalid_tiles, &record_rects);
195 210
196 if (record_rects.empty()) 211 if (record_rects.empty())
197 return updated; 212 return updated;
198 213
199 CreatePictures(painter, recording_mode, record_rects); 214 CreatePictures(painter, recording_mode, record_rects);
200 215
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 690
676 void PicturePile::SetBufferPixels(int new_buffer_pixels) { 691 void PicturePile::SetBufferPixels(int new_buffer_pixels) {
677 if (new_buffer_pixels == buffer_pixels()) 692 if (new_buffer_pixels == buffer_pixels())
678 return; 693 return;
679 694
680 Clear(); 695 Clear();
681 tiling_.SetBorderTexels(new_buffer_pixels); 696 tiling_.SetBorderTexels(new_buffer_pixels);
682 } 697 }
683 698
684 } // namespace cc 699 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698