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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 } | 159 } |
160 size_t bestMatch; | 160 size_t bestMatch; |
161 if (nextMatch == String16::kNotFound) { | 161 if (nextMatch == String16::kNotFound) { |
162 bestMatch = prevMatch; | 162 bestMatch = prevMatch; |
163 } else if (prevMatch == String16::kNotFound) { | 163 } else if (prevMatch == String16::kNotFound) { |
164 bestMatch = nextMatch; | 164 bestMatch = nextMatch; |
165 } else { | 165 } else { |
166 bestMatch = nextMatch - offset < offset - prevMatch ? nextMatch : prevMatch; | 166 bestMatch = nextMatch - offset < offset - prevMatch ? nextMatch : prevMatch; |
167 } | 167 } |
168 bestMatch += searchRegionOffset; | 168 bestMatch += searchRegionOffset; |
169 v8::debug::Location hintPosition = script.location(bestMatch); | 169 v8::debug::Location hintPosition = |
| 170 script.location(static_cast<int>(bestMatch)); |
170 if (hintPosition.IsEmpty()) return; | 171 if (hintPosition.IsEmpty()) return; |
171 breakpoint->line_number = hintPosition.GetLineNumber(); | 172 breakpoint->line_number = hintPosition.GetLineNumber(); |
172 breakpoint->column_number = hintPosition.GetColumnNumber(); | 173 breakpoint->column_number = hintPosition.GetColumnNumber(); |
173 } | 174 } |
174 | 175 |
175 String16 breakLocationType(v8::debug::BreakLocationType type) { | 176 String16 breakLocationType(v8::debug::BreakLocationType type) { |
176 switch (type) { | 177 switch (type) { |
177 case v8::debug::kCallBreakLocation: | 178 case v8::debug::kCallBreakLocation: |
178 return protocol::Debugger::BreakLocation::TypeEnum::Call; | 179 return protocol::Debugger::BreakLocation::TypeEnum::Call; |
179 case v8::debug::kReturnBreakLocation: | 180 case v8::debug::kReturnBreakLocation: |
(...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1089 std::unique_ptr<V8StackTraceImpl> stack = | 1090 std::unique_ptr<V8StackTraceImpl> stack = |
1090 V8StackTraceImpl::capture(m_inspector->debugger(), contextGroupId, 1); | 1091 V8StackTraceImpl::capture(m_inspector->debugger(), contextGroupId, 1); |
1091 std::unique_ptr<protocol::Runtime::StackTrace> stackTrace = | 1092 std::unique_ptr<protocol::Runtime::StackTrace> stackTrace = |
1092 stack && !stack->isEmpty() ? stack->buildInspectorObjectImpl() : nullptr; | 1093 stack && !stack->isEmpty() ? stack->buildInspectorObjectImpl() : nullptr; |
1093 if (success) { | 1094 if (success) { |
1094 m_frontend.scriptParsed( | 1095 m_frontend.scriptParsed( |
1095 scriptId, scriptURL, scriptRef->startLine(), scriptRef->startColumn(), | 1096 scriptId, scriptURL, scriptRef->startLine(), scriptRef->startColumn(), |
1096 scriptRef->endLine(), scriptRef->endColumn(), contextId, | 1097 scriptRef->endLine(), scriptRef->endColumn(), contextId, |
1097 scriptRef->hash(), std::move(executionContextAuxDataParam), | 1098 scriptRef->hash(), std::move(executionContextAuxDataParam), |
1098 isLiveEditParam, std::move(sourceMapURLParam), hasSourceURLParam, | 1099 isLiveEditParam, std::move(sourceMapURLParam), hasSourceURLParam, |
1099 isModuleParam, scriptRef->source().length(), std::move(stackTrace)); | 1100 isModuleParam, static_cast<int>(scriptRef->source().length()), |
| 1101 std::move(stackTrace)); |
1100 } else { | 1102 } else { |
1101 m_frontend.scriptFailedToParse( | 1103 m_frontend.scriptFailedToParse( |
1102 scriptId, scriptURL, scriptRef->startLine(), scriptRef->startColumn(), | 1104 scriptId, scriptURL, scriptRef->startLine(), scriptRef->startColumn(), |
1103 scriptRef->endLine(), scriptRef->endColumn(), contextId, | 1105 scriptRef->endLine(), scriptRef->endColumn(), contextId, |
1104 scriptRef->hash(), std::move(executionContextAuxDataParam), | 1106 scriptRef->hash(), std::move(executionContextAuxDataParam), |
1105 std::move(sourceMapURLParam), hasSourceURLParam, isModuleParam, | 1107 std::move(sourceMapURLParam), hasSourceURLParam, isModuleParam, |
1106 scriptRef->source().length(), std::move(stackTrace)); | 1108 static_cast<int>(scriptRef->source().length()), std::move(stackTrace)); |
1107 } | 1109 } |
1108 | 1110 |
1109 if (scriptURL.isEmpty() || !success) return; | 1111 if (scriptURL.isEmpty() || !success) return; |
1110 | 1112 |
1111 protocol::DictionaryValue* breakpointsCookie = | 1113 protocol::DictionaryValue* breakpointsCookie = |
1112 m_state->getObject(DebuggerAgentState::javaScriptBreakpoints); | 1114 m_state->getObject(DebuggerAgentState::javaScriptBreakpoints); |
1113 if (!breakpointsCookie) return; | 1115 if (!breakpointsCookie) return; |
1114 | 1116 |
1115 for (size_t i = 0; i < breakpointsCookie->size(); ++i) { | 1117 for (size_t i = 0; i < breakpointsCookie->size(); ++i) { |
1116 auto cookie = breakpointsCookie->at(i); | 1118 auto cookie = breakpointsCookie->at(i); |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1296 | 1298 |
1297 void V8DebuggerAgentImpl::reset() { | 1299 void V8DebuggerAgentImpl::reset() { |
1298 if (!enabled()) return; | 1300 if (!enabled()) return; |
1299 m_blackboxedPositions.clear(); | 1301 m_blackboxedPositions.clear(); |
1300 resetBlackboxedStateCache(); | 1302 resetBlackboxedStateCache(); |
1301 m_scripts.clear(); | 1303 m_scripts.clear(); |
1302 m_breakpointIdToDebuggerBreakpointIds.clear(); | 1304 m_breakpointIdToDebuggerBreakpointIds.clear(); |
1303 } | 1305 } |
1304 | 1306 |
1305 } // namespace v8_inspector | 1307 } // namespace v8_inspector |
OLD | NEW |