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

Unified Diff: cc/resources/bitmap_skpicture_content_layer_updater.cc

Issue 12426024: cc: Switch RenderingStats collection in Layer::Update() to RenderingStatsInstrumentation (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 9 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
Index: cc/resources/bitmap_skpicture_content_layer_updater.cc
diff --git a/cc/resources/bitmap_skpicture_content_layer_updater.cc b/cc/resources/bitmap_skpicture_content_layer_updater.cc
index 139a190699791f6cf96d171659e57730281695ec..c4a58706781f1796209c01f76ef43cf755bcc189 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();
danakj 2013/03/23 01:56:32 Hm, this was called paint time but was recording r
egraether 2013/03/25 21:07:44 I will leave behaviour the same here as well, so I
- updater_->PaintContentsRect(&canvas, source_rect, stats);
- if (stats)
- stats->totalPaintTime += 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,19 +66,23 @@ 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->totalRasterizeTime += base::TimeTicks::Now() - rasterize_begin_time;
- stats->totalPixelsRasterized += source_rect.width() * source_rect.height();
- }
+
+ base::TimeDelta duration =
+ rendering_stats_instrumentation_->EndRecording(start_time);
+ rendering_stats_instrumentation_->AddPaint(duration, 0);
egraether 2013/03/23 00:15:40 I moved the paint time saving down from above. Sho
danakj 2013/03/23 01:56:32 This is actually not paint time at all, this is al
egraether 2013/03/25 21:07:44 I will leave it to keep behaviour the same.
+ rendering_stats_instrumentation_->AddRaster(
+ duration,
+ source_rect.width() * source_rect.height(),
+ false);
}
} // namespace cc

Powered by Google App Engine
This is Rietveld 408576698