OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium 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 "platform/v8_inspector/V8DebuggerAgentImpl.h" | 5 #include "platform/v8_inspector/V8DebuggerAgentImpl.h" |
6 | 6 |
7 #include "platform/inspector_protocol/String16.h" | 7 #include "platform/inspector_protocol/String16.h" |
8 #include "platform/inspector_protocol/Values.h" | 8 #include "platform/inspector_protocol/Values.h" |
9 #include "platform/v8_inspector/InjectedScript.h" | 9 #include "platform/v8_inspector/InjectedScript.h" |
10 #include "platform/v8_inspector/InspectedContext.h" | 10 #include "platform/v8_inspector/InspectedContext.h" |
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 return buildProtocolLocation(scriptId, actualLineNumber, actualColumnNumber)
; | 509 return buildProtocolLocation(scriptId, actualLineNumber, actualColumnNumber)
; |
510 } | 510 } |
511 | 511 |
512 void V8DebuggerAgentImpl::searchInContent(ErrorString* error, const String16& sc
riptId, const String16& query, | 512 void V8DebuggerAgentImpl::searchInContent(ErrorString* error, const String16& sc
riptId, const String16& query, |
513 const Maybe<bool>& optionalCaseSensitive, | 513 const Maybe<bool>& optionalCaseSensitive, |
514 const Maybe<bool>& optionalIsRegex, | 514 const Maybe<bool>& optionalIsRegex, |
515 std::unique_ptr<Array<protocol::Debugger::SearchMatch>>* results) | 515 std::unique_ptr<Array<protocol::Debugger::SearchMatch>>* results) |
516 { | 516 { |
517 v8::HandleScope handles(m_isolate); | 517 v8::HandleScope handles(m_isolate); |
518 ScriptsMap::iterator it = m_scripts.find(scriptId); | 518 ScriptsMap::iterator it = m_scripts.find(scriptId); |
519 if (it != m_scripts.end()) | 519 if (it == m_scripts.end()) { |
520 *results = V8ContentSearchUtil::searchInTextByLines(m_session, toProtoco
lString(it->second->source(m_isolate)), query, optionalCaseSensitive.fromMaybe(f
alse), optionalIsRegex.fromMaybe(false)); | |
521 else | |
522 *error = String16("No script for id: " + scriptId); | 520 *error = String16("No script for id: " + scriptId); |
| 521 return; |
| 522 } |
| 523 |
| 524 std::vector<std::unique_ptr<protocol::Debugger::SearchMatch>> matches = sear
chInTextByLinesImpl(m_session, toProtocolString(it->second->source(m_isolate)),
query, optionalCaseSensitive.fromMaybe(false), optionalIsRegex.fromMaybe(false))
; |
| 525 *results = protocol::Array<protocol::Debugger::SearchMatch>::create(); |
| 526 for (size_t i = 0; i < matches.size(); ++i) |
| 527 (*results)->addItem(std::move(matches[i])); |
523 } | 528 } |
524 | 529 |
525 void V8DebuggerAgentImpl::setScriptSource(ErrorString* errorString, | 530 void V8DebuggerAgentImpl::setScriptSource(ErrorString* errorString, |
526 const String16& scriptId, | 531 const String16& scriptId, |
527 const String16& newContent, | 532 const String16& newContent, |
528 const Maybe<bool>& preview, | 533 const Maybe<bool>& preview, |
529 Maybe<protocol::Array<protocol::Debugger::CallFrame>>* newCallFrames, | 534 Maybe<protocol::Array<protocol::Debugger::CallFrame>>* newCallFrames, |
530 Maybe<bool>* stackChanged, | 535 Maybe<bool>* stackChanged, |
531 Maybe<StackTrace>* asyncStackTrace, | 536 Maybe<StackTrace>* asyncStackTrace, |
532 Maybe<protocol::Runtime::ExceptionDetails>* optOutCompileError) | 537 Maybe<protocol::Runtime::ExceptionDetails>* optOutCompileError) |
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1180 { | 1185 { |
1181 if (!enabled()) | 1186 if (!enabled()) |
1182 return; | 1187 return; |
1183 m_scheduledDebuggerStep = NoStep; | 1188 m_scheduledDebuggerStep = NoStep; |
1184 m_scripts.clear(); | 1189 m_scripts.clear(); |
1185 m_blackboxedPositions.clear(); | 1190 m_blackboxedPositions.clear(); |
1186 m_breakpointIdToDebuggerBreakpointIds.clear(); | 1191 m_breakpointIdToDebuggerBreakpointIds.clear(); |
1187 } | 1192 } |
1188 | 1193 |
1189 } // namespace blink | 1194 } // namespace blink |
OLD | NEW |