| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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::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 thread_id, | 81 thread_id, |
| 82 base::TimeTicks::FromInternalValue(timestamp), | 82 base::TraceTicks::FromInternalValue(timestamp), |
| 83 num_args, | 83 num_args, |
| 84 arg_names, | 84 arg_names, |
| 85 arg_types, | 85 arg_types, |
| 86 // 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 |
| 87 // an unsigned long int, but trace_event internals are hermetic and | 87 // an unsigned long int, but trace_event internals are hermetic and |
| 88 // accepts an |unsigned long long*|. The pointer types are compatible but | 88 // accepts an |unsigned long long*|. The pointer types are compatible but |
| 89 // the compiler throws an error without an explicit cast. | 89 // the compiler throws an error without an explicit cast. |
| 90 reinterpret_cast<const unsigned long long*>(arg_values), | 90 reinterpret_cast<const unsigned long long*>(arg_values), |
| 91 NULL, | 91 NULL, |
| 92 flags); | 92 flags); |
| 93 } | 93 } |
| 94 | 94 |
| 95 // static | 95 // static |
| 96 int64_t TraceEventImpl::Now() { | 96 int64_t TraceEventImpl::Now() { |
| 97 return base::TimeTicks::NowFromSystemTraceTime().ToInternalValue(); | 97 return base::TraceTicks::Now().ToInternalValue(); |
| 98 } | 98 } |
| 99 | 99 |
| 100 // static | 100 // static |
| 101 void TraceEventImpl::SetThreadName(const char* thread_name) { | 101 void TraceEventImpl::SetThreadName(const char* thread_name) { |
| 102 base::PlatformThread::SetName(thread_name); | 102 base::PlatformThread::SetName(thread_name); |
| 103 } | 103 } |
| 104 | 104 |
| 105 namespace { | 105 namespace { |
| 106 | 106 |
| 107 const PPB_Trace_Event_Dev_0_1 g_ppb_trace_event_thunk_0_1 = { | 107 const PPB_Trace_Event_Dev_0_1 g_ppb_trace_event_thunk_0_1 = { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 125 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() { |
| 126 return &g_ppb_trace_event_thunk_0_1; | 126 return &g_ppb_trace_event_thunk_0_1; |
| 127 } | 127 } |
| 128 | 128 |
| 129 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() { |
| 130 return &g_ppb_trace_event_thunk_0_2; | 130 return &g_ppb_trace_event_thunk_0_2; |
| 131 } | 131 } |
| 132 | 132 |
| 133 } // namespace thunk | 133 } // namespace thunk |
| 134 } // namespace ppapi | 134 } // namespace ppapi |
| OLD | NEW |