| 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/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "ppapi/thunk/thunk.h" | 8 #include "ppapi/thunk/thunk.h" |
| 9 | 9 |
| 10 | 10 |
| 11 namespace ppapi { | 11 namespace ppapi { |
| 12 | 12 |
| 13 // PPB_Trace_Event_Dev is a shared implementation because Trace Events can be | 13 // PPB_Trace_Event_Dev is a shared implementation because Trace Events can be |
| 14 // sent from either the plugin process or renderer process depending on whether | 14 // sent from either the plugin process or renderer process depending on whether |
| 15 // the plugin is in- or out-of-process. Also, for NaCl plugins these functions | 15 // the plugin is in- or out-of-process. Also, for NaCl plugins these functions |
| 16 // will be executed from untrusted code and handled appropriately by tracing | 16 // will be executed from untrusted code and handled appropriately by tracing |
| 17 // functionality in the IRT. | 17 // functionality in the IRT. |
| 18 | 18 |
| 19 // static | 19 // static |
| 20 void* TraceEventImpl::GetCategoryEnabled(const char* category_name) { | 20 void* TraceEventImpl::GetCategoryEnabled(const char* category_name) { |
| 21 // This casting is here because all mem_t return types in Pepper are void* and | 21 // This casting is here because all mem_t return types in Pepper are void* and |
| 22 // non-const. All mem_t parameters are const void* so there is no way to | 22 // non-const. All mem_t parameters are const void* so there is no way to |
| 23 // return a pointer type to the caller without some const_cast. The pointer | 23 // return a pointer type to the caller without some const_cast. The pointer |
| 24 // type the tracing system works with is normally unsigned char*. | 24 // type the tracing system works with is normally unsigned char*. |
| 25 return const_cast<void*>(static_cast<const void*>( | 25 return const_cast<void*>(static_cast<const void*>( |
| 26 base::debug::TraceLog::GetInstance()->GetCategoryEnabled(category_name))); | 26 base::debug::TraceLog::GetInstance()->GetCategoryGroupEnabled( |
| 27 category_name))); |
| 27 } | 28 } |
| 28 | 29 |
| 29 // static | 30 // static |
| 30 void TraceEventImpl::AddTraceEvent(int8_t phase, | 31 void TraceEventImpl::AddTraceEvent(int8_t phase, |
| 31 const void* category_enabled, | 32 const void* category_enabled, |
| 32 const char* name, | 33 const char* name, |
| 33 uint64_t id, | 34 uint64_t id, |
| 34 uint32_t num_args, | 35 uint32_t num_args, |
| 35 const char* arg_names[], | 36 const char* arg_names[], |
| 36 const uint8_t arg_types[], | 37 const uint8_t arg_types[], |
| (...skipping 28 matching lines...) Expand all Loading... |
| 65 | 66 |
| 66 namespace ppapi { | 67 namespace ppapi { |
| 67 namespace thunk { | 68 namespace thunk { |
| 68 | 69 |
| 69 const PPB_Trace_Event_Dev_0_1* GetPPB_Trace_Event_Dev_0_1_Thunk() { | 70 const PPB_Trace_Event_Dev_0_1* GetPPB_Trace_Event_Dev_0_1_Thunk() { |
| 70 return &g_ppb_trace_event_thunk; | 71 return &g_ppb_trace_event_thunk; |
| 71 } | 72 } |
| 72 | 73 |
| 73 } // namespace thunk | 74 } // namespace thunk |
| 74 } // namespace ppapi | 75 } // namespace ppapi |
| OLD | NEW |