| 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" |
| 11 #include "base/trace_event/heap_profiler_allocation_context_tracker.h" |
| 11 #include "base/trace_event/trace_event.h" | 12 #include "base/trace_event/trace_event.h" |
| 12 #include "gin/per_isolate_data.h" | 13 #include "gin/per_isolate_data.h" |
| 13 | 14 |
| 14 namespace gin { | 15 namespace gin { |
| 15 | 16 |
| 16 namespace { | 17 namespace { |
| 17 | 18 |
| 18 base::LazyInstance<V8Platform>::Leaky g_v8_platform = LAZY_INSTANCE_INITIALIZER; | 19 base::LazyInstance<V8Platform>::Leaky g_v8_platform = LAZY_INSTANCE_INITIALIZER; |
| 19 | 20 |
| 20 } // namespace | 21 } // namespace |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 | 110 |
| 110 void V8Platform::UpdateTraceEventDuration(const uint8_t* category_enabled_flag, | 111 void V8Platform::UpdateTraceEventDuration(const uint8_t* category_enabled_flag, |
| 111 const char* name, | 112 const char* name, |
| 112 uint64_t handle) { | 113 uint64_t handle) { |
| 113 base::trace_event::TraceEventHandle traceEventHandle; | 114 base::trace_event::TraceEventHandle traceEventHandle; |
| 114 memcpy(&traceEventHandle, &handle, sizeof(handle)); | 115 memcpy(&traceEventHandle, &handle, sizeof(handle)); |
| 115 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_enabled_flag, name, | 116 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_enabled_flag, name, |
| 116 traceEventHandle); | 117 traceEventHandle); |
| 117 } | 118 } |
| 118 | 119 |
| 120 void V8Platform::PushTracingPseudoStackFrame(const char* stack_frame) { |
| 121 base::trace_event::AllocationContextTracker::GetInstanceForCurrentThread() |
| 122 ->PushPseudoStackFrame(stack_frame); |
| 123 } |
| 124 |
| 125 void V8Platform::PopTracingPseudoStackFrame(const char* stack_frame) { |
| 126 base::trace_event::AllocationContextTracker::GetInstanceForCurrentThread() |
| 127 ->PopPseudoStackFrame(stack_frame); |
| 128 } |
| 129 |
| 119 } // namespace gin | 130 } // namespace gin |
| OLD | NEW |