Chromium Code Reviews| 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 117 void V8Debugger::getCompiledScripts( | 117 void V8Debugger::getCompiledScripts( |
| 118 int contextGroupId, | 118 int contextGroupId, |
| 119 std::vector<std::unique_ptr<V8DebuggerScript>>& result) { | 119 std::vector<std::unique_ptr<V8DebuggerScript>>& result) { |
| 120 v8::HandleScope scope(m_isolate); | 120 v8::HandleScope scope(m_isolate); |
| 121 v8::PersistentValueVector<v8::DebugInterface::Script> scripts(m_isolate); | 121 v8::PersistentValueVector<v8::DebugInterface::Script> scripts(m_isolate); |
| 122 v8::DebugInterface::GetLoadedScripts(m_isolate, scripts); | 122 v8::DebugInterface::GetLoadedScripts(m_isolate, scripts); |
| 123 String16 contextPrefix = String16::fromInteger(contextGroupId) + ","; | 123 String16 contextPrefix = String16::fromInteger(contextGroupId) + ","; |
| 124 for (size_t i = 0; i < scripts.Size(); ++i) { | 124 for (size_t i = 0; i < scripts.Size(); ++i) { |
| 125 v8::Local<v8::DebugInterface::Script> script = scripts.Get(i); | 125 v8::Local<v8::DebugInterface::Script> script = scripts.Get(i); |
| 126 if (!script->WasCompiled()) continue; | 126 if (!script->WasCompiled()) continue; |
| 127 v8::ScriptOriginOptions origin = script->OriginOptions(); | |
| 128 if (origin.IsEmbedderDebugScript()) continue; | |
| 129 v8::Local<v8::String> v8ContextData; | 127 v8::Local<v8::String> v8ContextData; |
| 130 if (!script->ContextData().ToLocal(&v8ContextData)) continue; | 128 if (!script->ContextData().ToLocal(&v8ContextData)) continue; |
| 131 String16 contextData = toProtocolString(v8ContextData); | 129 String16 contextData = toProtocolString(v8ContextData); |
| 132 if (contextData.find(contextPrefix) != 0) continue; | 130 if (contextData.find(contextPrefix) != 0) continue; |
| 133 result.push_back( | 131 result.push_back( |
| 134 wrapUnique(new V8DebuggerScript(m_isolate, script, false))); | 132 wrapUnique(new V8DebuggerScript(m_isolate, script, false))); |
| 135 } | 133 } |
| 136 } | 134 } |
| 137 | 135 |
| 138 String16 V8Debugger::setBreakpoint(const String16& sourceID, | 136 String16 V8Debugger::setBreakpoint(const String16& sourceID, |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 577 m_inspector->enabledDebuggerAgentForGroup(getGroupId(eventContext)); | 575 m_inspector->enabledDebuggerAgentForGroup(getGroupId(eventContext)); |
| 578 if (agent) { | 576 if (agent) { |
| 579 v8::HandleScope scope(m_isolate); | 577 v8::HandleScope scope(m_isolate); |
| 580 if (m_ignoreScriptParsedEventsCounter == 0 && | 578 if (m_ignoreScriptParsedEventsCounter == 0 && |
| 581 (event == v8::AfterCompile || event == v8::CompileError)) { | 579 (event == v8::AfterCompile || event == v8::CompileError)) { |
| 582 v8::Local<v8::Context> context = debuggerContext(); | 580 v8::Local<v8::Context> context = debuggerContext(); |
| 583 v8::Context::Scope contextScope(context); | 581 v8::Context::Scope contextScope(context); |
| 584 v8::Local<v8::Value> argv[] = {eventDetails.GetEventData()}; | 582 v8::Local<v8::Value> argv[] = {eventDetails.GetEventData()}; |
| 585 v8::Local<v8::Value> value = | 583 v8::Local<v8::Value> value = |
| 586 callDebuggerMethod("getAfterCompileScript", 1, argv).ToLocalChecked(); | 584 callDebuggerMethod("getAfterCompileScript", 1, argv).ToLocalChecked(); |
| 587 if (value->IsNull()) return; | |
| 588 DCHECK(value->IsObject()); | 585 DCHECK(value->IsObject()); |
| 589 v8::Local<v8::Object> scriptObject = v8::Local<v8::Object>::Cast(value); | 586 v8::Local<v8::Object> scriptObject = v8::Local<v8::Object>::Cast(value); |
| 590 v8::Local<v8::DebugInterface::Script> script; | 587 v8::Local<v8::DebugInterface::Script> script; |
| 591 if (!v8::DebugInterface::Script::Wrap(m_isolate, scriptObject) | 588 if (!v8::DebugInterface::Script::Wrap(m_isolate, scriptObject) |
| 592 .ToLocal(&script)) | 589 .ToLocal(&script)) |
| 593 return; | 590 return; |
| 591 if (script->IsInspectorScript()) return; | |
|
Yang
2016/11/16 07:56:47
Can we filter at v8::internal::Debug::OnAfterCompi
kozy
2016/11/17 16:18:28
Done.
| |
| 594 agent->didParseSource( | 592 agent->didParseSource( |
| 595 wrapUnique(new V8DebuggerScript(m_isolate, script, inLiveEditScope)), | 593 wrapUnique(new V8DebuggerScript(m_isolate, script, inLiveEditScope)), |
| 596 event == v8::AfterCompile); | 594 event == v8::AfterCompile); |
| 597 } else if (event == v8::Exception) { | 595 } else if (event == v8::Exception) { |
| 598 v8::Local<v8::Context> context = debuggerContext(); | 596 v8::Local<v8::Context> context = debuggerContext(); |
| 599 v8::Local<v8::Object> eventData = eventDetails.GetEventData(); | 597 v8::Local<v8::Object> eventData = eventDetails.GetEventData(); |
| 600 v8::Local<v8::Value> exception = | 598 v8::Local<v8::Value> exception = |
| 601 callInternalGetterFunction(eventData, "exception"); | 599 callInternalGetterFunction(eventData, "exception"); |
| 602 v8::Local<v8::Value> promise = | 600 v8::Local<v8::Value> promise = |
| 603 callInternalGetterFunction(eventData, "promise"); | 601 callInternalGetterFunction(eventData, "promise"); |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 978 | 976 |
| 979 size_t stackSize = | 977 size_t stackSize = |
| 980 fullStack ? V8StackTraceImpl::maxCallStackSizeToCapture : 1; | 978 fullStack ? V8StackTraceImpl::maxCallStackSizeToCapture : 1; |
| 981 if (m_inspector->enabledRuntimeAgentForGroup(contextGroupId)) | 979 if (m_inspector->enabledRuntimeAgentForGroup(contextGroupId)) |
| 982 stackSize = V8StackTraceImpl::maxCallStackSizeToCapture; | 980 stackSize = V8StackTraceImpl::maxCallStackSizeToCapture; |
| 983 | 981 |
| 984 return V8StackTraceImpl::capture(this, contextGroupId, stackSize); | 982 return V8StackTraceImpl::capture(this, contextGroupId, stackSize); |
| 985 } | 983 } |
| 986 | 984 |
| 987 } // namespace v8_inspector | 985 } // namespace v8_inspector |
| OLD | NEW |