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 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1020 | 1020 |
1021 std::unique_ptr<protocol::DictionaryValue> executionContextAuxData; | 1021 std::unique_ptr<protocol::DictionaryValue> executionContextAuxData; |
1022 if (!script->executionContextAuxData().isEmpty()) | 1022 if (!script->executionContextAuxData().isEmpty()) |
1023 executionContextAuxData = protocol::DictionaryValue::cast( | 1023 executionContextAuxData = protocol::DictionaryValue::cast( |
1024 protocol::parseJSON(script->executionContextAuxData())); | 1024 protocol::parseJSON(script->executionContextAuxData())); |
1025 bool isLiveEdit = script->isLiveEdit(); | 1025 bool isLiveEdit = script->isLiveEdit(); |
1026 bool hasSourceURL = script->hasSourceURL(); | 1026 bool hasSourceURL = script->hasSourceURL(); |
1027 String16 scriptId = script->scriptId(); | 1027 String16 scriptId = script->scriptId(); |
1028 String16 scriptURL = script->sourceURL(); | 1028 String16 scriptURL = script->sourceURL(); |
1029 | 1029 |
1030 Maybe<String16> sourceMapURLParam = script->sourceMappingURL(); | 1030 m_scripts[scriptId] = std::move(script); |
| 1031 |
| 1032 ScriptsMap::iterator scriptIterator = m_scripts.find(scriptId); |
| 1033 DCHECK(scriptIterator != m_scripts.end()); |
| 1034 V8DebuggerScript* scriptRef = scriptIterator->second.get(); |
| 1035 |
| 1036 Maybe<String16> sourceMapURLParam = scriptRef->sourceMappingURL(); |
1031 Maybe<protocol::DictionaryValue> executionContextAuxDataParam( | 1037 Maybe<protocol::DictionaryValue> executionContextAuxDataParam( |
1032 std::move(executionContextAuxData)); | 1038 std::move(executionContextAuxData)); |
1033 const bool* isLiveEditParam = isLiveEdit ? &isLiveEdit : nullptr; | 1039 const bool* isLiveEditParam = isLiveEdit ? &isLiveEdit : nullptr; |
1034 const bool* hasSourceURLParam = hasSourceURL ? &hasSourceURL : nullptr; | 1040 const bool* hasSourceURLParam = hasSourceURL ? &hasSourceURL : nullptr; |
1035 if (success) | 1041 if (success) |
1036 m_frontend.scriptParsed( | 1042 m_frontend.scriptParsed( |
1037 scriptId, scriptURL, script->startLine(), script->startColumn(), | 1043 scriptId, scriptURL, scriptRef->startLine(), scriptRef->startColumn(), |
1038 script->endLine(), script->endColumn(), script->executionContextId(), | 1044 scriptRef->endLine(), scriptRef->endColumn(), |
1039 script->hash(), std::move(executionContextAuxDataParam), | 1045 scriptRef->executionContextId(), scriptRef->hash(), |
1040 isLiveEditParam, std::move(sourceMapURLParam), hasSourceURLParam); | 1046 std::move(executionContextAuxDataParam), isLiveEditParam, |
| 1047 std::move(sourceMapURLParam), hasSourceURLParam); |
1041 else | 1048 else |
1042 m_frontend.scriptFailedToParse( | 1049 m_frontend.scriptFailedToParse( |
1043 scriptId, scriptURL, script->startLine(), script->startColumn(), | 1050 scriptId, scriptURL, scriptRef->startLine(), scriptRef->startColumn(), |
1044 script->endLine(), script->endColumn(), script->executionContextId(), | 1051 scriptRef->endLine(), scriptRef->endColumn(), |
1045 script->hash(), std::move(executionContextAuxDataParam), | 1052 scriptRef->executionContextId(), scriptRef->hash(), |
1046 std::move(sourceMapURLParam), hasSourceURLParam); | 1053 std::move(executionContextAuxDataParam), std::move(sourceMapURLParam), |
1047 | 1054 hasSourceURLParam); |
1048 m_scripts[scriptId] = std::move(script); | |
1049 | 1055 |
1050 if (scriptURL.isEmpty() || !success) return; | 1056 if (scriptURL.isEmpty() || !success) return; |
1051 | 1057 |
1052 protocol::DictionaryValue* breakpointsCookie = | 1058 protocol::DictionaryValue* breakpointsCookie = |
1053 m_state->getObject(DebuggerAgentState::javaScriptBreakpoints); | 1059 m_state->getObject(DebuggerAgentState::javaScriptBreakpoints); |
1054 if (!breakpointsCookie) return; | 1060 if (!breakpointsCookie) return; |
1055 | 1061 |
1056 for (size_t i = 0; i < breakpointsCookie->size(); ++i) { | 1062 for (size_t i = 0; i < breakpointsCookie->size(); ++i) { |
1057 auto cookie = breakpointsCookie->at(i); | 1063 auto cookie = breakpointsCookie->at(i); |
1058 protocol::DictionaryValue* breakpointObject = | 1064 protocol::DictionaryValue* breakpointObject = |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1224 | 1230 |
1225 void V8DebuggerAgentImpl::reset() { | 1231 void V8DebuggerAgentImpl::reset() { |
1226 if (!enabled()) return; | 1232 if (!enabled()) return; |
1227 m_scheduledDebuggerStep = NoStep; | 1233 m_scheduledDebuggerStep = NoStep; |
1228 m_scripts.clear(); | 1234 m_scripts.clear(); |
1229 m_blackboxedPositions.clear(); | 1235 m_blackboxedPositions.clear(); |
1230 m_breakpointIdToDebuggerBreakpointIds.clear(); | 1236 m_breakpointIdToDebuggerBreakpointIds.clear(); |
1231 } | 1237 } |
1232 | 1238 |
1233 } // namespace v8_inspector | 1239 } // namespace v8_inspector |
OLD | NEW |