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

Unified Diff: cc/trees/layer_tree_host.cc

Issue 12519006: cc:: Add RenderingStatsInstrumentation to manage collection of RenderingStats (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Updated all tests 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
« no previous file with comments | « cc/trees/layer_tree_host.h ('k') | cc/trees/layer_tree_host_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host.cc
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc
index dbad9ac5e119bacd07421b8d200869cc1e775aba..b023f8506fd6b56fd11dea3735ce4fca39bb83db 100644
--- a/cc/trees/layer_tree_host.cc
+++ b/cc/trees/layer_tree_host.cc
@@ -15,6 +15,7 @@
#include "cc/base/math_util.h"
#include "cc/base/thread.h"
#include "cc/debug/overdraw_metrics.h"
+#include "cc/debug/rendering_stats_instrumentation.h"
#include "cc/input/pinch_zoom_scrollbar.h"
#include "cc/input/pinch_zoom_scrollbar_geometry.h"
#include "cc/input/pinch_zoom_scrollbar_painter.h"
@@ -77,7 +78,7 @@ LayerTreeHost::LayerTreeHost(LayerTreeHostClient* client,
needs_filter_context_(false),
client_(client),
commit_number_(0),
- rendering_stats_(),
+ rendering_stats_instrumentation_(RenderingStatsInstrumentation::Create()),
renderer_initialized_(false),
output_surface_lost_(false),
num_failed_recreate_attempts_(0),
@@ -95,6 +96,9 @@ LayerTreeHost::LayerTreeHost(LayerTreeHostClient* client,
if (settings_.accelerated_animation_enabled)
animation_registrar_ = AnimationRegistrar::Create();
s_num_layer_tree_instances++;
+
+ rendering_stats_instrumentation_->set_record_rendering_stats(
+ debug_state_.RecordRenderingStats());
}
bool LayerTreeHost::Initialize(scoped_ptr<Thread> impl_thread) {
@@ -230,7 +234,7 @@ void LayerTreeHost::UpdateAnimations(base::TimeTicks frame_begin_time) {
AnimateLayers(frame_begin_time);
animating_ = false;
- rendering_stats_.numAnimationFrames++;
+ rendering_stats_instrumentation_->IncrementAnimationFrameCount();
}
void LayerTreeHost::DidStopFlinging() {
@@ -345,8 +349,12 @@ void LayerTreeHost::FinishCommitOnImplThread(LayerTreeHostImpl* host_impl) {
sync_tree->DidBecomeActive();
}
- if (debug_state_.continuous_painting)
- host_impl->SavePaintTime(rendering_stats_.totalPaintTime, commit_number());
+ if (debug_state_.continuous_painting) {
+ host_impl->SavePaintTime(
+ rendering_stats_instrumentation_->GetRenderingStats().totalPaintTime,
+ commit_number()
+ );
+ }
commit_number_++;
}
@@ -443,7 +451,10 @@ scoped_ptr<LayerTreeHostImpl> LayerTreeHost::CreateLayerTreeHostImpl(
LayerTreeHostImplClient* client) {
DCHECK(proxy_->IsImplThread());
scoped_ptr<LayerTreeHostImpl> host_impl =
- LayerTreeHostImpl::Create(settings_, client, proxy_.get());
+ LayerTreeHostImpl::Create(settings_,
+ client,
+ proxy_.get(),
+ rendering_stats_instrumentation_.get());
if (settings_.calculate_top_controls_position &&
host_impl->top_controls_manager()) {
top_controls_manager_weak_ptr_ =
@@ -482,8 +493,7 @@ void LayerTreeHost::DidDeferCommit() {}
void LayerTreeHost::CollectRenderingStats(RenderingStats* stats) const {
CHECK(debug_state_.RecordRenderingStats());
- *stats = rendering_stats_;
- proxy_->CollectRenderingStats(stats);
+ *stats = rendering_stats_instrumentation_->GetRenderingStats();
}
const RendererCapabilities& LayerTreeHost::GetRendererCapabilities() const {
@@ -557,6 +567,10 @@ void LayerTreeHost::SetDebugState(const LayerTreeDebugState& debug_state) {
return;
debug_state_ = new_debug_state;
+
+ rendering_stats_instrumentation_->set_record_rendering_stats(
+ debug_state_.RecordRenderingStats());
+
SetNeedsCommit();
}
@@ -796,15 +810,13 @@ size_t LayerTreeHost::CalculateMemoryForRenderSurfaces(
}
bool LayerTreeHost::PaintMasksForRenderSurface(Layer* render_surface_layer,
- ResourceUpdateQueue* queue) {
+ ResourceUpdateQueue* queue,
+ RenderingStats* stats) {
// Note: Masks and replicas only exist for layers that own render surfaces. If
// we reach this point in code, we already know that at least something will
// be drawn into this render surface, so the mask and replica should be
// painted.
- RenderingStats* stats =
- debug_state_.RecordRenderingStats() ? &rendering_stats_ : NULL;
-
bool need_more_updates = false;
Layer* mask_layer = render_surface_layer->mask_layer();
if (mask_layer) {
@@ -844,8 +856,10 @@ bool LayerTreeHost::PaintLayerContents(
PrioritizeTextures(render_surface_layer_list,
occlusion_tracker.overdraw_metrics());
- RenderingStats* stats = debug_state_.RecordRenderingStats() ?
- &rendering_stats_ : NULL;
+ // TODO(egraether): Use RenderingStatsInstrumentation in Layer::update()
+ RenderingStats stats;
+ RenderingStats* stats_ptr =
+ debug_state_.RecordRenderingStats() ? &stats : NULL;
LayerIteratorType end = LayerIteratorType::End(&render_surface_layer_list);
for (LayerIteratorType it =
@@ -857,16 +871,18 @@ bool LayerTreeHost::PaintLayerContents(
if (it.represents_target_render_surface()) {
DCHECK(it->render_surface()->draw_opacity() ||
it->render_surface()->draw_opacity_is_animating());
- need_more_updates |= PaintMasksForRenderSurface(*it, queue);
+ need_more_updates |= PaintMasksForRenderSurface(*it, queue, stats_ptr);
} else if (it.represents_itself()) {
DCHECK(!it->bounds().IsEmpty());
- it->Update(queue, &occlusion_tracker, stats);
+ it->Update(queue, &occlusion_tracker, stats_ptr);
need_more_updates |= it->NeedMoreUpdates();
}
occlusion_tracker.LeaveLayer(it);
}
+ rendering_stats_instrumentation_->AddStats(stats);
+
occlusion_tracker.overdraw_metrics()->RecordMetrics(this);
return need_more_updates;
« no previous file with comments | « cc/trees/layer_tree_host.h ('k') | cc/trees/layer_tree_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698