| 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/V8Binding.h" | 7 #include "bindings/core/v8/V8Binding.h" |
| 8 #include "bindings/core/v8/V8ScriptRunner.h" | 8 #include "bindings/core/v8/V8ScriptRunner.h" |
| 9 #include "core/inspector/InspectorDOMDebuggerAgent.h" | 9 #include "core/inspector/InspectorDOMDebuggerAgent.h" |
| 10 #include "public/platform/Platform.h" |
| 11 #include "public/platform/WebData.h" |
| 12 |
| 10 | 13 |
| 11 namespace blink { | 14 namespace blink { |
| 12 | 15 |
| 13 ThreadDebugger::ThreadDebugger(v8::Isolate* isolate) | 16 ThreadDebugger::ThreadDebugger(v8::Isolate* isolate) |
| 14 : m_isolate(isolate) | 17 : m_isolate(isolate) |
| 15 , m_debugger(V8Debugger::create(isolate, this)) | 18 , m_debugger(V8Debugger::create(isolate, this)) |
| 16 { | 19 { |
| 17 } | 20 } |
| 18 | 21 |
| 19 ThreadDebugger::~ThreadDebugger() | 22 ThreadDebugger::~ThreadDebugger() |
| 20 { | 23 { |
| 21 } | 24 } |
| 22 | 25 |
| 26 v8::Local<v8::Object> ThreadDebugger::compileDebuggerScript() |
| 27 { |
| 28 const WebData& debuggerScriptSourceResource = Platform::current()->loadResou
rce("DebuggerScriptSource.js"); |
| 29 v8::Local<v8::String> source = v8String(m_isolate, String(debuggerScriptSour
ceResource.data(), debuggerScriptSourceResource.size())); |
| 30 v8::Local<v8::Value> value; |
| 31 if (!V8ScriptRunner::compileAndRunInternalScript(source, m_isolate).ToLocal(
&value)) |
| 32 return v8::Local<v8::Object>(); |
| 33 ASSERT(value->IsObject()); |
| 34 return value.As<v8::Object>(); |
| 35 } |
| 36 |
| 23 void ThreadDebugger::eventListeners(v8::Local<v8::Value> value, EventListenerInf
oMap& result) | 37 void ThreadDebugger::eventListeners(v8::Local<v8::Value> value, EventListenerInf
oMap& result) |
| 24 { | 38 { |
| 25 InspectorDOMDebuggerAgent::eventListenersInfoForTarget(m_isolate, value, res
ult); | 39 InspectorDOMDebuggerAgent::eventListenersInfoForTarget(m_isolate, value, res
ult); |
| 26 } | 40 } |
| 27 | 41 |
| 28 v8::MaybeLocal<v8::Value> ThreadDebugger::compileAndRunInternalScript(const Stri
ng& script) | |
| 29 { | |
| 30 return V8ScriptRunner::compileAndRunInternalScript(v8String(m_isolate, scrip
t), m_isolate); | |
| 31 } | |
| 32 | |
| 33 v8::MaybeLocal<v8::Value> ThreadDebugger::callFunction(v8::Local<v8::Function> f
unction, v8::Local<v8::Context> context, v8::Local<v8::Value> receiver, int argc
, v8::Local<v8::Value> info[]) | 42 v8::MaybeLocal<v8::Value> ThreadDebugger::callFunction(v8::Local<v8::Function> f
unction, v8::Local<v8::Context> context, v8::Local<v8::Value> receiver, int argc
, v8::Local<v8::Value> info[]) |
| 34 { | 43 { |
| 35 return V8ScriptRunner::callFunction(function, toExecutionContext(context), r
eceiver, argc, info, m_isolate); | 44 ScriptState* scriptState = ScriptState::from(context); |
| 36 } | 45 return V8ScriptRunner::callFunction(function, scriptState->executionContext(
), receiver, argc, info, m_isolate); |
| 37 | |
| 38 v8::MaybeLocal<v8::Value> ThreadDebugger::callInternalFunction(v8::Local<v8::Fun
ction> function, v8::Local<v8::Value> receiver, int argc, v8::Local<v8::Value> i
nfo[]) | |
| 39 { | |
| 40 return V8ScriptRunner::callInternalFunction(function, receiver, argc, info,
m_isolate); | |
| 41 } | 46 } |
| 42 | 47 |
| 43 } // namespace blink | 48 } // namespace blink |
| OLD | NEW |