base: Use more specific CHECK macros for comparisons.
[chromium-blink-merge.git] / cc / debug / frame_viewer_instrumentation.cc
blob53c155166b8b3f5f21549d12e88e226945b606d8
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"
7 namespace cc {
8 namespace frame_viewer_instrumentation {
9 namespace {
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(
22 const void* tile_id,
23 TileResolution tile_resolution,
24 int source_frame_number,
25 int layer_id) {
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);
32 return res;
35 } // namespace
37 ScopedAnalyzeTask::ScopedAnalyzeTask(const void* tile_id,
38 TileResolution tile_resolution,
39 int source_frame_number,
40 int layer_id) {
41 TRACE_EVENT_BEGIN1(
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,
53 int layer_id) {
54 TRACE_EVENT_BEGIN1(
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
64 } // namespace cc