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

Unified Diff: ppapi/cpp/dev/trace_event_dev.cc

Issue 12212198: Add C++ Trace Event support to PPAPI/NaCl SDK (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: brettw feedback Created 7 years, 10 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 | « ppapi/cpp/dev/trace_event_dev.h ('k') | ppapi/ppapi_cpp.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/cpp/dev/trace_event_dev.cc
diff --git a/ppapi/cpp/dev/trace_event_dev.cc b/ppapi/cpp/dev/trace_event_dev.cc
new file mode 100644
index 0000000000000000000000000000000000000000..ec3bbf2d59293c35fa067b2ed579918d09cd8f2d
--- /dev/null
+++ b/ppapi/cpp/dev/trace_event_dev.cc
@@ -0,0 +1,46 @@
+// Copyright (c) 2013 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 "ppapi/cpp/dev/trace_event_dev.h"
+
+#include "ppapi/c/dev/ppb_trace_event_dev.h"
+#include "ppapi/cpp/module.h"
+#include "ppapi/cpp/module_impl.h"
+
+namespace pp {
+
+namespace {
+
+template <> const char* interface_name<PPB_Trace_Event_Dev>() {
+ return PPB_TRACE_EVENT_DEV_INTERFACE_0_1;
+}
+
+} // namespace
+
+const unsigned char* Trace_Events::GetCategoryEnabled(
+ const char* category_name) {
+ // This casting is due to limitations in PPAPI. It is unable to return
+ // a const pointer, and all pointer return types are necessarily void*.
+ return reinterpret_cast<const unsigned char*>(
+ get_interface<PPB_Trace_Event_Dev>()->GetCategoryEnabled(category_name));
+}
+
+void Trace_Events::AddTraceEvent(int8_t phase,
+ const void* category_enabled,
+ const char* name,
+ uint64_t id,
+ uint32_t num_args,
+ const char* arg_names[],
+ const uint8_t arg_types[],
+ const uint64_t arg_values[],
+ uint8_t flags) {
+ get_interface<PPB_Trace_Event_Dev>()->AddTraceEvent(phase, category_enabled,
+ name, id, num_args, arg_names, arg_types, arg_values, flags);
+}
+
+void Trace_Events::SetThreadName(const char* thread_name) {
+ get_interface<PPB_Trace_Event_Dev>()->SetThreadName(thread_name);
+}
+
+} // namespace pp
« no previous file with comments | « ppapi/cpp/dev/trace_event_dev.h ('k') | ppapi/ppapi_cpp.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698