Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1125)

Unified Diff: cc/debug/frame_viewer_instrumentation.cc

Issue 816543004: Update from https://crrev.com/308996 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/debug/frame_viewer_instrumentation.h ('k') | cc/input/scroll_elasticity_helper.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/debug/frame_viewer_instrumentation.cc
diff --git a/cc/debug/frame_viewer_instrumentation.cc b/cc/debug/frame_viewer_instrumentation.cc
new file mode 100644
index 0000000000000000000000000000000000000000..bd0fbdc59ec69227d8542d23d1274625118e14f9
--- /dev/null
+++ b/cc/debug/frame_viewer_instrumentation.cc
@@ -0,0 +1,63 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "cc/debug/frame_viewer_instrumentation.h"
+
+namespace cc {
+namespace frame_viewer_instrumentation {
+namespace {
+
+const char kCategory[] = "cc," TRACE_DISABLED_BY_DEFAULT("devtools.timeline");
+const char kTileData[] = "tileData";
+const char kLayerId[] = "layerId";
+const char kTileId[] = "tileId";
+const char kTileResolution[] = "tileResolution";
+const char kSourceFrameNumber[] = "sourceFrameNumber";
+
+const char kAnalyzeTask[] = "AnalyzeTask";
+const char kRasterTask[] = "RasterTask";
+
+scoped_refptr<base::debug::ConvertableToTraceFormat> TileDataAsValue(
+ const void* tile_id,
+ TileResolution tile_resolution,
+ int source_frame_number,
+ int layer_id) {
+ scoped_refptr<base::debug::TracedValue> res(new base::debug::TracedValue());
+ TracedValue::SetIDRef(tile_id, res.get(), kTileId);
+ res->SetString(kTileResolution, TileResolutionToString(tile_resolution));
+ res->SetInteger(kSourceFrameNumber, source_frame_number);
+ res->SetInteger(kLayerId, layer_id);
+ return res;
+}
+
+} // namespace
+
+ScopedAnalyzeTask::ScopedAnalyzeTask(const void* tile_id,
+ TileResolution tile_resolution,
+ int source_frame_number,
+ int layer_id) {
+ TRACE_EVENT_BEGIN1(
+ kCategory, kAnalyzeTask, kTileData,
+ TileDataAsValue(tile_id, tile_resolution, source_frame_number, layer_id));
+}
+
+ScopedAnalyzeTask::~ScopedAnalyzeTask() {
+ TRACE_EVENT_END0(kCategory, kAnalyzeTask);
+}
+
+ScopedRasterTask::ScopedRasterTask(const void* tile_id,
+ TileResolution tile_resolution,
+ int source_frame_number,
+ int layer_id) {
+ TRACE_EVENT_BEGIN1(
+ kCategory, kRasterTask, kTileData,
+ TileDataAsValue(tile_id, tile_resolution, source_frame_number, layer_id));
+}
+
+ScopedRasterTask::~ScopedRasterTask() {
+ TRACE_EVENT_END0(kCategory, kRasterTask);
+}
+
+} // namespace frame_viewer_instrumentation
+} // namespace cc
« no previous file with comments | « cc/debug/frame_viewer_instrumentation.h ('k') | cc/input/scroll_elasticity_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698