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

Unified Diff: cc/picture.cc

Issue 12095053: cc: Avoid expensive RenderingStats collection. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/picture.h ('k') | cc/picture_image_layer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/picture.cc
diff --git a/cc/picture.cc b/cc/picture.cc
index c850fd8e3e954c7f75068a7e383c557c1dbf092b..35a935dd0264c4619aad5370886e664b6c70505b 100644
--- a/cc/picture.cc
+++ b/cc/picture.cc
@@ -50,7 +50,7 @@ scoped_refptr<Picture> Picture::Clone() const {
}
void Picture::Record(ContentLayerClient* painter,
- RenderingStats& stats) {
+ RenderingStats* stats) {
TRACE_EVENT2("cc", "Picture::Record",
"width", layer_rect_.width(), "height", layer_rect_.height());
@@ -80,11 +80,15 @@ void Picture::Record(ContentLayerClient* painter,
canvas->drawRect(layer_skrect, paint);
gfx::RectF opaque_layer_rect;
- base::TimeTicks beginPaintTime = base::TimeTicks::Now();
+ base::TimeTicks begin_paint_time;
+ if (stats)
+ begin_paint_time = base::TimeTicks::Now();
painter->paintContents(canvas, layer_rect_, opaque_layer_rect);
- stats.totalPaintTime += base::TimeTicks::Now() - beginPaintTime;
- stats.totalPixelsPainted += layer_rect_.width() *
- layer_rect_.height();
+ if (stats) {
+ stats->totalPaintTime += base::TimeTicks::Now() - begin_paint_time;
+ stats->totalPixelsPainted +=
+ layer_rect_.width() * layer_rect_.height();
+ }
canvas->restore();
picture_->endRecording();
« no previous file with comments | « cc/picture.h ('k') | cc/picture_image_layer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698