| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project 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 "src/inspector/v8-debugger.h" | 5 #include "src/inspector/v8-debugger.h" |
| 6 | 6 |
| 7 #include "src/inspector/debugger-script.h" | 7 #include "src/inspector/debugger-script.h" |
| 8 #include "src/inspector/protocol/Protocol.h" | 8 #include "src/inspector/protocol/Protocol.h" |
| 9 #include "src/inspector/script-breakpoint.h" | 9 #include "src/inspector/script-breakpoint.h" |
| 10 #include "src/inspector/string-util.h" | 10 #include "src/inspector/string-util.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 v8::PersistentValueVector<v8::DebugInterface::Script> scripts(m_isolate); | 123 v8::PersistentValueVector<v8::DebugInterface::Script> scripts(m_isolate); |
| 124 v8::DebugInterface::GetLoadedScripts(m_isolate, scripts); | 124 v8::DebugInterface::GetLoadedScripts(m_isolate, scripts); |
| 125 String16 contextPrefix = String16::fromInteger(contextGroupId) + ","; | 125 String16 contextPrefix = String16::fromInteger(contextGroupId) + ","; |
| 126 for (size_t i = 0; i < scripts.Size(); ++i) { | 126 for (size_t i = 0; i < scripts.Size(); ++i) { |
| 127 v8::Local<v8::DebugInterface::Script> script = scripts.Get(i); | 127 v8::Local<v8::DebugInterface::Script> script = scripts.Get(i); |
| 128 if (!script->WasCompiled()) continue; | 128 if (!script->WasCompiled()) continue; |
| 129 v8::Local<v8::String> v8ContextData; | 129 v8::Local<v8::String> v8ContextData; |
| 130 if (!script->ContextData().ToLocal(&v8ContextData)) continue; | 130 if (!script->ContextData().ToLocal(&v8ContextData)) continue; |
| 131 String16 contextData = toProtocolString(v8ContextData); | 131 String16 contextData = toProtocolString(v8ContextData); |
| 132 if (contextData.find(contextPrefix) != 0) continue; | 132 if (contextData.find(contextPrefix) != 0) continue; |
| 133 result.push_back( | 133 result.push_back(std::unique_ptr<V8DebuggerScript>( |
| 134 wrapUnique(new V8DebuggerScript(m_isolate, script, false))); | 134 new V8DebuggerScript(m_isolate, script, false))); |
| 135 } | 135 } |
| 136 } | 136 } |
| 137 | 137 |
| 138 String16 V8Debugger::setBreakpoint(const ScriptBreakpoint& breakpoint, | 138 String16 V8Debugger::setBreakpoint(const ScriptBreakpoint& breakpoint, |
| 139 int* actualLineNumber, | 139 int* actualLineNumber, |
| 140 int* actualColumnNumber) { | 140 int* actualColumnNumber) { |
| 141 v8::HandleScope scope(m_isolate); | 141 v8::HandleScope scope(m_isolate); |
| 142 v8::Local<v8::Context> context = debuggerContext(); | 142 v8::Local<v8::Context> context = debuggerContext(); |
| 143 v8::Context::Scope contextScope(context); | 143 v8::Context::Scope contextScope(context); |
| 144 | 144 |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 private: | 347 private: |
| 348 v8::Isolate* m_isolate; | 348 v8::Isolate* m_isolate; |
| 349 }; | 349 }; |
| 350 | 350 |
| 351 *compileError = false; | 351 *compileError = false; |
| 352 DCHECK(enabled()); | 352 DCHECK(enabled()); |
| 353 v8::HandleScope scope(m_isolate); | 353 v8::HandleScope scope(m_isolate); |
| 354 | 354 |
| 355 std::unique_ptr<v8::Context::Scope> contextScope; | 355 std::unique_ptr<v8::Context::Scope> contextScope; |
| 356 if (!isPaused()) | 356 if (!isPaused()) |
| 357 contextScope = wrapUnique(new v8::Context::Scope(debuggerContext())); | 357 contextScope.reset(new v8::Context::Scope(debuggerContext())); |
| 358 | 358 |
| 359 v8::Local<v8::Value> argv[] = {toV8String(m_isolate, sourceID), newSource, | 359 v8::Local<v8::Value> argv[] = {toV8String(m_isolate, sourceID), newSource, |
| 360 v8Boolean(dryRun, m_isolate)}; | 360 v8Boolean(dryRun, m_isolate)}; |
| 361 | 361 |
| 362 v8::Local<v8::Value> v8result; | 362 v8::Local<v8::Value> v8result; |
| 363 { | 363 { |
| 364 EnableLiveEditScope enableLiveEditScope(m_isolate); | 364 EnableLiveEditScope enableLiveEditScope(m_isolate); |
| 365 v8::TryCatch tryCatch(m_isolate); | 365 v8::TryCatch tryCatch(m_isolate); |
| 366 tryCatch.SetVerbose(false); | 366 tryCatch.SetVerbose(false); |
| 367 v8::MaybeLocal<v8::Value> maybeResult = | 367 v8::MaybeLocal<v8::Value> maybeResult = |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 v8::Local<v8::DebugInterface::Script> script; | 589 v8::Local<v8::DebugInterface::Script> script; |
| 590 if (!v8::DebugInterface::Script::Wrap(m_isolate, | 590 if (!v8::DebugInterface::Script::Wrap(m_isolate, |
| 591 scriptWrapper.As<v8::Object>()) | 591 scriptWrapper.As<v8::Object>()) |
| 592 .ToLocal(&script)) { | 592 .ToLocal(&script)) { |
| 593 return; | 593 return; |
| 594 } | 594 } |
| 595 if (script->IsWasm()) { | 595 if (script->IsWasm()) { |
| 596 m_wasmTranslation.AddScript(scriptWrapper.As<v8::Object>()); | 596 m_wasmTranslation.AddScript(scriptWrapper.As<v8::Object>()); |
| 597 } else if (m_ignoreScriptParsedEventsCounter == 0) { | 597 } else if (m_ignoreScriptParsedEventsCounter == 0) { |
| 598 agent->didParseSource( | 598 agent->didParseSource( |
| 599 wrapUnique(new V8DebuggerScript(m_isolate, script, inLiveEditScope)), | 599 std::unique_ptr<V8DebuggerScript>( |
| 600 new V8DebuggerScript(m_isolate, script, inLiveEditScope)), |
| 600 event == v8::AfterCompile); | 601 event == v8::AfterCompile); |
| 601 } | 602 } |
| 602 } else if (event == v8::Exception) { | 603 } else if (event == v8::Exception) { |
| 603 v8::Local<v8::Context> context = debuggerContext(); | 604 v8::Local<v8::Context> context = debuggerContext(); |
| 604 v8::Local<v8::Object> eventData = eventDetails.GetEventData(); | 605 v8::Local<v8::Object> eventData = eventDetails.GetEventData(); |
| 605 v8::Local<v8::Value> exception = | 606 v8::Local<v8::Value> exception = |
| 606 callInternalGetterFunction(eventData, "exception"); | 607 callInternalGetterFunction(eventData, "exception"); |
| 607 v8::Local<v8::Value> promise = | 608 v8::Local<v8::Value> promise = |
| 608 callInternalGetterFunction(eventData, "promise"); | 609 callInternalGetterFunction(eventData, "promise"); |
| 609 bool isPromiseRejection = !promise.IsEmpty() && promise->IsObject(); | 610 bool isPromiseRejection = !promise.IsEmpty() && promise->IsObject(); |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 981 | 982 |
| 982 size_t stackSize = | 983 size_t stackSize = |
| 983 fullStack ? V8StackTraceImpl::maxCallStackSizeToCapture : 1; | 984 fullStack ? V8StackTraceImpl::maxCallStackSizeToCapture : 1; |
| 984 if (m_inspector->enabledRuntimeAgentForGroup(contextGroupId)) | 985 if (m_inspector->enabledRuntimeAgentForGroup(contextGroupId)) |
| 985 stackSize = V8StackTraceImpl::maxCallStackSizeToCapture; | 986 stackSize = V8StackTraceImpl::maxCallStackSizeToCapture; |
| 986 | 987 |
| 987 return V8StackTraceImpl::capture(this, contextGroupId, stackSize); | 988 return V8StackTraceImpl::capture(this, contextGroupId, stackSize); |
| 988 } | 989 } |
| 989 | 990 |
| 990 } // namespace v8_inspector | 991 } // namespace v8_inspector |
| OLD | NEW |