Commit 4a4b5584 authored by caseq's avatar caseq Committed by Commit bot

CC: Force push properties for all layers when tracing is started

... provided categories that cause layer tree snapshots to be traced
are enabled. We need this so that we can show owner nodes for layers
that were not updated on the main thread side for a while.

BUG=

Review URL: https://codereview.chromium.org/924973003

Cr-Commit-Position: refs/heads/master@{#320947}
parent e2db68ee
...@@ -6,6 +6,12 @@ ...@@ -6,6 +6,12 @@
namespace cc { namespace cc {
namespace frame_viewer_instrumentation { namespace frame_viewer_instrumentation {
const char kCategoryLayerTree[] =
TRACE_DISABLED_BY_DEFAULT("cc.debug") ","
TRACE_DISABLED_BY_DEFAULT("cc.debug.quads") ","
TRACE_DISABLED_BY_DEFAULT("devtools.timeline.layers");
namespace { namespace {
const char kCategory[] = "cc," TRACE_DISABLED_BY_DEFAULT("devtools.timeline"); const char kCategory[] = "cc," TRACE_DISABLED_BY_DEFAULT("devtools.timeline");
...@@ -60,5 +66,11 @@ ScopedRasterTask::~ScopedRasterTask() { ...@@ -60,5 +66,11 @@ ScopedRasterTask::~ScopedRasterTask() {
TRACE_EVENT_END0(kCategory, kRasterTask); TRACE_EVENT_END0(kCategory, kRasterTask);
} }
bool IsTracingLayerTreeSnapshots() {
bool category_enabled;
TRACE_EVENT_CATEGORY_GROUP_ENABLED(kCategoryLayerTree, &category_enabled);
return category_enabled;
}
} // namespace frame_viewer_instrumentation } // namespace frame_viewer_instrumentation
} // namespace cc } // namespace cc
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
namespace cc { namespace cc {
namespace frame_viewer_instrumentation { namespace frame_viewer_instrumentation {
extern const char kCategoryLayerTree[];
class ScopedAnalyzeTask { class ScopedAnalyzeTask {
public: public:
ScopedAnalyzeTask(const void* tile_id, ScopedAnalyzeTask(const void* tile_id,
...@@ -35,6 +37,8 @@ class ScopedRasterTask { ...@@ -35,6 +37,8 @@ class ScopedRasterTask {
DISALLOW_COPY_AND_ASSIGN(ScopedRasterTask); DISALLOW_COPY_AND_ASSIGN(ScopedRasterTask);
}; };
bool IsTracingLayerTreeSnapshots();
} // namespace frame_viewer_instrumentation } // namespace frame_viewer_instrumentation
} // namespace cc } // namespace cc
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "cc/animation/keyframed_animation_curve.h" #include "cc/animation/keyframed_animation_curve.h"
#include "cc/animation/layer_animation_controller.h" #include "cc/animation/layer_animation_controller.h"
#include "cc/base/simple_enclosed_region.h" #include "cc/base/simple_enclosed_region.h"
#include "cc/debug/frame_viewer_instrumentation.h"
#include "cc/layers/layer_client.h" #include "cc/layers/layer_client.h"
#include "cc/layers/layer_impl.h" #include "cc/layers/layer_impl.h"
#include "cc/layers/scrollbar_layer_interface.h" #include "cc/layers/scrollbar_layer_interface.h"
...@@ -897,12 +898,7 @@ void Layer::PushPropertiesTo(LayerImpl* layer) { ...@@ -897,12 +898,7 @@ void Layer::PushPropertiesTo(LayerImpl* layer) {
layer->SetContentBounds(content_bounds()); layer->SetContentBounds(content_bounds());
layer->SetContentsScale(contents_scale_x(), contents_scale_y()); layer->SetContentsScale(contents_scale_x(), contents_scale_y());
bool is_tracing; if (frame_viewer_instrumentation::IsTracingLayerTreeSnapshots())
TRACE_EVENT_CATEGORY_GROUP_ENABLED(
TRACE_DISABLED_BY_DEFAULT("cc.debug") "," TRACE_DISABLED_BY_DEFAULT(
"devtools.timeline.layers"),
&is_tracing);
if (is_tracing)
layer->SetDebugInfo(TakeDebugInfo()); layer->SetDebugInfo(TakeDebugInfo());
layer->SetDoubleSided(double_sided_); layer->SetDoubleSided(double_sided_);
...@@ -1354,4 +1350,12 @@ void Layer::SetFrameTimingRequests( ...@@ -1354,4 +1350,12 @@ void Layer::SetFrameTimingRequests(
SetNeedsCommit(); SetNeedsCommit();
} }
void Layer::DidBeginTracing() {
// We'll be dumping layer trees as part of trace, so make sure
// PushPropertiesTo() propagates layer debug info to the impl
// side -- otherwise this won't happen for the the layers that
// remain unchanged since tracing started.
SetNeedsPushProperties();
}
} // namespace cc } // namespace cc
...@@ -526,6 +526,8 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>, ...@@ -526,6 +526,8 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>,
// Sets new frame timing requests for this layer. // Sets new frame timing requests for this layer.
void SetFrameTimingRequests(const std::vector<FrameTimingRequest>& requests); void SetFrameTimingRequests(const std::vector<FrameTimingRequest>& requests);
void DidBeginTracing();
protected: protected:
friend class LayerImpl; friend class LayerImpl;
friend class TreeSynchronizer; friend class TreeSynchronizer;
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "cc/animation/layer_animation_controller.h" #include "cc/animation/layer_animation_controller.h"
#include "cc/base/math_util.h" #include "cc/base/math_util.h"
#include "cc/debug/devtools_instrumentation.h" #include "cc/debug/devtools_instrumentation.h"
#include "cc/debug/frame_viewer_instrumentation.h"
#include "cc/debug/rendering_stats_instrumentation.h" #include "cc/debug/rendering_stats_instrumentation.h"
#include "cc/input/layer_selection_bound.h" #include "cc/input/layer_selection_bound.h"
#include "cc/input/page_scale_animation.h" #include "cc/input/page_scale_animation.h"
...@@ -268,6 +269,15 @@ void LayerTreeHost::FinishCommitOnImplThread(LayerTreeHostImpl* host_impl) { ...@@ -268,6 +269,15 @@ void LayerTreeHost::FinishCommitOnImplThread(LayerTreeHostImpl* host_impl) {
contents_texture_manager_->ReduceMemory(host_impl->resource_provider()); contents_texture_manager_->ReduceMemory(host_impl->resource_provider());
} }
bool is_new_trace;
TRACE_EVENT_IS_NEW_TRACE(&is_new_trace);
if (is_new_trace &&
frame_viewer_instrumentation::IsTracingLayerTreeSnapshots() &&
root_layer()) {
LayerTreeHostCommon::CallFunctionForSubtree(
root_layer(), [](Layer* layer) { layer->DidBeginTracing(); });
}
LayerTreeImpl* sync_tree = host_impl->sync_tree(); LayerTreeImpl* sync_tree = host_impl->sync_tree();
if (next_commit_forces_redraw_) { if (next_commit_forces_redraw_) {
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "cc/debug/debug_rect_history.h" #include "cc/debug/debug_rect_history.h"
#include "cc/debug/devtools_instrumentation.h" #include "cc/debug/devtools_instrumentation.h"
#include "cc/debug/frame_rate_counter.h" #include "cc/debug/frame_rate_counter.h"
#include "cc/debug/frame_viewer_instrumentation.h"
#include "cc/debug/paint_time_counter.h" #include "cc/debug/paint_time_counter.h"
#include "cc/debug/rendering_stats_instrumentation.h" #include "cc/debug/rendering_stats_instrumentation.h"
#include "cc/debug/traced_value.h" #include "cc/debug/traced_value.h"
...@@ -1528,12 +1529,8 @@ void LayerTreeHostImpl::DrawLayers(FrameData* frame, ...@@ -1528,12 +1529,8 @@ void LayerTreeHostImpl::DrawLayers(FrameData* frame,
{ {
TRACE_EVENT0("cc", "DrawLayers.FrameViewerTracing"); TRACE_EVENT0("cc", "DrawLayers.FrameViewerTracing");
TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID( TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(
TRACE_DISABLED_BY_DEFAULT("cc.debug") "," frame_viewer_instrumentation::kCategoryLayerTree,
TRACE_DISABLED_BY_DEFAULT("cc.debug.quads") "," "cc::LayerTreeHostImpl", id_, AsValueWithFrame(frame));
TRACE_DISABLED_BY_DEFAULT("devtools.timeline.layers"),
"cc::LayerTreeHostImpl",
id_,
AsValueWithFrame(frame));
} }
const DrawMode draw_mode = GetDrawMode(); const DrawMode draw_mode = GetDrawMode();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment