summaryrefslogtreecommitdiffstats
path: root/cc/resources/bitmap_skpicture_content_layer_updater.cc
diff options
context:
space:
mode:
authorhashimoto@chromium.org <hashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-27 06:15:21 +0000
committerhashimoto@chromium.org <hashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-27 06:15:21 +0000
commitd5e16c0ce64a8e86df9a3a576e0b26b3622f014a (patch)
tree4caa46dad5b493b65a136818b7eaebf1f1b830ea /cc/resources/bitmap_skpicture_content_layer_updater.cc
parentc600f5c6c9d3e9fb4b82dfc41b9ec000c9cb284d (diff)
downloadchromium_src-d5e16c0ce64a8e86df9a3a576e0b26b3622f014a.zip
chromium_src-d5e16c0ce64a8e86df9a3a576e0b26b3622f014a.tar.gz
chromium_src-d5e16c0ce64a8e86df9a3a576e0b26b3622f014a.tar.bz2
Revert 190817 "cc: Switch RenderingStats collection in Layer::Up..."
> 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 TBR=egraether@chromium.org Review URL: https://codereview.chromium.org/13117002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@190826 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.cc51
1 files changed, 24 insertions, 27 deletions
diff --git a/cc/resources/bitmap_skpicture_content_layer_updater.cc b/cc/resources/bitmap_skpicture_content_layer_updater.cc
index 455d7c9..e721891 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_instrumentation.h"
+#include "cc/debug/rendering_stats.h"
#include "cc/resources/layer_painter.h"
#include "cc/resources/prioritized_resource.h"
#include "cc/resources/resource_update_queue.h"
@@ -23,15 +23,20 @@ void BitmapSkPictureContentLayerUpdater::Resource::Update(
ResourceUpdateQueue* queue,
gfx::Rect source_rect,
gfx::Vector2d dest_offset,
- bool partial_update) {
+ bool partial_update,
+ RenderingStats* stats) {
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);
-
- updater_->PaintContentsRect(&canvas, source_rect);
+ 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;
ResourceUpdate upload = ResourceUpdate::Create(
texture(), &bitmap_, source_rect, source_rect, dest_offset);
@@ -42,18 +47,14 @@ void BitmapSkPictureContentLayerUpdater::Resource::Update(
}
scoped_refptr<BitmapSkPictureContentLayerUpdater>
-BitmapSkPictureContentLayerUpdater::Create(
- scoped_ptr<LayerPainter> painter,
- RenderingStatsInstrumentation* stats_instrumentation) {
+BitmapSkPictureContentLayerUpdater::Create(scoped_ptr<LayerPainter> painter) {
return make_scoped_refptr(
- new BitmapSkPictureContentLayerUpdater(painter.Pass(),
- stats_instrumentation));
+ new BitmapSkPictureContentLayerUpdater(painter.Pass()));
}
BitmapSkPictureContentLayerUpdater::BitmapSkPictureContentLayerUpdater(
- scoped_ptr<LayerPainter> painter,
- RenderingStatsInstrumentation* stats_instrumentation)
- : SkPictureContentLayerUpdater(painter.Pass(), stats_instrumentation) {}
+ scoped_ptr<LayerPainter> painter)
+ : SkPictureContentLayerUpdater(painter.Pass()) {}
BitmapSkPictureContentLayerUpdater::~BitmapSkPictureContentLayerUpdater() {}
@@ -66,25 +67,21 @@ BitmapSkPictureContentLayerUpdater::CreateResource(
void BitmapSkPictureContentLayerUpdater::PaintContentsRect(
SkCanvas* canvas,
- gfx::Rect source_rect) {
+ gfx::Rect source_rect,
+ RenderingStats* stats) {
// 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 start_time =
- rendering_stats_instrumentation_->StartRecording();
-
+ base::TimeTicks rasterize_begin_time;
+ if (stats)
+ rasterize_begin_time = base::TimeTicks::Now();
DrawPicture(canvas);
-
- 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);
+ if (stats) {
+ stats->total_rasterize_time +=
+ base::TimeTicks::Now() - rasterize_begin_time;
+ stats->total_pixels_rasterized +=
+ source_rect.width() * source_rect.height();
+ }
}
} // namespace cc