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

Unified Diff: ppapi/thunk/ppb_trace_event_thunk.cc

Issue 11464005: Add trace event Pepper API (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Enable NaCl compilation Created 8 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
« ppapi/shared_impl/ppb_instance_shared.cc ('K') | « ppapi/thunk/ppb_instance_api.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/thunk/ppb_trace_event_thunk.cc
diff --git a/ppapi/thunk/ppb_trace_event_thunk.cc b/ppapi/thunk/ppb_trace_event_thunk.cc
new file mode 100644
index 0000000000000000000000000000000000000000..52f49bc2cd081362e7614a23b55e01cc3e634069
--- /dev/null
+++ b/ppapi/thunk/ppb_trace_event_thunk.cc
@@ -0,0 +1,70 @@
+// Copyright (c) 2012 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/c/dev/ppb_trace_event_dev.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+void* GetCategoryEnabled(PP_Instance instance, const char* category_name) {
+ EnterInstance enter(instance);
+ if (enter.succeeded())
+ return enter.functions()->GetCategoryEnabled(instance, category_name);
+ return NULL;
+}
+
+int32_t AddTraceEvent(PP_Instance instance,
+ 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[],
+ int32_t threshold_begin_id,
+ int64_t threshold,
+ uint8_t flags) {
+ EnterInstance enter(instance);
+ if (enter.succeeded())
+ return enter.functions()->AddTraceEvent(instance,
+ phase,
+ category_enabled,
+ name,
+ id,
+ num_args,
+ arg_names,
+ arg_types,
+ arg_values,
+ threshold_begin_id,
+ threshold,
+ flags);
+ return -1;
+}
+
+void SetThreadName(PP_Instance instance, const char* thread_name) {
+ EnterInstance enter(instance);
+ if (enter.succeeded())
+ enter.functions()->SetThreadName(instance, thread_name);
+}
+
+const PPB_Trace_Event_Dev g_ppb_trace_event_thunk = {
+ &GetCategoryEnabled,
+ &AddTraceEvent,
+ &SetThreadName,
+};
+
+} // namespace
+
+const PPB_Trace_Event_Dev_0_1* GetPPB_Trace_Event_Dev_0_1_Thunk() {
+ return &g_ppb_trace_event_thunk;
+}
+
+} // namespace thunk
+} // namespace ppapi
« ppapi/shared_impl/ppb_instance_shared.cc ('K') | « ppapi/thunk/ppb_instance_api.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698