summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cc/debug/devtools_instrumentation.h25
-rw-r--r--cc/scheduler/scheduler.cc7
-rw-r--r--cc/scheduler/scheduler.h10
-rw-r--r--cc/scheduler/scheduler_unittest.cc2
-rw-r--r--cc/test/fake_layer_tree_host_impl.cc6
-rw-r--r--cc/test/layer_tree_test.cc3
-rw-r--r--cc/trees/layer_tree_host.cc18
-rw-r--r--cc/trees/layer_tree_host.h4
-rw-r--r--cc/trees/layer_tree_host_impl.cc14
-rw-r--r--cc/trees/layer_tree_host_impl.h7
-rw-r--r--cc/trees/layer_tree_host_impl_unittest.cc11
-rw-r--r--cc/trees/thread_proxy.cc7
-rw-r--r--cc/trees/thread_proxy.h2
-rw-r--r--cc/trees/tree_synchronizer_unittest.cc6
14 files changed, 80 insertions, 42 deletions
diff --git a/cc/debug/devtools_instrumentation.h b/cc/debug/devtools_instrumentation.h
index eea9e62..f44dd84 100644
--- a/cc/debug/devtools_instrumentation.h
+++ b/cc/debug/devtools_instrumentation.h
@@ -12,12 +12,15 @@ namespace devtools_instrumentation {
namespace internal {
const char kCategory[] = "cc,devtools";
+const char kFrameId[] = "frameId";
const char kLayerId[] = "layerId";
const char kLayerTreeId[] = "layerTreeId";
const char kPixelRefId[] = "pixelRefId";
const char kImageDecodeTask[] = "ImageDecodeTask";
-}
+const char kBeginFrame[] = "BeginFrame";
+const char kActivateLayerTree[] = "ActivateLayerTree";
+} // namespace internal
const char kPaintLayer[] = "PaintLayer";
const char kRasterTask[] = "RasterTask";
@@ -57,10 +60,11 @@ class ScopedLayerTreeTask {
public:
ScopedLayerTreeTask(const char* event_name,
int layer_id,
- uint64 tree_id)
+ int layer_tree_host_id)
: event_name_(event_name) {
TRACE_EVENT_BEGIN2(internal::kCategory, event_name_,
- internal::kLayerId, layer_id, internal::kLayerTreeId, tree_id);
+ internal::kLayerId, layer_id,
+ internal::kLayerTreeId, layer_tree_host_id);
}
~ScopedLayerTreeTask() {
TRACE_EVENT_END0(internal::kCategory, event_name_);
@@ -84,6 +88,21 @@ struct ScopedLayerObjectTracker
DISALLOW_COPY_AND_ASSIGN(ScopedLayerObjectTracker);
};
+inline void didActivateLayerTree(int layer_tree_host_id, int frame_id) {
+ TRACE_EVENT_INSTANT2(internal::kCategory,
+ internal::kActivateLayerTree,
+ TRACE_EVENT_SCOPE_THREAD,
+ internal::kLayerTreeId, layer_tree_host_id,
+ internal::kFrameId, frame_id);
+}
+
+inline void didBeginFrame(int layer_tree_host_id) {
+ TRACE_EVENT_INSTANT1(internal::kCategory,
+ internal::kBeginFrame,
+ TRACE_EVENT_SCOPE_THREAD,
+ internal::kLayerTreeId, layer_tree_host_id);
+}
+
} // namespace devtools_instrumentation
} // namespace cc
diff --git a/cc/scheduler/scheduler.cc b/cc/scheduler/scheduler.cc
index 0c577b9..e33c0a8 100644
--- a/cc/scheduler/scheduler.cc
+++ b/cc/scheduler/scheduler.cc
@@ -8,15 +8,18 @@
#include "base/auto_reset.h"
#include "base/debug/trace_event.h"
#include "base/logging.h"
+#include "cc/debug/devtools_instrumentation.h"
#include "cc/debug/traced_value.h"
#include "ui/gfx/frame_time.h"
namespace cc {
Scheduler::Scheduler(SchedulerClient* client,
- const SchedulerSettings& scheduler_settings)
+ const SchedulerSettings& scheduler_settings,
+ int layer_tree_host_id)
: settings_(scheduler_settings),
client_(client),
+ layer_tree_host_id_(layer_tree_host_id),
last_set_needs_begin_impl_frame_(false),
state_machine_(scheduler_settings),
inside_process_scheduled_actions_(false),
@@ -216,7 +219,7 @@ void Scheduler::BeginImplFrame(const BeginFrameArgs& args) {
return;
state_machine_.OnBeginImplFrameDeadlinePending();
-
+ devtools_instrumentation::didBeginFrame(layer_tree_host_id_);
if (settings_.using_synchronous_renderer_compositor) {
// The synchronous renderer compositor has to make its GL calls
// within this call to BeginImplFrame.
diff --git a/cc/scheduler/scheduler.h b/cc/scheduler/scheduler.h
index da7cc9d..9209782 100644
--- a/cc/scheduler/scheduler.h
+++ b/cc/scheduler/scheduler.h
@@ -60,8 +60,10 @@ class CC_EXPORT Scheduler {
public:
static scoped_ptr<Scheduler> Create(
SchedulerClient* client,
- const SchedulerSettings& scheduler_settings) {
- return make_scoped_ptr(new Scheduler(client, scheduler_settings));
+ const SchedulerSettings& scheduler_settings,
+ int layer_tree_host_id) {
+ return make_scoped_ptr(
+ new Scheduler(client, scheduler_settings, layer_tree_host_id));
}
virtual ~Scheduler();
@@ -127,7 +129,8 @@ class CC_EXPORT Scheduler {
private:
Scheduler(SchedulerClient* client,
- const SchedulerSettings& scheduler_settings);
+ const SchedulerSettings& scheduler_settings,
+ int layer_tree_host_id);
void PostBeginImplFrameDeadline(base::TimeTicks deadline);
void SetupNextBeginImplFrameIfNeeded();
@@ -142,6 +145,7 @@ class CC_EXPORT Scheduler {
const SchedulerSettings settings_;
SchedulerClient* client_;
+ int layer_tree_host_id_;
bool last_set_needs_begin_impl_frame_;
BeginFrameArgs last_begin_impl_frame_args_;
diff --git a/cc/scheduler/scheduler_unittest.cc b/cc/scheduler/scheduler_unittest.cc
index ef023b8..2b35731 100644
--- a/cc/scheduler/scheduler_unittest.cc
+++ b/cc/scheduler/scheduler_unittest.cc
@@ -61,7 +61,7 @@ class FakeSchedulerClient : public SchedulerClient {
}
Scheduler* CreateScheduler(const SchedulerSettings& settings) {
- scheduler_ = Scheduler::Create(this, settings);
+ scheduler_ = Scheduler::Create(this, settings, 0);
return scheduler_.get();
}
diff --git a/cc/test/fake_layer_tree_host_impl.cc b/cc/test/fake_layer_tree_host_impl.cc
index 258617b..1050f48 100644
--- a/cc/test/fake_layer_tree_host_impl.cc
+++ b/cc/test/fake_layer_tree_host_impl.cc
@@ -12,7 +12,8 @@ FakeLayerTreeHostImpl::FakeLayerTreeHostImpl(Proxy* proxy)
&client_,
proxy,
&stats_instrumentation_,
- NULL) {
+ NULL,
+ 0) {
// Explicitly clear all debug settings.
SetDebugState(LayerTreeDebugState());
}
@@ -23,7 +24,8 @@ FakeLayerTreeHostImpl::FakeLayerTreeHostImpl(const LayerTreeSettings& settings,
&client_,
proxy,
&stats_instrumentation_,
- NULL) {
+ NULL,
+ 0) {
// Explicitly clear all debug settings.
SetDebugState(LayerTreeDebugState());
}
diff --git a/cc/test/layer_tree_test.cc b/cc/test/layer_tree_test.cc
index de0b907..b723c56 100644
--- a/cc/test/layer_tree_test.cc
+++ b/cc/test/layer_tree_test.cc
@@ -72,7 +72,8 @@ class LayerTreeHostImplForTesting : public LayerTreeHostImpl {
host_impl_client,
proxy,
stats_instrumentation,
- NULL),
+ NULL,
+ 0),
test_hooks_(test_hooks),
block_notify_ready_to_activate_for_testing_(false),
notify_ready_to_activate_was_blocked_(false) {}
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc
index b5c368b..c1e1d4b 100644
--- a/cc/trees/layer_tree_host.cc
+++ b/cc/trees/layer_tree_host.cc
@@ -8,15 +8,14 @@
#include <stack>
#include <string>
+#include "base/atomic_sequence_num.h"
#include "base/bind.h"
#include "base/command_line.h"
#include "base/debug/trace_event.h"
-#include "base/lazy_instance.h"
#include "base/message_loop/message_loop.h"
#include "base/metrics/histogram.h"
#include "base/stl_util.h"
#include "base/strings/string_number_conversions.h"
-#include "base/synchronization/lock.h"
#include "cc/animation/animation_registrar.h"
#include "cc/animation/layer_animation_controller.h"
#include "cc/base/math_util.h"
@@ -43,14 +42,7 @@
#include "ui/gfx/size_conversions.h"
namespace {
-static base::LazyInstance<base::Lock>::Leaky
- s_next_tree_id_lock = LAZY_INSTANCE_INITIALIZER;
-
-inline int GetNextTreeId() {
- static int s_next_tree_id = 1;
- base::AutoLock lock(s_next_tree_id_lock.Get());
- return s_next_tree_id++;
-}
+static base::StaticAtomicSequenceNumber s_layer_tree_host_sequence_number;
}
namespace cc {
@@ -125,7 +117,7 @@ LayerTreeHost::LayerTreeHost(
partial_texture_update_requests_(0),
in_paint_layer_contents_(false),
total_frames_used_for_lcd_text_metrics_(0),
- tree_id_(GetNextTreeId()),
+ id_(s_layer_tree_host_sequence_number.GetNext() + 1),
next_commit_forces_redraw_(false),
shared_bitmap_manager_(manager) {
if (settings_.accelerated_animation_enabled)
@@ -423,6 +415,7 @@ void LayerTreeHost::FinishCommitOnImplThread(LayerTreeHostImpl* host_impl) {
// If we're not in impl-side painting, the tree is immediately
// considered active.
sync_tree->DidBecomeActive();
+ devtools_instrumentation::didActivateLayerTree(id_, source_frame_number_);
}
micro_benchmark_controller_.ScheduleImplBenchmarks(host_impl);
@@ -463,7 +456,8 @@ scoped_ptr<LayerTreeHostImpl> LayerTreeHost::CreateLayerTreeHostImpl(
client,
proxy_.get(),
rendering_stats_instrumentation_.get(),
- shared_bitmap_manager_);
+ shared_bitmap_manager_,
+ id_);
shared_bitmap_manager_ = NULL;
if (settings_.calculate_top_controls_position &&
host_impl->top_controls_manager()) {
diff --git a/cc/trees/layer_tree_host.h b/cc/trees/layer_tree_host.h
index adc559f..53ec30e 100644
--- a/cc/trees/layer_tree_host.h
+++ b/cc/trees/layer_tree_host.h
@@ -279,7 +279,7 @@ class CC_EXPORT LayerTreeHost {
virtual gfx::Size GetUIResourceSize(UIResourceId id) const;
bool UsingSharedMemoryResources();
- int id() const { return tree_id_; }
+ int id() const { return id_; }
bool ScheduleMicroBenchmark(const std::string& benchmark_name,
scoped_ptr<base::Value> value,
@@ -427,7 +427,7 @@ class CC_EXPORT LayerTreeHost {
int64 total_num_cc_layers_will_use_lcd_text;
};
LCDTextMetrics lcd_text_metrics_;
- int tree_id_;
+ int id_;
bool next_commit_forces_redraw_;
scoped_refptr<Layer> page_scale_layer_;
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index 3ab5385..33820ae 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -20,6 +20,7 @@
#include "cc/base/util.h"
#include "cc/debug/benchmark_instrumentation.h"
#include "cc/debug/debug_rect_history.h"
+#include "cc/debug/devtools_instrumentation.h"
#include "cc/debug/frame_rate_counter.h"
#include "cc/debug/overdraw_metrics.h"
#include "cc/debug/paint_time_counter.h"
@@ -207,9 +208,10 @@ scoped_ptr<LayerTreeHostImpl> LayerTreeHostImpl::Create(
LayerTreeHostImplClient* client,
Proxy* proxy,
RenderingStatsInstrumentation* rendering_stats_instrumentation,
- SharedBitmapManager* manager) {
+ SharedBitmapManager* manager,
+ int id) {
return make_scoped_ptr(new LayerTreeHostImpl(
- settings, client, proxy, rendering_stats_instrumentation, manager));
+ settings, client, proxy, rendering_stats_instrumentation, manager, id));
}
LayerTreeHostImpl::LayerTreeHostImpl(
@@ -217,7 +219,8 @@ LayerTreeHostImpl::LayerTreeHostImpl(
LayerTreeHostImplClient* client,
Proxy* proxy,
RenderingStatsInstrumentation* rendering_stats_instrumentation,
- SharedBitmapManager* manager)
+ SharedBitmapManager* manager,
+ int id)
: client_(client),
proxy_(proxy),
input_handler_client_(NULL),
@@ -258,7 +261,8 @@ LayerTreeHostImpl::LayerTreeHostImpl(
#ifndef NDEBUG
did_lose_called_(false),
#endif
- shared_bitmap_manager_(manager) {
+ shared_bitmap_manager_(manager),
+ id_(id) {
DCHECK(proxy_->IsImplThread());
DidVisibilityChange(this, visible_);
@@ -1583,6 +1587,8 @@ void LayerTreeHostImpl::ActivatePendingTree() {
if (time_source_client_adapter_ && time_source_client_adapter_->Active())
DCHECK(active_tree_->root_layer());
+ devtools_instrumentation::didActivateLayerTree(id_,
+ active_tree_->source_frame_number());
}
void LayerTreeHostImpl::SetVisible(bool visible) {
diff --git a/cc/trees/layer_tree_host_impl.h b/cc/trees/layer_tree_host_impl.h
index 3d9f1e9..d3ed318 100644
--- a/cc/trees/layer_tree_host_impl.h
+++ b/cc/trees/layer_tree_host_impl.h
@@ -104,7 +104,8 @@ class CC_EXPORT LayerTreeHostImpl
LayerTreeHostImplClient* client,
Proxy* proxy,
RenderingStatsInstrumentation* rendering_stats_instrumentation,
- SharedBitmapManager* manager);
+ SharedBitmapManager* manager,
+ int id);
virtual ~LayerTreeHostImpl();
// InputHandler implementation
@@ -423,7 +424,8 @@ class CC_EXPORT LayerTreeHostImpl
LayerTreeHostImplClient* client,
Proxy* proxy,
RenderingStatsInstrumentation* rendering_stats_instrumentation,
- SharedBitmapManager* manager);
+ SharedBitmapManager* manager,
+ int id);
// Virtual for testing.
virtual void AnimateLayers(base::TimeTicks monotonic_time,
@@ -637,6 +639,7 @@ class CC_EXPORT LayerTreeHostImpl
base::Closure tree_activation_callback_;
SharedBitmapManager* shared_bitmap_manager_;
+ int id_;
DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl);
};
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
index e8bd22a1..c3d0b19 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -155,7 +155,7 @@ class LayerTreeHostImplTest : public testing::Test,
bool CreateHostImpl(const LayerTreeSettings& settings,
scoped_ptr<OutputSurface> output_surface) {
host_impl_ = LayerTreeHostImpl::Create(
- settings, this, &proxy_, &stats_instrumentation_, NULL);
+ settings, this, &proxy_, &stats_instrumentation_, NULL, 0);
bool init = host_impl_->InitializeRenderer(output_surface.Pass());
host_impl_->SetViewportSize(gfx::Size(10, 10));
return init;
@@ -1128,7 +1128,8 @@ class LayerTreeHostImplOverridePhysicalTime : public LayerTreeHostImpl {
client,
proxy,
rendering_stats_instrumentation,
- NULL) {}
+ NULL,
+ 0) {}
virtual base::TimeTicks CurrentPhysicalTimeTicks() const OVERRIDE {
return fake_current_physical_time_;
@@ -3414,7 +3415,7 @@ TEST_F(LayerTreeHostImplTest, PartialSwapReceivesDamageRect) {
settings.partial_swap_enabled = true;
scoped_ptr<LayerTreeHostImpl> layer_tree_host_impl =
LayerTreeHostImpl::Create(
- settings, this, &proxy_, &stats_instrumentation_, NULL);
+ settings, this, &proxy_, &stats_instrumentation_, NULL, 0);
layer_tree_host_impl->InitializeRenderer(output_surface.Pass());
layer_tree_host_impl->SetViewportSize(gfx::Size(500, 500));
@@ -3718,7 +3719,7 @@ static scoped_ptr<LayerTreeHostImpl> SetupLayersForOpacity(
LayerTreeSettings settings;
settings.partial_swap_enabled = partial_swap;
scoped_ptr<LayerTreeHostImpl> my_host_impl = LayerTreeHostImpl::Create(
- settings, client, proxy, stats_instrumentation, NULL);
+ settings, client, proxy, stats_instrumentation, NULL, 0);
my_host_impl->InitializeRenderer(output_surface.Pass());
my_host_impl->SetViewportSize(gfx::Size(100, 100));
@@ -5051,7 +5052,7 @@ TEST_F(LayerTreeHostImplTestDeferredInitialize, Fails_OffscreenContext) {
TEST_F(LayerTreeHostImplTest, DefaultMemoryAllocation) {
LayerTreeSettings settings;
host_impl_ = LayerTreeHostImpl::Create(
- settings, this, &proxy_, &stats_instrumentation_, NULL);
+ settings, this, &proxy_, &stats_instrumentation_, NULL, 0);
scoped_ptr<OutputSurface> output_surface(
FakeOutputSurface::Create3d(TestWebGraphicsContext3D::Create()));
diff --git a/cc/trees/thread_proxy.cc b/cc/trees/thread_proxy.cc
index c4b164c..8958004 100644
--- a/cc/trees/thread_proxy.cc
+++ b/cc/trees/thread_proxy.cc
@@ -12,6 +12,7 @@
#include "base/metrics/histogram.h"
#include "cc/base/swap_promise.h"
#include "cc/debug/benchmark_instrumentation.h"
+#include "cc/debug/devtools_instrumentation.h"
#include "cc/input/input_handler.h"
#include "cc/output/context_provider.h"
#include "cc/output/output_surface.h"
@@ -113,7 +114,8 @@ ThreadProxy::ThreadProxy(
begin_main_frame_to_commit_duration_history_(kDurationHistorySize),
commit_to_activate_duration_history_(kDurationHistorySize),
weak_factory_on_impl_thread_(this),
- weak_factory_(this) {
+ weak_factory_(this),
+ layer_tree_host_id_(layer_tree_host->id()) {
TRACE_EVENT0("cc", "ThreadProxy::ThreadProxy");
DCHECK(IsMainThread());
DCHECK(this->layer_tree_host());
@@ -1406,7 +1408,8 @@ void ThreadProxy::InitializeImplOnImplThread(CompletionEvent* completion) {
settings.using_synchronous_renderer_compositor;
scheduler_settings.throttle_frame_production =
settings.throttle_frame_production;
- scheduler_on_impl_thread_ = Scheduler::Create(this, scheduler_settings);
+ scheduler_on_impl_thread_ = Scheduler::Create(this, scheduler_settings,
+ layer_tree_host_id_);
scheduler_on_impl_thread_->SetVisible(layer_tree_host_impl_->visible());
impl_thread_weak_ptr_ = weak_factory_on_impl_thread_.GetWeakPtr();
diff --git a/cc/trees/thread_proxy.h b/cc/trees/thread_proxy.h
index 196c7a8..1e226b2 100644
--- a/cc/trees/thread_proxy.h
+++ b/cc/trees/thread_proxy.h
@@ -289,6 +289,8 @@ class ThreadProxy : public Proxy,
base::WeakPtrFactory<ThreadProxy> weak_factory_on_impl_thread_;
base::WeakPtrFactory<ThreadProxy> weak_factory_;
+ const int layer_tree_host_id_;
+
DISALLOW_COPY_AND_ASSIGN(ThreadProxy);
};
diff --git a/cc/trees/tree_synchronizer_unittest.cc b/cc/trees/tree_synchronizer_unittest.cc
index 3910bc0..827c366 100644
--- a/cc/trees/tree_synchronizer_unittest.cc
+++ b/cc/trees/tree_synchronizer_unittest.cc
@@ -553,7 +553,7 @@ TEST_F(TreeSynchronizerTest, SynchronizeAnimations) {
DebugScopedSetImplThread impl(&proxy);
FakeRenderingStatsInstrumentation stats_instrumentation;
scoped_ptr<LayerTreeHostImpl> host_impl = LayerTreeHostImpl::Create(
- settings, NULL, &proxy, &stats_instrumentation, NULL);
+ settings, NULL, &proxy, &stats_instrumentation, NULL, 0);
scoped_refptr<Layer> layer_tree_root = Layer::Create();
host_->SetRootLayer(layer_tree_root);
@@ -585,7 +585,7 @@ TEST_F(TreeSynchronizerTest, SynchronizeScrollParent) {
DebugScopedSetImplThread impl(&proxy);
FakeRenderingStatsInstrumentation stats_instrumentation;
scoped_ptr<LayerTreeHostImpl> host_impl = LayerTreeHostImpl::Create(
- settings, NULL, &proxy, &stats_instrumentation, NULL);
+ settings, NULL, &proxy, &stats_instrumentation, NULL, 0);
scoped_refptr<Layer> layer_tree_root = Layer::Create();
scoped_refptr<Layer> scroll_parent = Layer::Create();
@@ -660,7 +660,7 @@ TEST_F(TreeSynchronizerTest, SynchronizeClipParent) {
DebugScopedSetImplThread impl(&proxy);
FakeRenderingStatsInstrumentation stats_instrumentation;
scoped_ptr<LayerTreeHostImpl> host_impl = LayerTreeHostImpl::Create(
- settings, NULL, &proxy, &stats_instrumentation, NULL);
+ settings, NULL, &proxy, &stats_instrumentation, NULL, 0);
scoped_refptr<Layer> layer_tree_root = Layer::Create();
scoped_refptr<Layer> clip_parent = Layer::Create();