| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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-agent-impl.h" | 5 #include "src/inspector/v8-debugger-agent-impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "src/debug/debug-interface.h" | 9 #include "src/debug/debug-interface.h" |
| 10 #include "src/inspector/injected-script.h" | 10 #include "src/inspector/injected-script.h" |
| (...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 987 m_inspector->getContext(contextGroupId, contextId); | 987 m_inspector->getContext(contextGroupId, contextId); |
| 988 std::unique_ptr<protocol::DictionaryValue> executionContextAuxData; | 988 std::unique_ptr<protocol::DictionaryValue> executionContextAuxData; |
| 989 if (inspected) { | 989 if (inspected) { |
| 990 // Script reused between different groups/sessions can have a stale | 990 // Script reused between different groups/sessions can have a stale |
| 991 // execution context id. | 991 // execution context id. |
| 992 executionContextAuxData = protocol::DictionaryValue::cast( | 992 executionContextAuxData = protocol::DictionaryValue::cast( |
| 993 protocol::StringUtil::parseJSON(inspected->auxData())); | 993 protocol::StringUtil::parseJSON(inspected->auxData())); |
| 994 } | 994 } |
| 995 bool isLiveEdit = script->isLiveEdit(); | 995 bool isLiveEdit = script->isLiveEdit(); |
| 996 bool hasSourceURL = script->hasSourceURL(); | 996 bool hasSourceURL = script->hasSourceURL(); |
| 997 bool isModule = script->isModule(); |
| 997 String16 scriptId = script->scriptId(); | 998 String16 scriptId = script->scriptId(); |
| 998 String16 scriptURL = script->sourceURL(); | 999 String16 scriptURL = script->sourceURL(); |
| 999 | 1000 |
| 1000 m_scripts[scriptId] = std::move(script); | 1001 m_scripts[scriptId] = std::move(script); |
| 1001 | 1002 |
| 1002 ScriptsMap::iterator scriptIterator = m_scripts.find(scriptId); | 1003 ScriptsMap::iterator scriptIterator = m_scripts.find(scriptId); |
| 1003 DCHECK(scriptIterator != m_scripts.end()); | 1004 DCHECK(scriptIterator != m_scripts.end()); |
| 1004 V8DebuggerScript* scriptRef = scriptIterator->second.get(); | 1005 V8DebuggerScript* scriptRef = scriptIterator->second.get(); |
| 1005 // V8 could create functions for parsed scripts before reporting and asks | 1006 // V8 could create functions for parsed scripts before reporting and asks |
| 1006 // inspector about blackboxed state, we should reset state each time when we | 1007 // inspector about blackboxed state, we should reset state each time when we |
| 1007 // make any change that change isFunctionBlackboxed output - adding parsed | 1008 // make any change that change isFunctionBlackboxed output - adding parsed |
| 1008 // script is changing. | 1009 // script is changing. |
| 1009 scriptRef->resetBlackboxedStateCache(); | 1010 scriptRef->resetBlackboxedStateCache(); |
| 1010 | 1011 |
| 1011 Maybe<String16> sourceMapURLParam = scriptRef->sourceMappingURL(); | 1012 Maybe<String16> sourceMapURLParam = scriptRef->sourceMappingURL(); |
| 1012 Maybe<protocol::DictionaryValue> executionContextAuxDataParam( | 1013 Maybe<protocol::DictionaryValue> executionContextAuxDataParam( |
| 1013 std::move(executionContextAuxData)); | 1014 std::move(executionContextAuxData)); |
| 1014 const bool* isLiveEditParam = isLiveEdit ? &isLiveEdit : nullptr; | 1015 const bool* isLiveEditParam = isLiveEdit ? &isLiveEdit : nullptr; |
| 1015 const bool* hasSourceURLParam = hasSourceURL ? &hasSourceURL : nullptr; | 1016 const bool* hasSourceURLParam = hasSourceURL ? &hasSourceURL : nullptr; |
| 1017 const bool* isModuleParam = isModule ? &isModule : nullptr; |
| 1016 if (success) | 1018 if (success) |
| 1017 m_frontend.scriptParsed( | 1019 m_frontend.scriptParsed( |
| 1018 scriptId, scriptURL, scriptRef->startLine(), scriptRef->startColumn(), | 1020 scriptId, scriptURL, scriptRef->startLine(), scriptRef->startColumn(), |
| 1019 scriptRef->endLine(), scriptRef->endColumn(), contextId, | 1021 scriptRef->endLine(), scriptRef->endColumn(), contextId, |
| 1020 scriptRef->hash(m_isolate), std::move(executionContextAuxDataParam), | 1022 scriptRef->hash(m_isolate), std::move(executionContextAuxDataParam), |
| 1021 isLiveEditParam, std::move(sourceMapURLParam), hasSourceURLParam); | 1023 isLiveEditParam, std::move(sourceMapURLParam), hasSourceURLParam, |
| 1024 isModuleParam); |
| 1022 else | 1025 else |
| 1023 m_frontend.scriptFailedToParse( | 1026 m_frontend.scriptFailedToParse( |
| 1024 scriptId, scriptURL, scriptRef->startLine(), scriptRef->startColumn(), | 1027 scriptId, scriptURL, scriptRef->startLine(), scriptRef->startColumn(), |
| 1025 scriptRef->endLine(), scriptRef->endColumn(), contextId, | 1028 scriptRef->endLine(), scriptRef->endColumn(), contextId, |
| 1026 scriptRef->hash(m_isolate), std::move(executionContextAuxDataParam), | 1029 scriptRef->hash(m_isolate), std::move(executionContextAuxDataParam), |
| 1027 std::move(sourceMapURLParam), hasSourceURLParam); | 1030 std::move(sourceMapURLParam), hasSourceURLParam, isModuleParam); |
| 1028 | 1031 |
| 1029 if (scriptURL.isEmpty() || !success) return; | 1032 if (scriptURL.isEmpty() || !success) return; |
| 1030 | 1033 |
| 1031 protocol::DictionaryValue* breakpointsCookie = | 1034 protocol::DictionaryValue* breakpointsCookie = |
| 1032 m_state->getObject(DebuggerAgentState::javaScriptBreakpoints); | 1035 m_state->getObject(DebuggerAgentState::javaScriptBreakpoints); |
| 1033 if (!breakpointsCookie) return; | 1036 if (!breakpointsCookie) return; |
| 1034 | 1037 |
| 1035 for (size_t i = 0; i < breakpointsCookie->size(); ++i) { | 1038 for (size_t i = 0; i < breakpointsCookie->size(); ++i) { |
| 1036 auto cookie = breakpointsCookie->at(i); | 1039 auto cookie = breakpointsCookie->at(i); |
| 1037 protocol::DictionaryValue* breakpointObject = | 1040 protocol::DictionaryValue* breakpointObject = |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1186 void V8DebuggerAgentImpl::reset() { | 1189 void V8DebuggerAgentImpl::reset() { |
| 1187 if (!enabled()) return; | 1190 if (!enabled()) return; |
| 1188 m_scheduledDebuggerStep = NoStep; | 1191 m_scheduledDebuggerStep = NoStep; |
| 1189 m_blackboxedPositions.clear(); | 1192 m_blackboxedPositions.clear(); |
| 1190 resetBlackboxedStateCache(); | 1193 resetBlackboxedStateCache(); |
| 1191 m_scripts.clear(); | 1194 m_scripts.clear(); |
| 1192 m_breakpointIdToDebuggerBreakpointIds.clear(); | 1195 m_breakpointIdToDebuggerBreakpointIds.clear(); |
| 1193 } | 1196 } |
| 1194 | 1197 |
| 1195 } // namespace v8_inspector | 1198 } // namespace v8_inspector |
| OLD | NEW |