| 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/V8DOMException.h" | 8 #include "bindings/core/v8/V8DOMException.h" |
| 9 #include "bindings/core/v8/V8DOMTokenList.h" | 9 #include "bindings/core/v8/V8DOMTokenList.h" |
| 10 #include "bindings/core/v8/V8HTMLAllCollection.h" | 10 #include "bindings/core/v8/V8HTMLAllCollection.h" |
| 11 #include "bindings/core/v8/V8HTMLCollection.h" | 11 #include "bindings/core/v8/V8HTMLCollection.h" |
| 12 #include "bindings/core/v8/V8Node.h" | 12 #include "bindings/core/v8/V8Node.h" |
| 13 #include "bindings/core/v8/V8NodeList.h" | 13 #include "bindings/core/v8/V8NodeList.h" |
| 14 #include "bindings/core/v8/V8RecursionScope.h" | |
| 15 #include "bindings/core/v8/V8ScriptRunner.h" | |
| 16 #include "core/dom/Microtask.h" | |
| 17 #include "core/inspector/InspectorDOMDebuggerAgent.h" | 14 #include "core/inspector/InspectorDOMDebuggerAgent.h" |
| 15 #include "platform/ScriptForbiddenScope.h" |
| 18 #include "wtf/CurrentTime.h" | 16 #include "wtf/CurrentTime.h" |
| 19 | 17 |
| 20 namespace blink { | 18 namespace blink { |
| 21 | 19 |
| 22 ThreadDebugger::ThreadDebugger(v8::Isolate* isolate) | 20 ThreadDebugger::ThreadDebugger(v8::Isolate* isolate) |
| 23 : m_isolate(isolate) | 21 : m_isolate(isolate) |
| 24 , m_debugger(V8Debugger::create(isolate, this)) | 22 , m_debugger(V8Debugger::create(isolate, this)) |
| 25 { | 23 { |
| 26 } | 24 } |
| 27 | 25 |
| 28 ThreadDebugger::~ThreadDebugger() | 26 ThreadDebugger::~ThreadDebugger() |
| 29 { | 27 { |
| 30 } | 28 } |
| 31 | 29 |
| 32 void ThreadDebugger::eventListeners(v8::Local<v8::Value> value, V8EventListenerI
nfoList& result) | 30 void ThreadDebugger::eventListeners(v8::Local<v8::Value> value, V8EventListenerI
nfoList& result) |
| 33 { | 31 { |
| 34 InspectorDOMDebuggerAgent::eventListenersInfoForTarget(m_isolate, value, res
ult); | 32 InspectorDOMDebuggerAgent::eventListenersInfoForTarget(m_isolate, value, res
ult); |
| 35 } | 33 } |
| 36 | 34 |
| 37 v8::MaybeLocal<v8::Object> ThreadDebugger::instantiateObject(v8::Local<v8::Funct
ion> function) | |
| 38 { | |
| 39 return V8ScriptRunner::instantiateObject(m_isolate, function); | |
| 40 } | |
| 41 | |
| 42 v8::MaybeLocal<v8::Value> ThreadDebugger::runCompiledScript(v8::Local<v8::Contex
t> context, v8::Local<v8::Script> script) | |
| 43 { | |
| 44 return V8ScriptRunner::runCompiledScript(m_isolate, script, toExecutionConte
xt(context)); | |
| 45 } | |
| 46 | |
| 47 v8::MaybeLocal<v8::Value> ThreadDebugger::compileAndRunInternalScript(v8::Local<
v8::String> script) | |
| 48 { | |
| 49 return V8ScriptRunner::compileAndRunInternalScript(script, m_isolate); | |
| 50 } | |
| 51 | |
| 52 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[]) | |
| 53 { | |
| 54 return V8ScriptRunner::callFunction(function, toExecutionContext(context), r
eceiver, argc, info, m_isolate); | |
| 55 } | |
| 56 | |
| 57 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[]) | |
| 58 { | |
| 59 return V8ScriptRunner::callInternalFunction(function, receiver, argc, info,
m_isolate); | |
| 60 } | |
| 61 | |
| 62 String16 ThreadDebugger::valueSubtype(v8::Local<v8::Value> value) | 35 String16 ThreadDebugger::valueSubtype(v8::Local<v8::Value> value) |
| 63 { | 36 { |
| 64 if (V8Node::hasInstance(value, m_isolate)) | 37 if (V8Node::hasInstance(value, m_isolate)) |
| 65 return "node"; | 38 return "node"; |
| 66 if (V8NodeList::hasInstance(value, m_isolate) | 39 if (V8NodeList::hasInstance(value, m_isolate) |
| 67 || V8DOMTokenList::hasInstance(value, m_isolate) | 40 || V8DOMTokenList::hasInstance(value, m_isolate) |
| 68 || V8HTMLCollection::hasInstance(value, m_isolate) | 41 || V8HTMLCollection::hasInstance(value, m_isolate) |
| 69 || V8HTMLAllCollection::hasInstance(value, m_isolate)) { | 42 || V8HTMLAllCollection::hasInstance(value, m_isolate)) { |
| 70 return "array"; | 43 return "array"; |
| 71 } | 44 } |
| 72 if (V8DOMException::hasInstance(value, m_isolate)) | 45 if (V8DOMException::hasInstance(value, m_isolate)) |
| 73 return "error"; | 46 return "error"; |
| 74 return String(); | 47 return String(); |
| 75 } | 48 } |
| 76 | 49 |
| 77 bool ThreadDebugger::formatAccessorsAsProperties(v8::Local<v8::Value> value) | 50 bool ThreadDebugger::formatAccessorsAsProperties(v8::Local<v8::Value> value) |
| 78 { | 51 { |
| 79 return V8DOMWrapper::isWrapper(m_isolate, value); | 52 return V8DOMWrapper::isWrapper(m_isolate, value); |
| 80 } | 53 } |
| 81 | 54 |
| 82 bool ThreadDebugger::hasRecursionLevel() | 55 bool ThreadDebugger::hasRecursionLevel() |
| 83 { | 56 { |
| 84 return !!V8RecursionScope::recursionLevel(m_isolate); | 57 return !!v8::MicrotasksScope::GetCurrentDepth(m_isolate); |
| 58 } |
| 59 |
| 60 bool ThreadDebugger::isExecutionAllowed() |
| 61 { |
| 62 return !ScriptForbiddenScope::isScriptForbidden(); |
| 85 } | 63 } |
| 86 | 64 |
| 87 double ThreadDebugger::currentTimeMS() | 65 double ThreadDebugger::currentTimeMS() |
| 88 { | 66 { |
| 89 return WTF::currentTimeMS(); | 67 return WTF::currentTimeMS(); |
| 90 } | 68 } |
| 91 | 69 |
| 92 | 70 |
| 93 } // namespace blink | 71 } // namespace blink |
| OLD | NEW |