| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "core/inspector/ThreadDebugger.h" | 5 #include "core/inspector/ThreadDebugger.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/SourceLocation.h" | 7 #include "bindings/core/v8/SourceLocation.h" |
| 8 #include "bindings/core/v8/V8Binding.h" | 8 #include "bindings/core/v8/V8Binding.h" |
| 9 #include "bindings/core/v8/V8DOMException.h" | 9 #include "bindings/core/v8/V8DOMException.h" |
| 10 #include "bindings/core/v8/V8DOMTokenList.h" | 10 #include "bindings/core/v8/V8DOMTokenList.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "core/inspector/InspectorTraceEvents.h" | 22 #include "core/inspector/InspectorTraceEvents.h" |
| 23 #include "platform/ScriptForbiddenScope.h" | 23 #include "platform/ScriptForbiddenScope.h" |
| 24 #include "wtf/CurrentTime.h" | 24 #include "wtf/CurrentTime.h" |
| 25 #include "wtf/PtrUtil.h" | 25 #include "wtf/PtrUtil.h" |
| 26 #include <memory> | 26 #include <memory> |
| 27 | 27 |
| 28 namespace blink { | 28 namespace blink { |
| 29 | 29 |
| 30 ThreadDebugger::ThreadDebugger(v8::Isolate* isolate) | 30 ThreadDebugger::ThreadDebugger(v8::Isolate* isolate) |
| 31 : m_isolate(isolate) | 31 : m_isolate(isolate) |
| 32 , m_v8Inspector(V8Inspector::create(isolate, this)) | 32 , m_v8Inspector(v8_inspector::V8Inspector::create(isolate, this)) |
| 33 { | 33 { |
| 34 } | 34 } |
| 35 | 35 |
| 36 ThreadDebugger::~ThreadDebugger() | 36 ThreadDebugger::~ThreadDebugger() |
| 37 { | 37 { |
| 38 } | 38 } |
| 39 | 39 |
| 40 // static | 40 // static |
| 41 ThreadDebugger* ThreadDebugger::from(v8::Isolate* isolate) | 41 ThreadDebugger* ThreadDebugger::from(v8::Isolate* isolate) |
| 42 { | 42 { |
| 43 if (!isolate) | 43 if (!isolate) |
| 44 return nullptr; | 44 return nullptr; |
| 45 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 45 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
| 46 return data ? data->threadDebugger() : nullptr; | 46 return data ? data->threadDebugger() : nullptr; |
| 47 } | 47 } |
| 48 | 48 |
| 49 // static | 49 // static |
| 50 MessageLevel ThreadDebugger::consoleAPITypeToMessageLevel(V8ConsoleAPIType type) | 50 MessageLevel ThreadDebugger::consoleAPITypeToMessageLevel(v8_inspector::V8Consol
eAPIType type) |
| 51 { | 51 { |
| 52 switch (type) { | 52 switch (type) { |
| 53 case V8ConsoleAPIType::kDebug: return DebugMessageLevel; | 53 case v8_inspector::V8ConsoleAPIType::kDebug: return DebugMessageLevel; |
| 54 case V8ConsoleAPIType::kLog: return LogMessageLevel; | 54 case v8_inspector::V8ConsoleAPIType::kLog: return LogMessageLevel; |
| 55 case V8ConsoleAPIType::kInfo: return InfoMessageLevel; | 55 case v8_inspector::V8ConsoleAPIType::kInfo: return InfoMessageLevel; |
| 56 case V8ConsoleAPIType::kWarning: return WarningMessageLevel; | 56 case v8_inspector::V8ConsoleAPIType::kWarning: return WarningMessageLevel; |
| 57 case V8ConsoleAPIType::kError: return ErrorMessageLevel; | 57 case v8_inspector::V8ConsoleAPIType::kError: return ErrorMessageLevel; |
| 58 default: return LogMessageLevel; | 58 default: return LogMessageLevel; |
| 59 } | 59 } |
| 60 } | 60 } |
| 61 | 61 |
| 62 void ThreadDebugger::willExecuteScript(v8::Isolate* isolate, int scriptId) | 62 void ThreadDebugger::willExecuteScript(v8::Isolate* isolate, int scriptId) |
| 63 { | 63 { |
| 64 if (ThreadDebugger* debugger = ThreadDebugger::from(isolate)) | 64 if (ThreadDebugger* debugger = ThreadDebugger::from(isolate)) |
| 65 debugger->v8Inspector()->willExecuteScript(isolate->GetCurrentContext(),
scriptId); | 65 debugger->v8Inspector()->willExecuteScript(isolate->GetCurrentContext(),
scriptId); |
| 66 } | 66 } |
| 67 | 67 |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 { | 371 { |
| 372 for (size_t index = 0; index < m_timers.size(); ++index) { | 372 for (size_t index = 0; index < m_timers.size(); ++index) { |
| 373 if (m_timers[index].get() == timer) { | 373 if (m_timers[index].get() == timer) { |
| 374 m_timerCallbacks[index](m_timerData[index]); | 374 m_timerCallbacks[index](m_timerData[index]); |
| 375 return; | 375 return; |
| 376 } | 376 } |
| 377 } | 377 } |
| 378 } | 378 } |
| 379 | 379 |
| 380 } // namespace blink | 380 } // namespace blink |
| OLD | NEW |