| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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_FRAME_VIEWER_INSTRUMENTATION_H_ | 5 #ifndef CC_DEBUG_FRAME_VIEWER_INSTRUMENTATION_H_ |
| 6 #define CC_DEBUG_FRAME_VIEWER_INSTRUMENTATION_H_ | 6 #define CC_DEBUG_FRAME_VIEWER_INSTRUMENTATION_H_ |
| 7 | 7 |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "cc/resources/tile.h" | 9 #include "cc/resources/tile.h" |
| 10 | 10 |
| 11 namespace cc { | 11 namespace cc { |
| 12 namespace frame_viewer_instrumentation { | 12 namespace frame_viewer_instrumentation { |
| 13 namespace internal { | 13 namespace internal { |
| 14 | 14 |
| 15 const char kCategory[] = "cc"; | 15 const char kCategory[] = "cc"; |
| 16 const char kTileData[] = "tileData"; | 16 const char kTileData[] = "tileData"; |
| 17 const char kLayerId[] = "layerId"; | 17 const char kLayerId[] = "layerId"; |
| 18 const char kTileId[] = "tileId"; | 18 const char kTileId[] = "tileId"; |
| 19 const char kTileResolution[] = "tileResolution"; | 19 const char kTileResolution[] = "tileResolution"; |
| 20 const char kSourceFrameNumber[] = "sourceFrameNumber"; | 20 const char kSourceFrameNumber[] = "sourceFrameNumber"; |
| 21 const char kRasterMode[] = "rasterMode"; | |
| 22 | 21 |
| 23 const char kAnalyzeTask[] = "AnalyzeTask"; | 22 const char kAnalyzeTask[] = "AnalyzeTask"; |
| 24 const char kRasterTask[] = "RasterTask"; | 23 const char kRasterTask[] = "RasterTask"; |
| 25 | 24 |
| 26 scoped_refptr<base::debug::ConvertableToTraceFormat> TileDataAsValue( | 25 scoped_refptr<base::debug::ConvertableToTraceFormat> TileDataAsValue( |
| 27 const void* tile_id, | 26 const void* tile_id, |
| 28 TileResolution tile_resolution, | 27 TileResolution tile_resolution, |
| 29 int source_frame_number, | 28 int source_frame_number, |
| 30 int layer_id) { | 29 int layer_id) { |
| 31 scoped_refptr<base::debug::TracedValue> res(new base::debug::TracedValue()); | 30 scoped_refptr<base::debug::TracedValue> res(new base::debug::TracedValue()); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 58 | 57 |
| 59 private: | 58 private: |
| 60 DISALLOW_COPY_AND_ASSIGN(ScopedAnalyzeTask); | 59 DISALLOW_COPY_AND_ASSIGN(ScopedAnalyzeTask); |
| 61 }; | 60 }; |
| 62 | 61 |
| 63 class ScopedRasterTask { | 62 class ScopedRasterTask { |
| 64 public: | 63 public: |
| 65 ScopedRasterTask(const void* tile_id, | 64 ScopedRasterTask(const void* tile_id, |
| 66 TileResolution tile_resolution, | 65 TileResolution tile_resolution, |
| 67 int source_frame_number, | 66 int source_frame_number, |
| 68 int layer_id, | 67 int layer_id) { |
| 69 RasterMode raster_mode) { | 68 TRACE_EVENT_BEGIN1( |
| 70 TRACE_EVENT_BEGIN2( | |
| 71 internal::kCategory, | 69 internal::kCategory, |
| 72 internal::kRasterTask, | 70 internal::kRasterTask, |
| 73 internal::kTileData, | 71 internal::kTileData, |
| 74 internal::TileDataAsValue( | 72 internal::TileDataAsValue( |
| 75 tile_id, tile_resolution, source_frame_number, layer_id), | 73 tile_id, tile_resolution, source_frame_number, layer_id)); |
| 76 internal::kRasterMode, | |
| 77 RasterModeToString(raster_mode)); | |
| 78 } | 74 } |
| 79 ~ScopedRasterTask() { | 75 ~ScopedRasterTask() { |
| 80 TRACE_EVENT_END0(internal::kCategory, internal::kRasterTask); | 76 TRACE_EVENT_END0(internal::kCategory, internal::kRasterTask); |
| 81 } | 77 } |
| 82 | 78 |
| 83 private: | 79 private: |
| 84 DISALLOW_COPY_AND_ASSIGN(ScopedRasterTask); | 80 DISALLOW_COPY_AND_ASSIGN(ScopedRasterTask); |
| 85 }; | 81 }; |
| 86 | 82 |
| 87 } // namespace frame_viewer_instrumentation | 83 } // namespace frame_viewer_instrumentation |
| 88 } // namespace cc | 84 } // namespace cc |
| 89 | 85 |
| 90 #endif // CC_DEBUG_FRAME_VIEWER_INSTRUMENTATION_H_ | 86 #endif // CC_DEBUG_FRAME_VIEWER_INSTRUMENTATION_H_ |
| OLD | NEW |