cc: Added inline to Tile::IsReadyToDraw
[chromium-blink-merge.git] / cc / debug / devtools_instrumentation.h
blob7a77d404454c01b10e7d567a5f978f63c56880ad
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";
19 const char kPaintLayer[] = "PaintLayer";
20 const char kRasterTask[] = "RasterTask";
21 const char kImageDecodeTask[] = "ImageDecodeTask";
22 const char kPaintSetup[] = "PaintSetup";
23 const char kUpdateLayer[] = "UpdateLayer";
25 class ScopedLayerTask {
26 public:
27 ScopedLayerTask(const char* event_name, int layer_id)
28 : event_name_(event_name) {
29 TRACE_EVENT_BEGIN1(internal::kCategory, event_name_,
30 internal::kLayerId, layer_id);
32 ~ScopedLayerTask() {
33 TRACE_EVENT_END0(internal::kCategory, event_name_);
35 private:
36 const char* event_name_;
38 DISALLOW_COPY_AND_ASSIGN(ScopedLayerTask);
41 class ScopedLayerTreeTask {
42 public:
43 ScopedLayerTreeTask(const char* event_name,
44 int layer_id,
45 uint64 tree_id)
46 : event_name_(event_name) {
47 TRACE_EVENT_BEGIN2(internal::kCategory, event_name_,
48 internal::kLayerId, layer_id, internal::kLayerTreeId, tree_id);
50 ~ScopedLayerTreeTask() {
51 TRACE_EVENT_END0(internal::kCategory, event_name_);
53 private:
54 const char* event_name_;
56 DISALLOW_COPY_AND_ASSIGN(ScopedLayerTreeTask);
59 struct ScopedLayerObjectTracker
60 : public base::debug::TraceScopedTrackableObject<int> {
61 explicit ScopedLayerObjectTracker(int layer_id)
62 : base::debug::TraceScopedTrackableObject<int>(
63 internal::kCategory,
64 internal::kLayerId,
65 layer_id) {
68 private:
69 DISALLOW_COPY_AND_ASSIGN(ScopedLayerObjectTracker);
72 } // namespace devtools_instrumentation
73 } // namespace cc
75 #endif // CC_DEBUG_DEVTOOLS_INSTRUMENTATION_H_