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";
16 const char kPaintLayer
[] = "PaintLayer";
17 const char kRasterTask
[] = "RasterTask";
20 struct ScopedPaintLayer
{
21 explicit ScopedPaintLayer(int layer_id
) {
22 TRACE_EVENT_BEGIN1(internal::kCategory
, internal::kPaintLayer
,
23 internal::kLayerId
, layer_id
);
26 TRACE_EVENT_END0(internal::kCategory
, internal::kPaintLayer
);
29 DISALLOW_COPY_AND_ASSIGN(ScopedPaintLayer
);
32 struct ScopedRasterTask
{
33 explicit ScopedRasterTask(int layer_id
) {
34 TRACE_EVENT_BEGIN1(internal::kCategory
, internal::kRasterTask
,
35 internal::kLayerId
, layer_id
);
38 TRACE_EVENT_END0(internal::kCategory
, internal::kRasterTask
);
41 DISALLOW_COPY_AND_ASSIGN(ScopedRasterTask
);
44 struct ScopedLayerObjectTracker
45 : public base::debug::TraceScopedTrackableObject
<int> {
46 explicit ScopedLayerObjectTracker(int layer_id
)
47 : base::debug::TraceScopedTrackableObject
<int>(
53 DISALLOW_COPY_AND_ASSIGN(ScopedLayerObjectTracker
);
56 } // namespace devtools_instrumentation
59 #endif // CC_DEBUG_DEVTOOLS_INSTRUMENTATION_H_