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

Unified Diff: src/utils/SkEventTracer.cpp

Issue 149563004: initial import of Chrome's trace_event into skia framework (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Some cleanups from Mike 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
« src/core/SkTraceEvent.h ('K') | « src/core/SkTraceEvent.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/utils/SkEventTracer.cpp
diff --git a/src/utils/SkEventTracer.cpp b/src/utils/SkEventTracer.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..1155ed06da8a0f4b6195c2f8efd3a6182e6a860e
--- /dev/null
+++ b/src/utils/SkEventTracer.cpp
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2013 Google Inc.
mtklein 2014/01/29 20:57:55 I bet you can bump this to 2014 now.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "SkEventTracer.h"
+#include "SkOnce.h"
+
+namespace skia {
+namespace tracing {
+
+class SkDefaultEventTracer: public SkEventTracer {
+ virtual TraceEventHandle
mtklein 2014/01/29 20:57:55 Doesn't hurt to tack on SK_OVERRIDE to these. You
+ AddTraceEvent(char phase,
+ const unsigned char* categoryEnabledFlag,
+ const char* name,
+ unsigned long long id,
+ int numArgs,
+ const char** argNames,
+ const unsigned char* argTypes,
+ const unsigned long long* argValues,
+ unsigned char flags) { return 0; }
+
+ virtual void
+ UpdateTraceEventDuration(const unsigned char* categoryEnabledFlag,
+ const char* name,
+ tracing::TraceEventHandle) {};
+
+ virtual const unsigned char* GetCategoryGroupEnabled(const char* name) {
+ static unsigned char no = 1;
+ return &no;
+ };
+ virtual const char* GetCategoryGroupName(
+ const unsigned char* category_group_enabled) {
+ static const char* dummy = "dummy";
+ return dummy;
+ };
+};
+
+SkEventTracer *SkEventTracer::_instance;
+
+static void intiailize_default_tracer(void**) {
mtklein 2014/01/29 20:57:55 If you're not going to use the argument, we usuall
+ SkEventTracer::SetInstance(SkNEW(SkDefaultEventTracer));
+}
+
+SkEventTracer *SkEventTracer::GetInstance() {
mtklein 2014/01/29 20:57:55 We almost always put the * on the left.
+ SK_DECLARE_STATIC_ONCE(once);
+ SkOnce(&once, intiailize_default_tracer, (void **) NULL);
+ SkASSERT(NULL != SkEventTracer::_instance);
+ return SkEventTracer::_instance;
+}
+
+}
mtklein 2014/01/29 20:57:55 If you keep the namespaces, can you add } // nam
+}
« src/core/SkTraceEvent.h ('K') | « src/core/SkTraceEvent.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698