| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/debug/stack_trace.h" | 10 #include "base/debug/stack_trace.h" |
| 11 #include "base/location.h" | 11 #include "base/location.h" |
| 12 #include "base/sys_info.h" | 12 #include "base/sys_info.h" |
| 13 #include "base/task_scheduler/post_task.h" | 13 #include "base/task_scheduler/post_task.h" |
| 14 #include "base/task_scheduler/task_scheduler.h" | 14 #include "base/task_scheduler/task_scheduler.h" |
| 15 #include "base/trace_event/trace_event.h" | 15 #include "base/trace_event/trace_event.h" |
| 16 #include "gin/per_isolate_data.h" | 16 #include "gin/per_isolate_data.h" |
| 17 | 17 |
| 18 namespace gin { | 18 namespace gin { |
| 19 | 19 |
| 20 namespace { | 20 namespace { |
| 21 | 21 |
| 22 constexpr base::TaskTraits kBackgroundThreadTaskTraits = { | 22 constexpr base::TaskTraits kBackgroundThreadTaskTraits = { |
| 23 base::MayBlock(), base::TaskPriority::USER_VISIBLE, | 23 base::TaskPriority::USER_VISIBLE}; |
| 24 base::TaskShutdownBehavior::BLOCK_SHUTDOWN}; | |
| 25 | 24 |
| 26 base::LazyInstance<V8Platform>::Leaky g_v8_platform = LAZY_INSTANCE_INITIALIZER; | 25 base::LazyInstance<V8Platform>::Leaky g_v8_platform = LAZY_INSTANCE_INITIALIZER; |
| 27 | 26 |
| 28 void RunWithLocker(v8::Isolate* isolate, v8::Task* task) { | 27 void RunWithLocker(v8::Isolate* isolate, v8::Task* task) { |
| 29 v8::Locker lock(isolate); | 28 v8::Locker lock(isolate); |
| 30 task->Run(); | 29 task->Run(); |
| 31 } | 30 } |
| 32 | 31 |
| 33 class IdleTaskWithLocker : public v8::IdleTask { | 32 class IdleTaskWithLocker : public v8::IdleTask { |
| 34 public: | 33 public: |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 void V8Platform::RemoveTraceStateObserver( | 264 void V8Platform::RemoveTraceStateObserver( |
| 266 v8::Platform::TraceStateObserver* observer) { | 265 v8::Platform::TraceStateObserver* observer) { |
| 267 g_trace_state_dispatcher.Get().RemoveObserver(observer); | 266 g_trace_state_dispatcher.Get().RemoveObserver(observer); |
| 268 } | 267 } |
| 269 | 268 |
| 270 v8::Platform::StackTracePrinter V8Platform::GetStackTracePrinter() { | 269 v8::Platform::StackTracePrinter V8Platform::GetStackTracePrinter() { |
| 271 return PrintStackTrace; | 270 return PrintStackTrace; |
| 272 } | 271 } |
| 273 | 272 |
| 274 } // namespace gin | 273 } // namespace gin |
| OLD | NEW |