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

Unified Diff: skia/ext/trace_event.cc

Issue 153063002: plumbing for skia trace events into Chrome's about://tracing framework (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 11 months 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
Index: skia/ext/trace_event.cc
diff --git a/skia/ext/trace_event.cc b/skia/ext/trace_event.cc
new file mode 100644
index 0000000000000000000000000000000000000000..cd57e9404889c122239071785b88f379c565e86f
--- /dev/null
+++ b/skia/ext/trace_event.cc
@@ -0,0 +1,52 @@
+// Copyright (c) 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 "base/debug/trace_event.h"
+#include "skia/ext/trace_event.h"
+#include "third_party/skia/include/core/SkDevice.h"
+
+namespace skia {
+
+const uint8_t*
+ SkChromiumEventTracer::getCategoryGroupEnabled(const char* name) {
+ return TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(name);
+}
+
+const char* SkChromiumEventTracer::getCategoryGroupName(
+ const uint8_t* categoryEnabledFlag) {
+ return base::debug::TraceLog::GetCategoryGroupName(
+ categoryEnabledFlag);
+}
+
+SkEventTracer::Handle
+ SkChromiumEventTracer::addTraceEvent(char phase,
+ const uint8_t* categoryEnabledFlag,
+ const char* name,
+ uint64_t id,
+ int32_t numArgs,
+ const char** argNames,
+ const uint8_t* argTypes,
+ const uint64_t* argValues,
+ uint8_t flags) {
+ base::debug::TraceEventHandle handle = TRACE_EVENT_API_ADD_TRACE_EVENT(
+ phase, categoryEnabledFlag, name, id, numArgs, argNames,
+ argTypes, (const long long unsigned int*) argValues, NULL, flags);
+ SkEventTracer::Handle result;
+ memcpy(&result, &handle, sizeof(result));
+ return result;
+}
+
+void
+ SkChromiumEventTracer::updateTraceEventDuration(
+ const uint8_t* categoryEnabledFlag,
+ const char *name,
+ SkEventTracer::Handle handle) {
+ base::debug::TraceEventHandle traceEventHandle;
+ memcpy(&traceEventHandle, &handle, sizeof(handle));
+ TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(
+ categoryEnabledFlag, name, traceEventHandle);
+}
+
+} // namespace skia
+
« skia/ext/trace_event.h ('K') | « skia/ext/trace_event.h ('k') | skia/skia_chrome.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698