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

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

Issue 26031002: cc: Remove unused metrics from RenderingStats. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed raster_worker_pool_perftest.cc Created 7 years, 2 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
« no previous file with comments | « cc/resources/picture.h ('k') | cc/resources/picture_pile.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.h" 5 #include "cc/resources/picture.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <set> 9 #include <set>
10 10
11 #include "base/base64.h" 11 #include "base/base64.h"
12 #include "base/debug/trace_event.h" 12 #include "base/debug/trace_event.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "cc/base/math_util.h" 14 #include "cc/base/math_util.h"
15 #include "cc/base/util.h" 15 #include "cc/base/util.h"
16 #include "cc/debug/benchmark_instrumentation.h" 16 #include "cc/debug/benchmark_instrumentation.h"
17 #include "cc/debug/rendering_stats_instrumentation.h"
18 #include "cc/debug/traced_picture.h" 17 #include "cc/debug/traced_picture.h"
19 #include "cc/debug/traced_value.h" 18 #include "cc/debug/traced_value.h"
20 #include "cc/layers/content_layer_client.h" 19 #include "cc/layers/content_layer_client.h"
21 #include "skia/ext/lazy_pixel_ref_utils.h" 20 #include "skia/ext/lazy_pixel_ref_utils.h"
22 #include "third_party/skia/include/core/SkCanvas.h" 21 #include "third_party/skia/include/core/SkCanvas.h"
23 #include "third_party/skia/include/core/SkData.h" 22 #include "third_party/skia/include/core/SkData.h"
24 #include "third_party/skia/include/core/SkDrawFilter.h" 23 #include "third_party/skia/include/core/SkDrawFilter.h"
25 #include "third_party/skia/include/core/SkPaint.h" 24 #include "third_party/skia/include/core/SkPaint.h"
26 #include "third_party/skia/include/core/SkStream.h" 25 #include "third_party/skia/include/core/SkStream.h"
27 #include "third_party/skia/include/utils/SkPictureUtils.h" 26 #include "third_party/skia/include/utils/SkPictureUtils.h"
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 234
236 canvas->restore(); 235 canvas->restore();
237 picture_->endRecording(); 236 picture_->endRecording();
238 237
239 opaque_rect_ = gfx::ToEnclosedRect(opaque_layer_rect); 238 opaque_rect_ = gfx::ToEnclosedRect(opaque_layer_rect);
240 239
241 EmitTraceSnapshot(); 240 EmitTraceSnapshot();
242 } 241 }
243 242
244 void Picture::GatherPixelRefs( 243 void Picture::GatherPixelRefs(
245 const SkTileGridPicture::TileGridInfo& tile_grid_info, 244 const SkTileGridPicture::TileGridInfo& tile_grid_info) {
246 RenderingStatsInstrumentation* stats_instrumentation) {
247 TRACE_EVENT2("cc", "Picture::GatherPixelRefs", 245 TRACE_EVENT2("cc", "Picture::GatherPixelRefs",
248 "width", layer_rect_.width(), 246 "width", layer_rect_.width(),
249 "height", layer_rect_.height()); 247 "height", layer_rect_.height());
250 248
251 DCHECK(picture_); 249 DCHECK(picture_);
252 cell_size_ = gfx::Size( 250 cell_size_ = gfx::Size(
253 tile_grid_info.fTileInterval.width() + 251 tile_grid_info.fTileInterval.width() +
254 2 * tile_grid_info.fMargin.width(), 252 2 * tile_grid_info.fMargin.width(),
255 tile_grid_info.fTileInterval.height() + 253 tile_grid_info.fTileInterval.height() +
256 2 * tile_grid_info.fMargin.height()); 254 2 * tile_grid_info.fMargin.height());
257 DCHECK_GT(cell_size_.width(), 0); 255 DCHECK_GT(cell_size_.width(), 0);
258 DCHECK_GT(cell_size_.height(), 0); 256 DCHECK_GT(cell_size_.height(), 0);
259 257
260 int min_x = std::numeric_limits<int>::max(); 258 int min_x = std::numeric_limits<int>::max();
261 int min_y = std::numeric_limits<int>::max(); 259 int min_y = std::numeric_limits<int>::max();
262 int max_x = 0; 260 int max_x = 0;
263 int max_y = 0; 261 int max_y = 0;
264 262
265 base::TimeTicks start_time = stats_instrumentation->StartRecording();
266
267 skia::LazyPixelRefList pixel_refs; 263 skia::LazyPixelRefList pixel_refs;
268 skia::LazyPixelRefUtils::GatherPixelRefs(picture_.get(), &pixel_refs); 264 skia::LazyPixelRefUtils::GatherPixelRefs(picture_.get(), &pixel_refs);
269 for (skia::LazyPixelRefList::const_iterator it = pixel_refs.begin(); 265 for (skia::LazyPixelRefList::const_iterator it = pixel_refs.begin();
270 it != pixel_refs.end(); 266 it != pixel_refs.end();
271 ++it) { 267 ++it) {
272 gfx::Point min( 268 gfx::Point min(
273 RoundDown(static_cast<int>(it->pixel_ref_rect.x()), 269 RoundDown(static_cast<int>(it->pixel_ref_rect.x()),
274 cell_size_.width()), 270 cell_size_.width()),
275 RoundDown(static_cast<int>(it->pixel_ref_rect.y()), 271 RoundDown(static_cast<int>(it->pixel_ref_rect.y()),
276 cell_size_.height())); 272 cell_size_.height()));
277 gfx::Point max( 273 gfx::Point max(
278 RoundDown(static_cast<int>(std::ceil(it->pixel_ref_rect.right())), 274 RoundDown(static_cast<int>(std::ceil(it->pixel_ref_rect.right())),
279 cell_size_.width()), 275 cell_size_.width()),
280 RoundDown(static_cast<int>(std::ceil(it->pixel_ref_rect.bottom())), 276 RoundDown(static_cast<int>(std::ceil(it->pixel_ref_rect.bottom())),
281 cell_size_.height())); 277 cell_size_.height()));
282 278
283 for (int y = min.y(); y <= max.y(); y += cell_size_.height()) { 279 for (int y = min.y(); y <= max.y(); y += cell_size_.height()) {
284 for (int x = min.x(); x <= max.x(); x += cell_size_.width()) { 280 for (int x = min.x(); x <= max.x(); x += cell_size_.width()) {
285 PixelRefMapKey key(x, y); 281 PixelRefMapKey key(x, y);
286 pixel_refs_[key].push_back(it->lazy_pixel_ref); 282 pixel_refs_[key].push_back(it->lazy_pixel_ref);
287 } 283 }
288 } 284 }
289 285
290 min_x = std::min(min_x, min.x()); 286 min_x = std::min(min_x, min.x());
291 min_y = std::min(min_y, min.y()); 287 min_y = std::min(min_y, min.y());
292 max_x = std::max(max_x, max.x()); 288 max_x = std::max(max_x, max.x());
293 max_y = std::max(max_y, max.y()); 289 max_y = std::max(max_y, max.y());
294 } 290 }
295 291
296 base::TimeDelta duration = stats_instrumentation->EndRecording(start_time);
297 stats_instrumentation->AddImageGathering(duration);
298
299 min_pixel_cell_ = gfx::Point(min_x, min_y); 292 min_pixel_cell_ = gfx::Point(min_x, min_y);
300 max_pixel_cell_ = gfx::Point(max_x, max_y); 293 max_pixel_cell_ = gfx::Point(max_x, max_y);
301 } 294 }
302 295
303 void Picture::Raster( 296 void Picture::Raster(
304 SkCanvas* canvas, 297 SkCanvas* canvas,
305 SkDrawPictureCallback* callback, 298 SkDrawPictureCallback* callback,
306 gfx::Rect content_rect, 299 gfx::Rect content_rect,
307 float contents_scale) { 300 float contents_scale) {
308 TRACE_EVENT_BEGIN1(benchmark_instrumentation::kCategory, 301 TRACE_EVENT_BEGIN1(benchmark_instrumentation::kCategory,
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 scoped_ptr<base::DictionaryValue> record_data(new base::DictionaryValue()); 479 scoped_ptr<base::DictionaryValue> record_data(new base::DictionaryValue());
487 record_data->Set("picture_id", TracedValue::CreateIDRef(this).release()); 480 record_data->Set("picture_id", TracedValue::CreateIDRef(this).release());
488 record_data->SetInteger(benchmark_instrumentation::kWidth, 481 record_data->SetInteger(benchmark_instrumentation::kWidth,
489 layer_rect_.width()); 482 layer_rect_.width());
490 record_data->SetInteger(benchmark_instrumentation::kHeight, 483 record_data->SetInteger(benchmark_instrumentation::kHeight,
491 layer_rect_.height()); 484 layer_rect_.height());
492 return TracedValue::FromValue(record_data.release()); 485 return TracedValue::FromValue(record_data.release());
493 } 486 }
494 487
495 } // namespace cc 488 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/picture.h ('k') | cc/resources/picture_pile.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698