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

Unified Diff: cc/resources/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/content_layer_updater.cc
diff --git a/cc/resources/content_layer_updater.cc b/cc/resources/content_layer_updater.cc
index b4eb1d275e4b04a30d3cd5e00f651fc0f9ac7491..ee40da703627c22faf5818e9a2199956a12891cc 100644
--- a/cc/resources/content_layer_updater.cc
+++ b/cc/resources/content_layer_updater.cc
@@ -6,7 +6,7 @@
#include "base/debug/trace_event.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 "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkPaint.h"
@@ -17,8 +17,11 @@
namespace cc {
-ContentLayerUpdater::ContentLayerUpdater(scoped_ptr<LayerPainter> painter)
- : painter_(painter.Pass()) {}
+ContentLayerUpdater::ContentLayerUpdater(
+ scoped_ptr<LayerPainter> painter,
+ RenderingStatsInstrumentation* stats_instrumentation)
+ : painter_(painter.Pass()),
+ rendering_stats_instrumentation_(stats_instrumentation) {}
ContentLayerUpdater::~ContentLayerUpdater() {}
@@ -26,8 +29,7 @@ void ContentLayerUpdater::PaintContents(SkCanvas* canvas,
gfx::Rect content_rect,
float contents_width_scale,
float contents_height_scale,
- gfx::Rect* resulting_opaque_rect,
- RenderingStats* stats) {
+ gfx::Rect* resulting_opaque_rect) {
TRACE_EVENT0("cc", "ContentLayerUpdater::paintContents");
canvas->save();
canvas->translate(SkFloatToScalar(-content_rect.x()),
@@ -53,14 +55,18 @@ void ContentLayerUpdater::PaintContents(SkCanvas* canvas,
canvas->clipRect(layer_sk_rect);
gfx::RectF opaque_layer_rect;
- base::TimeTicks paint_begin_time;
- if (stats)
- paint_begin_time = base::TimeTicks::Now();
+
+ base::TimeTicks start_time =
+ rendering_stats_instrumentation_->StartRecording();
+
painter_->Paint(canvas, layer_rect, &opaque_layer_rect);
- if (stats) {
- stats->totalPaintTime += base::TimeTicks::Now() - paint_begin_time;
- stats->totalPixelsPainted += content_rect.width() * content_rect.height();
- }
+
+ base::TimeDelta duration =
+ rendering_stats_instrumentation_->EndRecording(start_time);
+ rendering_stats_instrumentation_->AddPaint(
+ duration,
+ content_rect.width() * content_rect.height());
+
canvas->restore();
gfx::RectF opaque_content_rect = gfx::ScaleRect(

Powered by Google App Engine
This is Rietveld 408576698