Run WebGL conformance tests on Android GPU bot
[chromium-blink-merge.git] / cc / debug / devtools_instrumentation.h
blobeea9e62f02aa0881e0e9ae1ee7a909f9c139f198
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"
10 namespace cc {
11 namespace devtools_instrumentation {
13 namespace internal {
14 const char kCategory[] = "cc,devtools";
15 const char kLayerId[] = "layerId";
16 const char kLayerTreeId[] = "layerTreeId";
17 const char kPixelRefId[] = "pixelRefId";
19 const char kImageDecodeTask[] = "ImageDecodeTask";
22 const char kPaintLayer[] = "PaintLayer";
23 const char kRasterTask[] = "RasterTask";
24 const char kPaintSetup[] = "PaintSetup";
25 const char kUpdateLayer[] = "UpdateLayer";
27 class ScopedLayerTask {
28 public:
29 ScopedLayerTask(const char* event_name, int layer_id)
30 : event_name_(event_name) {
31 TRACE_EVENT_BEGIN1(internal::kCategory, event_name_,
32 internal::kLayerId, layer_id);
34 ~ScopedLayerTask() {
35 TRACE_EVENT_END0(internal::kCategory, event_name_);
37 private:
38 const char* event_name_;
40 DISALLOW_COPY_AND_ASSIGN(ScopedLayerTask);
43 class ScopedImageDecodeTask {
44 public:
45 explicit ScopedImageDecodeTask(void* pixelRef) {
46 TRACE_EVENT_BEGIN1(internal::kCategory, internal::kImageDecodeTask,
47 internal::kPixelRefId, reinterpret_cast<uint64>(pixelRef));
49 ~ScopedImageDecodeTask() {
50 TRACE_EVENT_END0(internal::kCategory, internal::kImageDecodeTask);
52 private:
53 DISALLOW_COPY_AND_ASSIGN(ScopedImageDecodeTask);
56 class ScopedLayerTreeTask {
57 public:
58 ScopedLayerTreeTask(const char* event_name,
59 int layer_id,
60 uint64 tree_id)
61 : event_name_(event_name) {
62 TRACE_EVENT_BEGIN2(internal::kCategory, event_name_,
63 internal::kLayerId, layer_id, internal::kLayerTreeId, tree_id);
65 ~ScopedLayerTreeTask() {
66 TRACE_EVENT_END0(internal::kCategory, event_name_);
68 private:
69 const char* event_name_;
71 DISALLOW_COPY_AND_ASSIGN(ScopedLayerTreeTask);
74 struct ScopedLayerObjectTracker
75 : public base::debug::TraceScopedTrackableObject<int> {
76 explicit ScopedLayerObjectTracker(int layer_id)
77 : base::debug::TraceScopedTrackableObject<int>(
78 internal::kCategory,
79 internal::kLayerId,
80 layer_id) {
83 private:
84 DISALLOW_COPY_AND_ASSIGN(ScopedLayerObjectTracker);
87 } // namespace devtools_instrumentation
88 } // namespace cc
90 #endif // CC_DEBUG_DEVTOOLS_INSTRUMENTATION_H_