Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Side by Side Diff: src/inspector/search-util.cc

Issue 2523743003: Roll third_party/inspector_protocol to 73028acaa3646789fd2a3bfd0d79eb2d91b696b3 (Closed)
Patch Set: addressed comments Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/inspector/remote-object-id.cc ('k') | src/inspector/string-16.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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/search-util.h" 5 #include "src/inspector/search-util.h"
6 6
7 #include "src/inspector/protocol/Protocol.h" 7 #include "src/inspector/protocol/Protocol.h"
8 #include "src/inspector/v8-inspector-impl.h" 8 #include "src/inspector/v8-inspector-impl.h"
9 #include "src/inspector/v8-inspector-session-impl.h" 9 #include "src/inspector/v8-inspector-session-impl.h"
10 #include "src/inspector/v8-regex.h" 10 #include "src/inspector/v8-regex.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 return protocol::Debugger::SearchMatch::create() 125 return protocol::Debugger::SearchMatch::create()
126 .setLineNumber(lineNumber) 126 .setLineNumber(lineNumber)
127 .setLineContent(lineContent) 127 .setLineContent(lineContent)
128 .build(); 128 .build();
129 } 129 }
130 130
131 std::unique_ptr<V8Regex> createSearchRegex(V8InspectorImpl* inspector, 131 std::unique_ptr<V8Regex> createSearchRegex(V8InspectorImpl* inspector,
132 const String16& query, 132 const String16& query,
133 bool caseSensitive, bool isRegex) { 133 bool caseSensitive, bool isRegex) {
134 String16 regexSource = isRegex ? query : createSearchRegexSource(query); 134 String16 regexSource = isRegex ? query : createSearchRegexSource(query);
135 return wrapUnique(new V8Regex(inspector, regexSource, caseSensitive)); 135 return std::unique_ptr<V8Regex>(
136 new V8Regex(inspector, regexSource, caseSensitive));
136 } 137 }
137 138
138 } // namespace 139 } // namespace
139 140
140 std::vector<std::unique_ptr<protocol::Debugger::SearchMatch>> 141 std::vector<std::unique_ptr<protocol::Debugger::SearchMatch>>
141 searchInTextByLinesImpl(V8InspectorSession* session, const String16& text, 142 searchInTextByLinesImpl(V8InspectorSession* session, const String16& text,
142 const String16& query, const bool caseSensitive, 143 const String16& query, const bool caseSensitive,
143 const bool isRegex) { 144 const bool isRegex) {
144 std::unique_ptr<V8Regex> regex = createSearchRegex( 145 std::unique_ptr<V8Regex> regex = createSearchRegex(
145 static_cast<V8InspectorSessionImpl*>(session)->inspector(), query, 146 static_cast<V8InspectorSessionImpl*>(session)->inspector(), query,
146 caseSensitive, isRegex); 147 caseSensitive, isRegex);
147 std::vector<std::pair<int, String16>> matches = 148 std::vector<std::pair<int, String16>> matches =
148 scriptRegexpMatchesByLines(*regex.get(), text); 149 scriptRegexpMatchesByLines(*regex.get(), text);
149 150
150 std::vector<std::unique_ptr<protocol::Debugger::SearchMatch>> result; 151 std::vector<std::unique_ptr<protocol::Debugger::SearchMatch>> result;
151 for (const auto& match : matches) 152 for (const auto& match : matches)
152 result.push_back(buildObjectForSearchMatch(match.first, match.second)); 153 result.push_back(buildObjectForSearchMatch(match.first, match.second));
153 return result; 154 return result;
154 } 155 }
155 156
156 String16 findSourceURL(const String16& content, bool multiline) { 157 String16 findSourceURL(const String16& content, bool multiline) {
157 return findMagicComment(content, "sourceURL", multiline); 158 return findMagicComment(content, "sourceURL", multiline);
158 } 159 }
159 160
160 String16 findSourceMapURL(const String16& content, bool multiline) { 161 String16 findSourceMapURL(const String16& content, bool multiline) {
161 return findMagicComment(content, "sourceMappingURL", multiline); 162 return findMagicComment(content, "sourceMappingURL", multiline);
162 } 163 }
163 164
164 } // namespace v8_inspector 165 } // namespace v8_inspector
OLDNEW
« no previous file with comments | « src/inspector/remote-object-id.cc ('k') | src/inspector/string-16.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698