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 @@
namespace cc {
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 {
const char kCategory[] = "cc," TRACE_DISABLED_BY_DEFAULT("devtools.timeline");
......@@ -60,5 +66,11 @@ ScopedRasterTask::~ScopedRasterTask() {
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 cc
......@@ -11,6 +11,8 @@
namespace cc {
namespace frame_viewer_instrumentation {
extern const char kCategoryLayerTree[];
class ScopedAnalyzeTask {
public:
ScopedAnalyzeTask(const void* tile_id,
......@@ -35,6 +37,8 @@ class ScopedRasterTask {
DISALLOW_COPY_AND_ASSIGN(ScopedRasterTask);
};
bool IsTracingLayerTreeSnapshots();
} // namespace frame_viewer_instrumentation
} // namespace cc
......
......@@ -18,6 +18,7 @@
#include "cc/animation/keyframed_animation_curve.h"
#include "cc/animation/layer_animation_controller.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_impl.h"
#include "cc/layers/scrollbar_layer_interface.h"
......@@ -897,12 +898,7 @@ void Layer::PushPropertiesTo(LayerImpl* layer) {
layer->SetContentBounds(content_bounds());
layer->SetContentsScale(contents_scale_x(), contents_scale_y());
bool is_tracing;
TRACE_EVENT_CATEGORY_GROUP_ENABLED(
TRACE_DISABLED_BY_DEFAULT("cc.debug") "," TRACE_DISABLED_BY_DEFAULT(
"devtools.timeline.layers"),
&is_tracing);
if (is_tracing)
if (frame_viewer_instrumentation::IsTracingLayerTreeSnapshots())
layer->SetDebugInfo(TakeDebugInfo());
layer->SetDoubleSided(double_sided_);
......@@ -1354,4 +1350,12 @@ void Layer::SetFrameTimingRequests(
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
......@@ -526,6 +526,8 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>,
// Sets new frame timing requests for this layer.
void SetFrameTimingRequests(const std::vector<FrameTimingRequest>& requests);
void DidBeginTracing();
protected:
friend class LayerImpl;
friend class TreeSynchronizer;
......
......@@ -21,6 +21,7 @@
#include "cc/animation/layer_animation_controller.h"
#include "cc/base/math_util.h"
#include "cc/debug/devtools_instrumentation.h"
#include "cc/debug/frame_viewer_instrumentation.h"
#include "cc/debug/rendering_stats_instrumentation.h"
#include "cc/input/layer_selection_bound.h"
#include "cc/input/page_scale_animation.h"
......@@ -268,6 +269,15 @@ void LayerTreeHost::FinishCommitOnImplThread(LayerTreeHostImpl* host_impl) {
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();
if (next_commit_forces_redraw_) {
......
......@@ -24,6 +24,7 @@
#include "cc/debug/debug_rect_history.h"
#include "cc/debug/devtools_instrumentation.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/rendering_stats_instrumentation.h"
#include "cc/debug/traced_value.h"
......@@ -1528,12 +1529,8 @@ void LayerTreeHostImpl::DrawLayers(FrameData* frame,
{
TRACE_EVENT0("cc", "DrawLayers.FrameViewerTracing");
TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(
TRACE_DISABLED_BY_DEFAULT("cc.debug") ","
TRACE_DISABLED_BY_DEFAULT("cc.debug.quads") ","
TRACE_DISABLED_BY_DEFAULT("devtools.timeline.layers"),
"cc::LayerTreeHostImpl",
id_,
AsValueWithFrame(frame));
frame_viewer_instrumentation::kCategoryLayerTree,
"cc::LayerTreeHostImpl", id_, AsValueWithFrame(frame));
}
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