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

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: remove duplicate test entries (error from rebase) 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
« no previous file with comments | « src/core/SkTraceEvent.h ('k') | tests/TracingTest.cpp » ('j') | 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..e00c3e318d7ed70ffac30fb8e57e3118fc09e3f3
--- /dev/null
+++ b/src/utils/SkEventTracer.cpp
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * 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"
+
+class SkDefaultEventTracer: public SkEventTracer {
+ virtual SkEventTracer::Handle
+ addTraceEvent(char phase,
+ const uint8_t* categoryEnabledFlag,
+ const char* name,
+ uint64_t id,
+ int numArgs,
+ const char** argNames,
+ const uint8_t* argTypes,
+ const uint64_t* argValues,
+ uint8_t flags) SK_OVERRIDE { return 0; }
+
+ virtual void
+ updateTraceEventDuration(const uint8_t* categoryEnabledFlag,
+ const char* name,
+ SkEventTracer::Handle) SK_OVERRIDE {};
+
+ virtual const uint8_t* getCategoryGroupEnabled(const char* name) SK_OVERRIDE {
+ static uint8_t no = 0;
+ return &no;
+ };
+ virtual const char* getCategoryGroupName(
+ const uint8_t* category_group_enabled) SK_OVERRIDE {
+ static const char* dummy = "dummy";
+ return dummy;
+ };
+};
+
+SkEventTracer *SkEventTracer::gInstance;
+
+static void intiailize_default_tracer(int) {
+ SkEventTracer::SetInstance(SkNEW(SkDefaultEventTracer));
+}
+
+static void cleanup_tracer() {
+ // calling SetInstance will delete the existing instance.
+ SkEventTracer::SetInstance(NULL);
+}
+
+SkEventTracer* SkEventTracer::GetInstance() {
+ SK_DECLARE_STATIC_ONCE(once);
+ SkOnce(&once, intiailize_default_tracer, 0, cleanup_tracer);
+ SkASSERT(NULL != SkEventTracer::gInstance);
+ return SkEventTracer::gInstance;
+}
« no previous file with comments | « src/core/SkTraceEvent.h ('k') | tests/TracingTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698