OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "gin/public/v8_platform.h" | 5 #include "gin/public/v8_platform.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/sys_info.h" | 9 #include "base/sys_info.h" |
10 #include "base/threading/worker_pool.h" | 10 #include "base/threading/worker_pool.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
90 const uint8_t* category_enabled_flag, | 90 const uint8_t* category_enabled_flag, |
91 const char* name, | 91 const char* name, |
92 const char* scope, | 92 const char* scope, |
93 uint64_t id, | 93 uint64_t id, |
94 uint64_t bind_id, | 94 uint64_t bind_id, |
95 int32_t num_args, | 95 int32_t num_args, |
96 const char** arg_names, | 96 const char** arg_names, |
97 const uint8_t* arg_types, | 97 const uint8_t* arg_types, |
98 const uint64_t* arg_values, | 98 const uint64_t* arg_values, |
99 unsigned int flags) { | 99 unsigned int flags) { |
100 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> convertables[2]; | |
fmeawad
2016/09/15 23:53:44
Instead of the 2 if conditions, maybe a tiny for l
alph
2016/09/15 23:58:14
I doubt it will be able to unroll it as the num_ar
| |
101 if (num_args > 0 && arg_types[0] == TRACE_VALUE_TYPE_CONVERTABLE) { | |
102 convertables[0].reset( | |
103 reinterpret_cast<base::trace_event::ConvertableToTraceFormat*>( | |
104 arg_values[0])); | |
105 } | |
106 if (num_args > 1 && arg_types[1] == TRACE_VALUE_TYPE_CONVERTABLE) { | |
107 convertables[1].reset( | |
108 reinterpret_cast<base::trace_event::ConvertableToTraceFormat*>( | |
109 arg_values[1])); | |
110 } | |
100 base::trace_event::TraceEventHandle handle = | 111 base::trace_event::TraceEventHandle handle = |
101 TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_BIND_ID( | 112 TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_BIND_ID( |
102 phase, category_enabled_flag, name, scope, id, bind_id, num_args, | 113 phase, category_enabled_flag, name, scope, id, bind_id, num_args, |
103 arg_names, arg_types, (const long long unsigned int*)arg_values, NULL, | 114 arg_names, arg_types, (const long long unsigned int*)arg_values, |
104 flags); | 115 convertables, flags); |
105 uint64_t result; | 116 uint64_t result; |
106 memcpy(&result, &handle, sizeof(result)); | 117 memcpy(&result, &handle, sizeof(result)); |
107 return result; | 118 return result; |
108 } | 119 } |
109 | 120 |
110 void V8Platform::UpdateTraceEventDuration(const uint8_t* category_enabled_flag, | 121 void V8Platform::UpdateTraceEventDuration(const uint8_t* category_enabled_flag, |
111 const char* name, | 122 const char* name, |
112 uint64_t handle) { | 123 uint64_t handle) { |
113 base::trace_event::TraceEventHandle traceEventHandle; | 124 base::trace_event::TraceEventHandle traceEventHandle; |
114 memcpy(&traceEventHandle, &handle, sizeof(handle)); | 125 memcpy(&traceEventHandle, &handle, sizeof(handle)); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
168 v8::Platform::TraceStateObserver* observer) { | 179 v8::Platform::TraceStateObserver* observer) { |
169 g_trace_state_dispatcher.Get().AddObserver(observer); | 180 g_trace_state_dispatcher.Get().AddObserver(observer); |
170 } | 181 } |
171 | 182 |
172 void V8Platform::RemoveTraceStateObserver( | 183 void V8Platform::RemoveTraceStateObserver( |
173 v8::Platform::TraceStateObserver* observer) { | 184 v8::Platform::TraceStateObserver* observer) { |
174 g_trace_state_dispatcher.Get().RemoveObserver(observer); | 185 g_trace_state_dispatcher.Get().RemoveObserver(observer); |
175 } | 186 } |
176 | 187 |
177 } // namespace gin | 188 } // namespace gin |
OLD | NEW |