Chromium Code Reviews| 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 auto& scriptRef = m_scripts[scriptId]; | |
|
kozy
2016/11/15 22:25:08
I prefer something like:
ScriptsMap::iterator scri
jgruber
2016/11/16 08:06:47
Done.
| |
| 1032 | |
| 1033 Maybe<String16> sourceMapURLParam = scriptRef->sourceMappingURL(); | |
| 1031 Maybe<protocol::DictionaryValue> executionContextAuxDataParam( | 1034 Maybe<protocol::DictionaryValue> executionContextAuxDataParam( |
| 1032 std::move(executionContextAuxData)); | 1035 std::move(executionContextAuxData)); |
| 1033 const bool* isLiveEditParam = isLiveEdit ? &isLiveEdit : nullptr; | 1036 const bool* isLiveEditParam = isLiveEdit ? &isLiveEdit : nullptr; |
| 1034 const bool* hasSourceURLParam = hasSourceURL ? &hasSourceURL : nullptr; | 1037 const bool* hasSourceURLParam = hasSourceURL ? &hasSourceURL : nullptr; |
| 1035 if (success) | 1038 if (success) |
| 1036 m_frontend.scriptParsed( | 1039 m_frontend.scriptParsed( |
| 1037 scriptId, scriptURL, script->startLine(), script->startColumn(), | 1040 scriptId, scriptURL, scriptRef->startLine(), scriptRef->startColumn(), |
| 1038 script->endLine(), script->endColumn(), script->executionContextId(), | 1041 scriptRef->endLine(), scriptRef->endColumn(), |
| 1039 script->hash(), std::move(executionContextAuxDataParam), | 1042 scriptRef->executionContextId(), scriptRef->hash(), |
| 1040 isLiveEditParam, std::move(sourceMapURLParam), hasSourceURLParam); | 1043 std::move(executionContextAuxDataParam), isLiveEditParam, |
| 1044 std::move(sourceMapURLParam), hasSourceURLParam); | |
| 1041 else | 1045 else |
| 1042 m_frontend.scriptFailedToParse( | 1046 m_frontend.scriptFailedToParse( |
| 1043 scriptId, scriptURL, script->startLine(), script->startColumn(), | 1047 scriptId, scriptURL, scriptRef->startLine(), scriptRef->startColumn(), |
| 1044 script->endLine(), script->endColumn(), script->executionContextId(), | 1048 scriptRef->endLine(), scriptRef->endColumn(), |
| 1045 script->hash(), std::move(executionContextAuxDataParam), | 1049 scriptRef->executionContextId(), scriptRef->hash(), |
| 1046 std::move(sourceMapURLParam), hasSourceURLParam); | 1050 std::move(executionContextAuxDataParam), std::move(sourceMapURLParam), |
| 1047 | 1051 hasSourceURLParam); |
| 1048 m_scripts[scriptId] = std::move(script); | |
| 1049 | 1052 |
| 1050 if (scriptURL.isEmpty() || !success) return; | 1053 if (scriptURL.isEmpty() || !success) return; |
| 1051 | 1054 |
| 1052 protocol::DictionaryValue* breakpointsCookie = | 1055 protocol::DictionaryValue* breakpointsCookie = |
| 1053 m_state->getObject(DebuggerAgentState::javaScriptBreakpoints); | 1056 m_state->getObject(DebuggerAgentState::javaScriptBreakpoints); |
| 1054 if (!breakpointsCookie) return; | 1057 if (!breakpointsCookie) return; |
| 1055 | 1058 |
| 1056 for (size_t i = 0; i < breakpointsCookie->size(); ++i) { | 1059 for (size_t i = 0; i < breakpointsCookie->size(); ++i) { |
| 1057 auto cookie = breakpointsCookie->at(i); | 1060 auto cookie = breakpointsCookie->at(i); |
| 1058 protocol::DictionaryValue* breakpointObject = | 1061 protocol::DictionaryValue* breakpointObject = |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1224 | 1227 |
| 1225 void V8DebuggerAgentImpl::reset() { | 1228 void V8DebuggerAgentImpl::reset() { |
| 1226 if (!enabled()) return; | 1229 if (!enabled()) return; |
| 1227 m_scheduledDebuggerStep = NoStep; | 1230 m_scheduledDebuggerStep = NoStep; |
| 1228 m_scripts.clear(); | 1231 m_scripts.clear(); |
| 1229 m_blackboxedPositions.clear(); | 1232 m_blackboxedPositions.clear(); |
| 1230 m_breakpointIdToDebuggerBreakpointIds.clear(); | 1233 m_breakpointIdToDebuggerBreakpointIds.clear(); |
| 1231 } | 1234 } |
| 1232 | 1235 |
| 1233 } // namespace v8_inspector | 1236 } // namespace v8_inspector |
| OLD | NEW |