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

Unified Diff: content/renderer/render_widget.cc

Issue 10818038: Make GPU benchmarking numAnimationFrames and totalPaintTime work in software mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge. Created 8 years, 4 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 | « content/renderer/render_widget.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_widget.cc
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index 43543df6224229ca3f9aa340d8e2718ba5f6a11d..489a20f71d5f661dc21a36dbe8b6d88857a5e8fd 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -688,11 +688,19 @@ void RenderWidget::PaintRect(const gfx::Rect& rect,
// WebKit and filling the background (which can be slow) and just painting
// the plugin. Unlike the DoDeferredUpdate case, an extra copy is still
// required.
+ base::TimeTicks paint_begin_ticks = base::TimeTicks::Now();
optimized_instance->Paint(webkit_glue::ToWebCanvas(canvas),
optimized_copy_location, rect);
+ base::TimeDelta paint_time = base::TimeTicks::Now() - paint_begin_ticks;
+ if (!is_accelerated_compositing_active_)
+ software_stats_.totalPaintTimeInSeconds += paint_time.InSecondsF();
} else {
// Normal painting case.
+ base::TimeTicks paint_begin_ticks = base::TimeTicks::Now();
webwidget_->paint(webkit_glue::ToWebCanvas(canvas), rect);
+ base::TimeDelta paint_time = base::TimeTicks::Now() - paint_begin_ticks;
+ if (!is_accelerated_compositing_active_)
+ software_stats_.totalPaintTimeInSeconds += paint_time.InSecondsF();
// Flush to underlying bitmap. TODO(darin): is this needed?
skia::GetTopDevice(*canvas)->accessBitmap(false);
@@ -889,6 +897,11 @@ void RenderWidget::DoDeferredUpdate() {
}
last_do_deferred_update_time_ = frame_begin_ticks;
+ if (!is_accelerated_compositing_active_) {
+ software_stats_.numAnimationFrames++;
+ software_stats_.numFramesSentToScreen++;
+ }
+
// OK, save the pending update to a local since painting may cause more
// invalidation. Some WebCore rendering objects only layout when painted.
PaintAggregator::PendingUpdate update;
@@ -1769,6 +1782,13 @@ void RenderWidget::CleanupWindowInPluginMoves(gfx::PluginWindowHandle window) {
}
}
+void RenderWidget::GetRenderingStats(WebKit::WebRenderingStats& stats) const {
+ webwidget()->renderingStats(stats);
+ stats.numAnimationFrames += software_stats_.numAnimationFrames;
+ stats.numFramesSentToScreen += software_stats_.numFramesSentToScreen;
+ stats.totalPaintTimeInSeconds += software_stats_.totalPaintTimeInSeconds;
+}
+
void RenderWidget::BeginSmoothScroll(bool down, bool scroll_far) {
Send(new ViewHostMsg_BeginSmoothScroll(routing_id_, down, scroll_far));
}
« no previous file with comments | « content/renderer/render_widget.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698