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

Side by Side Diff: cc/resources/picture_pile.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: fix histograms.xml 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 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/resources/picture_pile.h" 5 #include "cc/resources/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/histogram_macros.h"
11 #include "cc/base/region.h" 12 #include "cc/base/region.h"
12 #include "cc/resources/picture_pile_impl.h" 13 #include "cc/resources/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 "Renderer4.PicturePileUpdateUs",
156 "Renderer4.PicturePileUpdatePixelsPerMs");
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);
191 std::vector<gfx::Rect> invalid_tiles; 199 std::vector<gfx::Rect> invalid_tiles;
192 GetInvalidTileRects(interest_rect, invalidation, visible_layer_rect, 200 GetInvalidTileRects(interest_rect, invalidation, visible_layer_rect,
193 frame_number, &invalid_tiles); 201 frame_number, &invalid_tiles);
194 std::vector<gfx::Rect> record_rects; 202 std::vector<gfx::Rect> record_rects;
195 ClusterTiles(invalid_tiles, &record_rects); 203 ClusterTiles(invalid_tiles, &record_rects);
196 204
197 if (record_rects.empty()) 205 if (record_rects.empty())
198 return updated; 206 return updated;
199 207
208 // Count the area that is being recorded.
209 for (const auto& record_rect : record_rects)
210 timer.AddArea(record_rect.size().GetArea());
211
200 CreatePictures(painter, recording_mode, record_rects); 212 CreatePictures(painter, recording_mode, record_rects);
201 213
202 DetermineIfSolidColor(); 214 DetermineIfSolidColor();
203 215
204 has_any_recordings_ = true; 216 has_any_recordings_ = true;
205 DCHECK(CanRasterSlowTileCheck(recorded_viewport_)); 217 DCHECK(CanRasterSlowTileCheck(recorded_viewport_));
206 return true; 218 return true;
207 } 219 }
208 220
209 bool PicturePile::ApplyInvalidationAndResize(const gfx::Rect& interest_rect, 221 bool PicturePile::ApplyInvalidationAndResize(const gfx::Rect& interest_rect,
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 691
680 void PicturePile::SetBufferPixels(int new_buffer_pixels) { 692 void PicturePile::SetBufferPixels(int new_buffer_pixels) {
681 if (new_buffer_pixels == buffer_pixels()) 693 if (new_buffer_pixels == buffer_pixels())
682 return; 694 return;
683 695
684 Clear(); 696 Clear();
685 tiling_.SetBorderTexels(new_buffer_pixels); 697 tiling_.SetBorderTexels(new_buffer_pixels);
686 } 698 }
687 699
688 } // namespace cc 700 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698