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 |