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

Side by Side 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: 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2013 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/cpp/dev/trace_event_dev.h"
6
7 #include "ppapi/c/dev/ppb_trace_event_dev.h"
8 #include "ppapi/cpp/module.h"
9 #include "ppapi/cpp/module_impl.h"
10
11 namespace pp {
12
13 namespace {
14
15 template <> const char* interface_name<PPB_Trace_Event_Dev>() {
16 return PPB_TRACE_EVENT_DEV_INTERFACE_0_1;
17 }
18
19 } // namespace
20
21 namespace trace_events {
22
23 const unsigned char* GetCategoryEnabled(const char* category_name) {
24 // This casting is due to limitations in PPAPI. It is unable to return
25 // a const pointer, and all pointer return types are necessarily void*.
26 return reinterpret_cast<const unsigned char*>(
27 get_interface<PPB_Trace_Event_Dev>()->GetCategoryEnabled(category_name));
28 }
29
30 void AddTraceEvent(char phase,
31 const unsigned char* category_enabled,
32 const char* name,
33 unsigned long long id,
34 int num_args,
35 const char** arg_names,
36 const unsigned char* arg_types,
37 const uint64_t* arg_values,
38 unsigned char flags) {
39 // This casting is due to limitations in PPAPI. 'in' parameters of type mem_t
40 // in the IDL are always const void*.
41 get_interface<PPB_Trace_Event_Dev>()->AddTraceEvent(phase,
42 reinterpret_cast<const void*>(category_enabled), name, id, num_args,
43 arg_names, arg_types, arg_values, flags);
44 }
45
46 void SetThreadName(const char* thread_name) {
47 get_interface<PPB_Trace_Event_Dev>()->SetThreadName(thread_name);
48 }
49
50
51 } // namespace trace_events
52
53 } // namespace pp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698