OLD | NEW |
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" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 const uint64_t arg_values[], | 73 const uint64_t arg_values[], |
74 uint8_t flags) { | 74 uint8_t flags) { |
75 base::trace_event::TraceLog::GetInstance() | 75 base::trace_event::TraceLog::GetInstance() |
76 ->AddTraceEventWithThreadIdAndTimestamp( | 76 ->AddTraceEventWithThreadIdAndTimestamp( |
77 phase, | 77 phase, |
78 static_cast<const unsigned char*>(category_enabled), | 78 static_cast<const unsigned char*>(category_enabled), |
79 name, | 79 name, |
80 id, | 80 id, |
81 trace_event_internal::kNoId, | 81 trace_event_internal::kNoId, |
82 thread_id, | 82 thread_id, |
83 base::TraceTicks::FromInternalValue(timestamp), | 83 base::TimeTicks::FromInternalValue(timestamp), |
84 num_args, | 84 num_args, |
85 arg_names, | 85 arg_names, |
86 arg_types, | 86 arg_types, |
87 // This cast is necessary for LP64 systems, where uint64_t is defined as | 87 // This cast is necessary for LP64 systems, where uint64_t is defined as |
88 // an unsigned long int, but trace_event internals are hermetic and | 88 // an unsigned long int, but trace_event internals are hermetic and |
89 // accepts an |unsigned long long*|. The pointer types are compatible but | 89 // accepts an |unsigned long long*|. The pointer types are compatible but |
90 // the compiler throws an error without an explicit cast. | 90 // the compiler throws an error without an explicit cast. |
91 reinterpret_cast<const unsigned long long*>(arg_values), | 91 reinterpret_cast<const unsigned long long*>(arg_values), |
92 NULL, | 92 NULL, |
93 flags); | 93 flags); |
94 } | 94 } |
95 | 95 |
96 // static | 96 // static |
97 int64_t TraceEventImpl::Now() { | 97 int64_t TraceEventImpl::Now() { |
98 return base::TraceTicks::Now().ToInternalValue(); | 98 return base::TimeTicks::Now().ToInternalValue(); |
99 } | 99 } |
100 | 100 |
101 // static | 101 // static |
102 void TraceEventImpl::SetThreadName(const char* thread_name) { | 102 void TraceEventImpl::SetThreadName(const char* thread_name) { |
103 base::PlatformThread::SetName(thread_name); | 103 base::PlatformThread::SetName(thread_name); |
104 } | 104 } |
105 | 105 |
106 namespace { | 106 namespace { |
107 | 107 |
108 const PPB_Trace_Event_Dev_0_1 g_ppb_trace_event_thunk_0_1 = { | 108 const PPB_Trace_Event_Dev_0_1 g_ppb_trace_event_thunk_0_1 = { |
(...skipping 17 matching lines...) Expand all Loading... |
126 const PPB_Trace_Event_Dev_0_1* GetPPB_Trace_Event_Dev_0_1_Thunk() { | 126 const PPB_Trace_Event_Dev_0_1* GetPPB_Trace_Event_Dev_0_1_Thunk() { |
127 return &g_ppb_trace_event_thunk_0_1; | 127 return &g_ppb_trace_event_thunk_0_1; |
128 } | 128 } |
129 | 129 |
130 const PPB_Trace_Event_Dev_0_2* GetPPB_Trace_Event_Dev_0_2_Thunk() { | 130 const PPB_Trace_Event_Dev_0_2* GetPPB_Trace_Event_Dev_0_2_Thunk() { |
131 return &g_ppb_trace_event_thunk_0_2; | 131 return &g_ppb_trace_event_thunk_0_2; |
132 } | 132 } |
133 | 133 |
134 } // namespace thunk | 134 } // namespace thunk |
135 } // namespace ppapi | 135 } // namespace ppapi |
OLD | NEW |