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

Unified Diff: cc/bitmap_skpicture_content_layer_updater.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/bitmap_skpicture_content_layer_updater.h ('k') | cc/caching_bitmap_content_layer_updater.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/bitmap_skpicture_content_layer_updater.cc
diff --git a/cc/bitmap_skpicture_content_layer_updater.cc b/cc/bitmap_skpicture_content_layer_updater.cc
index 5c0e512c1893899d5d744cd5566b24f9490e1c7b..dab97b13224b872c5aa589cd7872dfa425166775 100644
--- a/cc/bitmap_skpicture_content_layer_updater.cc
+++ b/cc/bitmap_skpicture_content_layer_updater.cc
@@ -20,16 +20,19 @@ BitmapSkPictureContentLayerUpdater::Resource::Resource(BitmapSkPictureContentLay
{
}
-void BitmapSkPictureContentLayerUpdater::Resource::update(ResourceUpdateQueue& queue, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset, bool partialUpdate, RenderingStats& stats)
+void BitmapSkPictureContentLayerUpdater::Resource::update(ResourceUpdateQueue& queue, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset, bool partialUpdate, RenderingStats* stats)
{
m_bitmap.setConfig(SkBitmap::kARGB_8888_Config, sourceRect.width(), sourceRect.height());
m_bitmap.allocPixels();
m_bitmap.setIsOpaque(m_updater->layerIsOpaque());
SkDevice device(m_bitmap);
SkCanvas canvas(&device);
- base::TimeTicks paintBeginTime = base::TimeTicks::Now();
+ base::TimeTicks paintBeginTime;
+ if (stats)
+ paintBeginTime = base::TimeTicks::Now();
updater()->paintContentsRect(&canvas, sourceRect, stats);
- stats.totalPaintTime += base::TimeTicks::Now() - paintBeginTime;
+ if (stats)
+ stats->totalPaintTime += base::TimeTicks::Now() - paintBeginTime;
ResourceUpdate upload = ResourceUpdate::Create(
texture(), &m_bitmap, sourceRect, sourceRect, destOffset);
@@ -58,15 +61,19 @@ scoped_ptr<LayerUpdater::Resource> BitmapSkPictureContentLayerUpdater::createRes
return scoped_ptr<LayerUpdater::Resource>(new Resource(this, PrioritizedResource::create(manager)));
}
-void BitmapSkPictureContentLayerUpdater::paintContentsRect(SkCanvas* canvas, const gfx::Rect& sourceRect, RenderingStats& stats)
+void BitmapSkPictureContentLayerUpdater::paintContentsRect(SkCanvas* canvas, const gfx::Rect& sourceRect, RenderingStats* stats)
{
// Translate the origin of contentRect to that of sourceRect.
canvas->translate(contentRect().x() - sourceRect.x(),
contentRect().y() - sourceRect.y());
- base::TimeTicks rasterizeBeginTime = base::TimeTicks::Now();
+ base::TimeTicks rasterizeBeginTime;
+ if (stats)
+ rasterizeBeginTime = base::TimeTicks::Now();
drawPicture(canvas);
- stats.totalRasterizeTime += base::TimeTicks::Now() - rasterizeBeginTime;
- stats.totalPixelsRasterized += sourceRect.width() * sourceRect.height();
+ if (stats) {
+ stats->totalRasterizeTime += base::TimeTicks::Now() - rasterizeBeginTime;
+ stats->totalPixelsRasterized += sourceRect.width() * sourceRect.height();
+ }
}
} // namespace cc
« no previous file with comments | « cc/bitmap_skpicture_content_layer_updater.h ('k') | cc/caching_bitmap_content_layer_updater.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698