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/debug/stack_trace.h" |
8 #include "base/location.h" | 9 #include "base/location.h" |
9 #include "base/sys_info.h" | 10 #include "base/sys_info.h" |
10 #include "base/threading/worker_pool.h" | 11 #include "base/threading/worker_pool.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 |
(...skipping 17 matching lines...) Expand all Loading... |
35 task_->Run(deadline_in_seconds); | 36 task_->Run(deadline_in_seconds); |
36 } | 37 } |
37 | 38 |
38 private: | 39 private: |
39 v8::Isolate* isolate_; | 40 v8::Isolate* isolate_; |
40 std::unique_ptr<v8::IdleTask> task_; | 41 std::unique_ptr<v8::IdleTask> task_; |
41 | 42 |
42 DISALLOW_COPY_AND_ASSIGN(IdleTaskWithLocker); | 43 DISALLOW_COPY_AND_ASSIGN(IdleTaskWithLocker); |
43 }; | 44 }; |
44 | 45 |
| 46 void PrintStackTrace() { |
| 47 base::debug::StackTrace trace; |
| 48 trace.Print(); |
| 49 } |
| 50 |
45 } // namespace | 51 } // namespace |
46 | 52 |
47 // static | 53 // static |
48 V8Platform* V8Platform::Get() { return g_v8_platform.Pointer(); } | 54 V8Platform* V8Platform::Get() { return g_v8_platform.Pointer(); } |
49 | 55 |
50 V8Platform::V8Platform() {} | 56 V8Platform::V8Platform() {} |
51 | 57 |
52 V8Platform::~V8Platform() {} | 58 V8Platform::~V8Platform() {} |
53 | 59 |
54 size_t V8Platform::NumberOfAvailableBackgroundThreads() { | 60 size_t V8Platform::NumberOfAvailableBackgroundThreads() { |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 void V8Platform::AddTraceStateObserver( | 262 void V8Platform::AddTraceStateObserver( |
257 v8::Platform::TraceStateObserver* observer) { | 263 v8::Platform::TraceStateObserver* observer) { |
258 g_trace_state_dispatcher.Get().AddObserver(observer); | 264 g_trace_state_dispatcher.Get().AddObserver(observer); |
259 } | 265 } |
260 | 266 |
261 void V8Platform::RemoveTraceStateObserver( | 267 void V8Platform::RemoveTraceStateObserver( |
262 v8::Platform::TraceStateObserver* observer) { | 268 v8::Platform::TraceStateObserver* observer) { |
263 g_trace_state_dispatcher.Get().RemoveObserver(observer); | 269 g_trace_state_dispatcher.Get().RemoveObserver(observer); |
264 } | 270 } |
265 | 271 |
| 272 v8::Platform::StackTracePrinter V8Platform::GetStackTracePrinter() { |
| 273 return PrintStackTrace; |
| 274 } |
| 275 |
266 } // namespace gin | 276 } // namespace gin |
OLD | NEW |