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

Side by Side Diff: ppapi/shared_impl/ppb_trace_event_shared.cc

Issue 11464005: Add trace event Pepper API (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Feedback 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/shared_impl/ppb_trace_event_shared.h"
6
7 #include "base/debug/trace_event.h"
8
9 namespace ppapi {
10
11 // PPB_Trace_Events is a shared implementation because Trace Events can be sent
12 // from either the plugin process or renderer process depending on whether the
13 // plugin is in- or out-of-process. Also, for NaCl plugins these functions will
14 // be executed from untrusted code and handled appropriately by tracing
15 // functionality in the IRT.
16 void* PPB_Trace_Event_Shared::GetCategoryEnabled(const char* category_name) {
brettw 2012/12/19 22:29:25 These should have "static" comments.
elijahtaylor1 2012/12/21 00:59:16 Done.
17 // This casting is here because all mem_t return types in Pepper are void* and
18 // non-const. All mem_t parameters are const void* so there is no way to
19 // return a pointer type to the caller without some const_cast. The pointer
20 // type the tracing system works with is normally unsigned char*.
21 return const_cast<void*>(reinterpret_cast<const void*>(
brettw 2012/12/19 22:29:25 reinterpret_cast -> I think you can static_cast po
elijahtaylor1 2012/12/21 00:59:16 Done.
22 base::debug::TraceLog::GetInstance()->GetCategoryEnabled(category_name)));
23 }
24
25 int32_t PPB_Trace_Event_Shared::AddTraceEvent(int8_t phase,
26 const void* category_enabled,
27 const char* name,
28 uint64_t id,
29 uint32_t num_args,
30 const char* arg_names[],
31 const uint8_t arg_types[],
32 const uint64_t arg_values[],
33 int32_t threshold_begin_id,
34 int64_t threshold,
35 uint8_t flags) {
36 return base::debug::TraceLog::GetInstance()->AddTraceEvent(phase,
37 (const unsigned char*)category_enabled, name, id, num_args, arg_names,
brettw 2012/12/19 22:29:25 C++ cast
elijahtaylor1 2012/12/21 00:59:16 Done.
38 arg_types, arg_values, threshold_begin_id, threshold, flags);
39 }
40
41 void PPB_Trace_Event_Shared::SetThreadName(const char* thread_name) {
42 base::PlatformThread::SetName(thread_name);
43 }
44
45 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698