OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CC_DEBUG_DEVTOOLS_INSTRUMENTATION_H_ | 5 #ifndef CC_DEBUG_DEVTOOLS_INSTRUMENTATION_H_ |
6 #define CC_DEBUG_DEVTOOLS_INSTRUMENTATION_H_ | 6 #define CC_DEBUG_DEVTOOLS_INSTRUMENTATION_H_ |
7 | 7 |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 | 9 |
10 namespace cc { | 10 namespace cc { |
11 namespace devtools_instrumentation { | 11 namespace devtools_instrumentation { |
12 | 12 |
13 namespace internal { | 13 namespace internal { |
14 const char kCategory[] = "cc,devtools"; | 14 const char kCategory[] = "cc,devtools"; |
15 const char kLayerId[] = "layerId"; | 15 const char kLayerId[] = "layerId"; |
16 const char kPaintLayer[] = "PaintLayer"; | 16 const char kPaintLayer[] = "PaintLayer"; |
17 const char kRasterTask[] = "RasterTask"; | 17 const char kRasterTask[] = "RasterTask"; |
18 } | 18 } |
19 | 19 |
20 struct ScopedPaintLayer { | 20 struct ScopedPaintLayer { |
21 ScopedPaintLayer(int layer_id) { | 21 explicit ScopedPaintLayer(int layer_id) { |
22 TRACE_EVENT_BEGIN1(internal::kCategory, internal::kPaintLayer, | 22 TRACE_EVENT_BEGIN1(internal::kCategory, internal::kPaintLayer, |
23 internal::kLayerId, layer_id); | 23 internal::kLayerId, layer_id); |
24 } | 24 } |
25 ~ScopedPaintLayer() { | 25 ~ScopedPaintLayer() { |
26 TRACE_EVENT_END0(internal::kCategory, internal::kPaintLayer); | 26 TRACE_EVENT_END0(internal::kCategory, internal::kPaintLayer); |
27 } | 27 } |
28 | 28 |
29 DISALLOW_COPY_AND_ASSIGN(ScopedPaintLayer); | 29 DISALLOW_COPY_AND_ASSIGN(ScopedPaintLayer); |
30 }; | 30 }; |
31 | 31 |
32 struct ScopedRasterTask { | 32 struct ScopedRasterTask { |
33 ScopedRasterTask(int layer_id) { | 33 explicit ScopedRasterTask(int layer_id) { |
34 TRACE_EVENT_BEGIN1(internal::kCategory, internal::kRasterTask, | 34 TRACE_EVENT_BEGIN1(internal::kCategory, internal::kRasterTask, |
35 internal::kLayerId, layer_id); | 35 internal::kLayerId, layer_id); |
36 } | 36 } |
37 ~ScopedRasterTask() { | 37 ~ScopedRasterTask() { |
38 TRACE_EVENT_END0(internal::kCategory, internal::kRasterTask); | 38 TRACE_EVENT_END0(internal::kCategory, internal::kRasterTask); |
39 } | 39 } |
40 | 40 |
41 DISALLOW_COPY_AND_ASSIGN(ScopedRasterTask); | 41 DISALLOW_COPY_AND_ASSIGN(ScopedRasterTask); |
42 }; | 42 }; |
43 | 43 |
44 struct ScopedLayerObjectTracker | 44 struct ScopedLayerObjectTracker |
45 : public base::debug::TraceScopedTrackableObject<int> { | 45 : public base::debug::TraceScopedTrackableObject<int> { |
46 ScopedLayerObjectTracker(int layer_id) | 46 explicit ScopedLayerObjectTracker(int layer_id) |
47 : base::debug::TraceScopedTrackableObject<int>( | 47 : base::debug::TraceScopedTrackableObject<int>( |
48 internal::kCategory, | 48 internal::kCategory, |
49 internal::kLayerId, | 49 internal::kLayerId, |
50 layer_id) { | 50 layer_id) { |
51 } | 51 } |
52 | 52 |
53 DISALLOW_COPY_AND_ASSIGN(ScopedLayerObjectTracker); | 53 DISALLOW_COPY_AND_ASSIGN(ScopedLayerObjectTracker); |
54 }; | 54 }; |
55 | 55 |
56 } // namespace devtools_instrumentation | 56 } // namespace devtools_instrumentation |
57 } // namespace cc | 57 } // namespace cc |
58 | 58 |
59 #endif // CC_DEBUG_DEVTOOLS_INSTRUMENTATION_H_ | 59 #endif // CC_DEBUG_DEVTOOLS_INSTRUMENTATION_H_ |
60 | 60 |
OLD | NEW |