diff options
author | egraether@chromium.org <egraether@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-28 01:34:23 +0000 |
---|---|---|
committer | egraether@chromium.org <egraether@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-28 01:34:23 +0000 |
commit | 9d4f41f8736543f85752ea4a8f8d0fb709c1eb1c (patch) | |
tree | 6bd583ba9641f1a2ca0ad2a654b3ef0eaed86091 /cc/resources/bitmap_skpicture_content_layer_updater.cc | |
parent | bd78698c1116e009d8219fa514ba9a7cae40f96e (diff) | |
download | chromium_src-9d4f41f8736543f85752ea4a8f8d0fb709c1eb1c.zip chromium_src-9d4f41f8736543f85752ea4a8f8d0fb709c1eb1c.tar.gz chromium_src-9d4f41f8736543f85752ea4a8f8d0fb709c1eb1c.tar.bz2 |
cc: Switch RenderingStats collection in Layer::Update() to RenderingStatsInstrumentation
This change switches all of the remaining RenderingStats collection in
composited mode to use RenderinStatsInstrumentation.
BUG=181319
Review URL: https://chromiumcodereview.appspot.com/12426024
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@191086 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/resources/bitmap_skpicture_content_layer_updater.cc')
-rw-r--r-- | cc/resources/bitmap_skpicture_content_layer_updater.cc | 51 |
1 files changed, 27 insertions, 24 deletions
diff --git a/cc/resources/bitmap_skpicture_content_layer_updater.cc b/cc/resources/bitmap_skpicture_content_layer_updater.cc index e721891..455d7c9 100644 --- a/cc/resources/bitmap_skpicture_content_layer_updater.cc +++ b/cc/resources/bitmap_skpicture_content_layer_updater.cc @@ -5,7 +5,7 @@ #include "cc/resources/bitmap_skpicture_content_layer_updater.h" #include "base/time.h" -#include "cc/debug/rendering_stats.h" +#include "cc/debug/rendering_stats_instrumentation.h" #include "cc/resources/layer_painter.h" #include "cc/resources/prioritized_resource.h" #include "cc/resources/resource_update_queue.h" @@ -23,20 +23,15 @@ void BitmapSkPictureContentLayerUpdater::Resource::Update( ResourceUpdateQueue* queue, gfx::Rect source_rect, gfx::Vector2d dest_offset, - bool partial_update, - RenderingStats* stats) { + bool partial_update) { bitmap_.setConfig( SkBitmap::kARGB_8888_Config, source_rect.width(), source_rect.height()); bitmap_.allocPixels(); bitmap_.setIsOpaque(updater_->layer_is_opaque()); SkDevice device(bitmap_); SkCanvas canvas(&device); - base::TimeTicks paint_begin_time; - if (stats) - paint_begin_time = base::TimeTicks::Now(); - updater_->PaintContentsRect(&canvas, source_rect, stats); - if (stats) - stats->total_paint_time += base::TimeTicks::Now() - paint_begin_time; + + updater_->PaintContentsRect(&canvas, source_rect); ResourceUpdate upload = ResourceUpdate::Create( texture(), &bitmap_, source_rect, source_rect, dest_offset); @@ -47,14 +42,18 @@ void BitmapSkPictureContentLayerUpdater::Resource::Update( } scoped_refptr<BitmapSkPictureContentLayerUpdater> -BitmapSkPictureContentLayerUpdater::Create(scoped_ptr<LayerPainter> painter) { +BitmapSkPictureContentLayerUpdater::Create( + scoped_ptr<LayerPainter> painter, + RenderingStatsInstrumentation* stats_instrumentation) { return make_scoped_refptr( - new BitmapSkPictureContentLayerUpdater(painter.Pass())); + new BitmapSkPictureContentLayerUpdater(painter.Pass(), + stats_instrumentation)); } BitmapSkPictureContentLayerUpdater::BitmapSkPictureContentLayerUpdater( - scoped_ptr<LayerPainter> painter) - : SkPictureContentLayerUpdater(painter.Pass()) {} + scoped_ptr<LayerPainter> painter, + RenderingStatsInstrumentation* stats_instrumentation) + : SkPictureContentLayerUpdater(painter.Pass(), stats_instrumentation) {} BitmapSkPictureContentLayerUpdater::~BitmapSkPictureContentLayerUpdater() {} @@ -67,21 +66,25 @@ BitmapSkPictureContentLayerUpdater::CreateResource( void BitmapSkPictureContentLayerUpdater::PaintContentsRect( SkCanvas* canvas, - gfx::Rect source_rect, - RenderingStats* stats) { + gfx::Rect source_rect) { // Translate the origin of content_rect to that of source_rect. canvas->translate(content_rect().x() - source_rect.x(), content_rect().y() - source_rect.y()); - base::TimeTicks rasterize_begin_time; - if (stats) - rasterize_begin_time = base::TimeTicks::Now(); + + base::TimeTicks start_time = + rendering_stats_instrumentation_->StartRecording(); + DrawPicture(canvas); - if (stats) { - stats->total_rasterize_time += - base::TimeTicks::Now() - rasterize_begin_time; - stats->total_pixels_rasterized += - source_rect.width() * source_rect.height(); - } + + base::TimeDelta duration = + rendering_stats_instrumentation_->EndRecording(start_time); + rendering_stats_instrumentation_->AddRaster( + duration, + source_rect.width() * source_rect.height(), + false); + + // TODO: Clarify if this needs to be saved here. crbug.com/223693 + rendering_stats_instrumentation_->AddPaint(duration, 0); } } // namespace cc |