1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CC_DEBUG_DEVTOOLS_INSTRUMENTATION_H_
6 #define CC_DEBUG_DEVTOOLS_INSTRUMENTATION_H_
8 #include "base/debug/trace_event.h"
11 namespace devtools_instrumentation
{
14 const char kCategory
[] = "cc,devtools";
15 const char kLayerId
[] = "layerId";
18 const char kPaintLayer
[] = "PaintLayer";
19 const char kRasterTask
[] = "RasterTask";
20 const char kImageDecodeTask
[] = "ImageDecodeTask";
21 const char kPaintSetup
[] = "PaintSetup";
23 class ScopedLayerTask
{
25 explicit ScopedLayerTask(const char* event_name
, int layer_id
)
26 : event_name_(event_name
) {
27 TRACE_EVENT_BEGIN1(internal::kCategory
, event_name_
,
28 internal::kLayerId
, layer_id
);
31 TRACE_EVENT_END0(internal::kCategory
, event_name_
);
34 const char* event_name_
;
37 struct ScopedLayerObjectTracker
38 : public base::debug::TraceScopedTrackableObject
<int> {
39 explicit ScopedLayerObjectTracker(int layer_id
)
40 : base::debug::TraceScopedTrackableObject
<int>(
46 DISALLOW_COPY_AND_ASSIGN(ScopedLayerObjectTracker
);
49 } // namespace devtools_instrumentation
52 #endif // CC_DEBUG_DEVTOOLS_INSTRUMENTATION_H_