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

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

Issue 868603007: Mechanical rename of base::debug -> base::trace_event [final pass]. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move_trace_part3_1
Patch Set: Fixing win file. Created 5 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
« no previous file with comments | « net/base/trace_net_log_observer_unittest.cc ('k') | skia/ext/event_tracer_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ppapi/shared_impl/ppb_trace_event_impl.h" 5 #include "ppapi/shared_impl/ppb_trace_event_impl.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/threading/platform_thread.h" 8 #include "base/threading/platform_thread.h"
9 #include "base/trace_event/trace_event.h" 9 #include "base/trace_event/trace_event.h"
10 #include "ppapi/thunk/thunk.h" 10 #include "ppapi/thunk/thunk.h"
11 11
12 namespace ppapi { 12 namespace ppapi {
13 13
14 // PPB_Trace_Event_Dev is a shared implementation because Trace Events can be 14 // PPB_Trace_Event_Dev is a shared implementation because Trace Events can be
15 // sent from either the plugin process or renderer process depending on whether 15 // sent from either the plugin process or renderer process depending on whether
16 // the plugin is in- or out-of-process. Also, for NaCl plugins these functions 16 // the plugin is in- or out-of-process. Also, for NaCl plugins these functions
17 // will be executed from untrusted code and handled appropriately by tracing 17 // will be executed from untrusted code and handled appropriately by tracing
18 // functionality in the IRT. 18 // functionality in the IRT.
19 19
20 // static 20 // static
21 void* TraceEventImpl::GetCategoryEnabled(const char* category_name) { 21 void* TraceEventImpl::GetCategoryEnabled(const char* category_name) {
22 // This casting is here because all mem_t return types in Pepper are void* and 22 // This casting is here because all mem_t return types in Pepper are void* and
23 // non-const. All mem_t parameters are const void* so there is no way to 23 // non-const. All mem_t parameters are const void* so there is no way to
24 // return a pointer type to the caller without some const_cast. The pointer 24 // return a pointer type to the caller without some const_cast. The pointer
25 // type the tracing system works with is normally unsigned char*. 25 // type the tracing system works with is normally unsigned char*.
26 return const_cast<void*>(static_cast<const void*>( 26 return const_cast<void*>(static_cast<const void*>(
27 base::debug::TraceLog::GetInstance()->GetCategoryGroupEnabled( 27 base::trace_event::TraceLog::GetInstance()->GetCategoryGroupEnabled(
28 category_name))); 28 category_name)));
29 } 29 }
30 30
31 // static 31 // static
32 void TraceEventImpl::AddTraceEvent(int8_t phase, 32 void TraceEventImpl::AddTraceEvent(int8_t phase,
33 const void* category_enabled, 33 const void* category_enabled,
34 const char* name, 34 const char* name,
35 uint64_t id, 35 uint64_t id,
36 uint32_t num_args, 36 uint32_t num_args,
37 const char* arg_names[], 37 const char* arg_names[],
38 const uint8_t arg_types[], 38 const uint8_t arg_types[],
39 const uint64_t arg_values[], 39 const uint64_t arg_values[],
40 uint8_t flags) { 40 uint8_t flags) {
41 41
42 static_assert(sizeof(unsigned long long) == sizeof(uint64_t), 42 static_assert(sizeof(unsigned long long) == sizeof(uint64_t),
43 "unexpected data type sizes"); 43 "unexpected data type sizes");
44 44
45 base::debug::TraceLog::GetInstance()->AddTraceEvent( 45 base::trace_event::TraceLog::GetInstance()->AddTraceEvent(
46 phase, 46 phase,
47 static_cast<const unsigned char*>(category_enabled), 47 static_cast<const unsigned char*>(category_enabled),
48 name, 48 name,
49 id, 49 id,
50 num_args, 50 num_args,
51 arg_names, 51 arg_names,
52 arg_types, 52 arg_types,
53 // This cast is necessary for LP64 systems, where uint64_t is defined as 53 // This cast is necessary for LP64 systems, where uint64_t is defined as
54 // an unsigned long int, but trace_event internals are hermetic and 54 // an unsigned long int, but trace_event internals are hermetic and
55 // accepts an |unsigned long long*|. The pointer types are compatible but 55 // accepts an |unsigned long long*|. The pointer types are compatible but
56 // the compiler throws an error without an explicit cast. 56 // the compiler throws an error without an explicit cast.
57 reinterpret_cast<const unsigned long long*>(arg_values), 57 reinterpret_cast<const unsigned long long*>(arg_values),
58 NULL, 58 NULL,
59 flags); 59 flags);
60 } 60 }
61 61
62 // static 62 // static
63 void TraceEventImpl::AddTraceEventWithThreadIdAndTimestamp( 63 void TraceEventImpl::AddTraceEventWithThreadIdAndTimestamp(
64 int8_t phase, 64 int8_t phase,
65 const void* category_enabled, 65 const void* category_enabled,
66 const char* name, 66 const char* name,
67 uint64_t id, 67 uint64_t id,
68 int32_t thread_id, 68 int32_t thread_id,
69 int64_t timestamp, 69 int64_t timestamp,
70 uint32_t num_args, 70 uint32_t num_args,
71 const char* arg_names[], 71 const char* arg_names[],
72 const uint8_t arg_types[], 72 const uint8_t arg_types[],
73 const uint64_t arg_values[], 73 const uint64_t arg_values[],
74 uint8_t flags) { 74 uint8_t flags) {
75 base::debug::TraceLog::GetInstance()->AddTraceEventWithThreadIdAndTimestamp( 75 base::trace_event::TraceLog::GetInstance()
76 phase, 76 ->AddTraceEventWithThreadIdAndTimestamp(
77 static_cast<const unsigned char*>(category_enabled), 77 phase,
78 name, 78 static_cast<const unsigned char*>(category_enabled),
79 id, 79 name,
80 thread_id, 80 id,
81 base::TimeTicks::FromInternalValue(timestamp), 81 thread_id,
82 num_args, 82 base::TimeTicks::FromInternalValue(timestamp),
83 arg_names, 83 num_args,
84 arg_types, 84 arg_names,
85 arg_types,
85 // This cast is necessary for LP64 systems, where uint64_t is defined as 86 // This cast is necessary for LP64 systems, where uint64_t is defined as
86 // an unsigned long int, but trace_event internals are hermetic and 87 // an unsigned long int, but trace_event internals are hermetic and
87 // accepts an |unsigned long long*|. The pointer types are compatible but 88 // accepts an |unsigned long long*|. The pointer types are compatible but
88 // the compiler throws an error without an explicit cast. 89 // the compiler throws an error without an explicit cast.
89 reinterpret_cast<const unsigned long long*>(arg_values), 90 reinterpret_cast<const unsigned long long*>(arg_values),
90 NULL, 91 NULL,
91 flags); 92 flags);
92 } 93 }
93 94
94 // static 95 // static
(...skipping 29 matching lines...) Expand all
124 const PPB_Trace_Event_Dev_0_1* GetPPB_Trace_Event_Dev_0_1_Thunk() { 125 const PPB_Trace_Event_Dev_0_1* GetPPB_Trace_Event_Dev_0_1_Thunk() {
125 return &g_ppb_trace_event_thunk_0_1; 126 return &g_ppb_trace_event_thunk_0_1;
126 } 127 }
127 128
128 const PPB_Trace_Event_Dev_0_2* GetPPB_Trace_Event_Dev_0_2_Thunk() { 129 const PPB_Trace_Event_Dev_0_2* GetPPB_Trace_Event_Dev_0_2_Thunk() {
129 return &g_ppb_trace_event_thunk_0_2; 130 return &g_ppb_trace_event_thunk_0_2;
130 } 131 }
131 132
132 } // namespace thunk 133 } // namespace thunk
133 } // namespace ppapi 134 } // namespace ppapi
OLDNEW
« no previous file with comments | « net/base/trace_net_log_observer_unittest.cc ('k') | skia/ext/event_tracer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698