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 #include "cc/debug/frame_viewer_instrumentation.h"
8 namespace frame_viewer_instrumentation
{
11 const char kCategory
[] = "cc," TRACE_DISABLED_BY_DEFAULT("devtools.timeline");
12 const char kTileData
[] = "tileData";
13 const char kLayerId
[] = "layerId";
14 const char kTileId
[] = "tileId";
15 const char kTileResolution
[] = "tileResolution";
16 const char kSourceFrameNumber
[] = "sourceFrameNumber";
18 const char kAnalyzeTask
[] = "AnalyzeTask";
19 const char kRasterTask
[] = "RasterTask";
21 scoped_refptr
<base::trace_event::ConvertableToTraceFormat
> TileDataAsValue(
23 TileResolution tile_resolution
,
24 int source_frame_number
,
26 scoped_refptr
<base::trace_event::TracedValue
> res(
27 new base::trace_event::TracedValue());
28 TracedValue::SetIDRef(tile_id
, res
.get(), kTileId
);
29 res
->SetString(kTileResolution
, TileResolutionToString(tile_resolution
));
30 res
->SetInteger(kSourceFrameNumber
, source_frame_number
);
31 res
->SetInteger(kLayerId
, layer_id
);
37 ScopedAnalyzeTask::ScopedAnalyzeTask(const void* tile_id
,
38 TileResolution tile_resolution
,
39 int source_frame_number
,
42 kCategory
, kAnalyzeTask
, kTileData
,
43 TileDataAsValue(tile_id
, tile_resolution
, source_frame_number
, layer_id
));
46 ScopedAnalyzeTask::~ScopedAnalyzeTask() {
47 TRACE_EVENT_END0(kCategory
, kAnalyzeTask
);
50 ScopedRasterTask::ScopedRasterTask(const void* tile_id
,
51 TileResolution tile_resolution
,
52 int source_frame_number
,
55 kCategory
, kRasterTask
, kTileData
,
56 TileDataAsValue(tile_id
, tile_resolution
, source_frame_number
, layer_id
));
59 ScopedRasterTask::~ScopedRasterTask() {
60 TRACE_EVENT_END0(kCategory
, kRasterTask
);
63 } // namespace frame_viewer_instrumentation