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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ppapi/c/dev/ppb_trace_event_dev.h"
6 #include "ppapi/thunk/enter.h"
7 #include "ppapi/thunk/ppb_instance_api.h"
8 #include "ppapi/thunk/thunk.h"
9
10 namespace ppapi {
11 namespace thunk {
12
13 namespace {
14
15 void* GetCategoryEnabled(PP_Instance instance, const char* category_name) {
16 EnterInstance enter(instance);
17 if (enter.succeeded())
18 return enter.functions()->GetCategoryEnabled(instance, category_name);
19 return NULL;
20 }
21
22 int32_t AddTraceEvent(PP_Instance instance,
23 int8_t phase,
24 const void* category_enabled,
25 const char* name,
26 uint64_t id,
27 uint32_t num_args,
28 const char* arg_names[],
29 const uint8_t arg_types[],
30 const uint64_t arg_values[],
31 int32_t threshold_begin_id,
32 int64_t threshold,
33 uint8_t flags) {
34 EnterInstance enter(instance);
35 if (enter.succeeded())
36 return enter.functions()->AddTraceEvent(instance,
37 phase,
38 category_enabled,
39 name,
40 id,
41 num_args,
42 arg_names,
43 arg_types,
44 arg_values,
45 threshold_begin_id,
46 threshold,
47 flags);
48 return -1;
49 }
50
51 void SetThreadName(PP_Instance instance, const char* thread_name) {
52 EnterInstance enter(instance);
53 if (enter.succeeded())
54 enter.functions()->SetThreadName(instance, thread_name);
55 }
56
57 const PPB_Trace_Event_Dev g_ppb_trace_event_thunk = {
58 &GetCategoryEnabled,
59 &AddTraceEvent,
60 &SetThreadName,
61 };
62
63 } // namespace
64
65 const PPB_Trace_Event_Dev_0_1* GetPPB_Trace_Event_Dev_0_1_Thunk() {
66 return &g_ppb_trace_event_thunk;
67 }
68
69 } // namespace thunk
70 } // namespace ppapi
OLDNEW
« 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