mac: Don't limit GL_MAX_TEXTURE_SIZE on 10.9.0+.
[chromium-blink-merge.git] / cc / debug / frame_viewer_instrumentation.h
blobe0e54eb3cb801dc33ee1744e5545ba405327068b
1 // Copyright 2014 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_FRAME_VIEWER_INSTRUMENTATION_H_
6 #define CC_DEBUG_FRAME_VIEWER_INSTRUMENTATION_H_
8 #include "base/debug/trace_event.h"
9 #include "cc/resources/tile.h"
11 namespace cc {
12 namespace frame_viewer_instrumentation {
13 namespace internal {
15 const char kCategory[] = "cc";
16 const char kTileData[] = "tileData";
17 const char kLayerId[] = "layerId";
18 const char kTileId[] = "tileId";
19 const char kTileResolution[] = "tileResolution";
20 const char kSourceFrameNumber[] = "sourceFrameNumber";
22 const char kAnalyzeTask[] = "AnalyzeTask";
23 const char kRasterTask[] = "RasterTask";
25 scoped_refptr<base::debug::ConvertableToTraceFormat> TileDataAsValue(
26 const void* tile_id,
27 TileResolution tile_resolution,
28 int source_frame_number,
29 int layer_id) {
30 scoped_refptr<base::debug::TracedValue> res(new base::debug::TracedValue());
31 TracedValue::SetIDRef(tile_id, res.get(), internal::kTileId);
32 res->SetString(internal::kTileResolution,
33 TileResolutionToString(tile_resolution));
34 res->SetInteger(internal::kSourceFrameNumber, source_frame_number);
35 res->SetInteger(internal::kLayerId, layer_id);
36 return res;
39 } // namespace internal
41 class ScopedAnalyzeTask {
42 public:
43 ScopedAnalyzeTask(const void* tile_id,
44 TileResolution tile_resolution,
45 int source_frame_number,
46 int layer_id) {
47 TRACE_EVENT_BEGIN1(
48 internal::kCategory,
49 internal::kAnalyzeTask,
50 internal::kTileData,
51 internal::TileDataAsValue(
52 tile_id, tile_resolution, source_frame_number, layer_id));
54 ~ScopedAnalyzeTask() {
55 TRACE_EVENT_END0(internal::kCategory, internal::kAnalyzeTask);
58 private:
59 DISALLOW_COPY_AND_ASSIGN(ScopedAnalyzeTask);
62 class ScopedRasterTask {
63 public:
64 ScopedRasterTask(const void* tile_id,
65 TileResolution tile_resolution,
66 int source_frame_number,
67 int layer_id) {
68 TRACE_EVENT_BEGIN1(
69 internal::kCategory,
70 internal::kRasterTask,
71 internal::kTileData,
72 internal::TileDataAsValue(
73 tile_id, tile_resolution, source_frame_number, layer_id));
75 ~ScopedRasterTask() {
76 TRACE_EVENT_END0(internal::kCategory, internal::kRasterTask);
79 private:
80 DISALLOW_COPY_AND_ASSIGN(ScopedRasterTask);
83 } // namespace frame_viewer_instrumentation
84 } // namespace cc
86 #endif // CC_DEBUG_FRAME_VIEWER_INSTRUMENTATION_H_