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 | |
13 | 10 |
14 namespace blink { | 11 namespace blink { |
15 | 12 |
16 ThreadDebugger::ThreadDebugger(v8::Isolate* isolate) | 13 ThreadDebugger::ThreadDebugger(v8::Isolate* isolate) |
17 : m_isolate(isolate) | 14 : m_isolate(isolate) |
18 , m_debugger(V8Debugger::create(isolate, this)) | 15 , m_debugger(V8Debugger::create(isolate, this)) |
19 { | 16 { |
20 } | 17 } |
21 | 18 |
22 ThreadDebugger::~ThreadDebugger() | 19 ThreadDebugger::~ThreadDebugger() |
23 { | 20 { |
24 } | 21 } |
25 | 22 |
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 | |
37 void ThreadDebugger::eventListeners(v8::Local<v8::Value> value, EventListenerInf
oMap& result) | 23 void ThreadDebugger::eventListeners(v8::Local<v8::Value> value, EventListenerInf
oMap& result) |
38 { | 24 { |
39 InspectorDOMDebuggerAgent::eventListenersInfoForTarget(m_isolate, value, res
ult); | 25 InspectorDOMDebuggerAgent::eventListenersInfoForTarget(m_isolate, value, res
ult); |
40 } | 26 } |
41 | 27 |
| 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 |
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[]) | 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[]) |
43 { | 34 { |
44 ScriptState* scriptState = ScriptState::from(context); | 35 return V8ScriptRunner::callFunction(function, toExecutionContext(context), r
eceiver, argc, info, m_isolate); |
45 return V8ScriptRunner::callFunction(function, scriptState->executionContext(
), receiver, argc, info, m_isolate); | 36 } |
| 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); |
46 } | 41 } |
47 | 42 |
48 } // namespace blink | 43 } // namespace blink |
OLD | NEW |