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

Side by Side Diff: third_party/WebKit/Source/platform/v8_inspector/V8StringUtil.cpp

Issue 1702673002: DevTools: migrate remote debugging protocol generators to jinja2. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/V8StringUtil.h" 5 #include "platform/v8_inspector/V8StringUtil.h"
6 6
7 #include "platform/v8_inspector/V8DebuggerImpl.h" 7 #include "platform/v8_inspector/V8DebuggerImpl.h"
8 #include "platform/v8_inspector/V8Regex.h" 8 #include "platform/v8_inspector/V8Regex.h"
9 #include "platform/v8_inspector/public/V8ContentSearchUtil.h" 9 #include "platform/v8_inspector/public/V8ContentSearchUtil.h"
10 #include "wtf/text/StringBuilder.h" 10 #include "wtf/text/StringBuilder.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 111
112 int matchLength; 112 int matchLength;
113 if (regex.match(line, 0, &matchLength) != -1) 113 if (regex.match(line, 0, &matchLength) != -1)
114 result.append(std::pair<int, String>(lineNumber, line)); 114 result.append(std::pair<int, String>(lineNumber, line));
115 115
116 start = lineEnd + 1; 116 start = lineEnd + 1;
117 } 117 }
118 return result; 118 return result;
119 } 119 }
120 120
121 PassRefPtr<protocol::TypeBuilder::Debugger::SearchMatch> buildObjectForSearchMat ch(int lineNumber, const String& lineContent) 121 PassOwnPtr<protocol::Debugger::SearchMatch> buildObjectForSearchMatch(int lineNu mber, const String& lineContent)
122 { 122 {
123 return protocol::TypeBuilder::Debugger::SearchMatch::create() 123 return protocol::Debugger::SearchMatch::create()
124 .setLineNumber(lineNumber) 124 .setLineNumber(lineNumber)
125 .setLineContent(lineContent) 125 .setLineContent(lineContent)
126 .release(); 126 .build();
127 } 127 }
128 128
129 PassOwnPtr<V8Regex> createSearchRegex(V8DebuggerImpl* debugger, const String& qu ery, bool caseSensitive, bool isRegex) 129 PassOwnPtr<V8Regex> createSearchRegex(V8DebuggerImpl* debugger, const String& qu ery, bool caseSensitive, bool isRegex)
130 { 130 {
131 String regexSource = isRegex ? query : createSearchRegexSource(query); 131 String regexSource = isRegex ? query : createSearchRegexSource(query);
132 return adoptPtr(new V8Regex(debugger, regexSource, caseSensitive ? TextCaseS ensitive : TextCaseInsensitive)); 132 return adoptPtr(new V8Regex(debugger, regexSource, caseSensitive ? TextCaseS ensitive : TextCaseInsensitive));
133 } 133 }
134 134
135 } // namespace 135 } // namespace
136 136
(...skipping 29 matching lines...) Expand all
166 String findSourceURL(const String& content, bool multiline, bool* deprecated) 166 String findSourceURL(const String& content, bool multiline, bool* deprecated)
167 { 167 {
168 return findMagicComment(content, "sourceURL", multiline, deprecated); 168 return findMagicComment(content, "sourceURL", multiline, deprecated);
169 } 169 }
170 170
171 String findSourceMapURL(const String& content, bool multiline, bool* deprecated) 171 String findSourceMapURL(const String& content, bool multiline, bool* deprecated)
172 { 172 {
173 return findMagicComment(content, "sourceMappingURL", multiline, deprecated); 173 return findMagicComment(content, "sourceMappingURL", multiline, deprecated);
174 } 174 }
175 175
176 PassRefPtr<protocol::TypeBuilder::Array<protocol::TypeBuilder::Debugger::SearchM atch>> searchInTextByLines(V8Debugger* debugger, const String& text, const Strin g& query, const bool caseSensitive, const bool isRegex) 176 PassOwnPtr<protocol::Array<protocol::Debugger::SearchMatch>> searchInTextByLines (V8Debugger* debugger, const String& text, const String& query, const bool caseS ensitive, const bool isRegex)
177 { 177 {
178 RefPtr<protocol::TypeBuilder::Array<protocol::TypeBuilder::Debugger::SearchM atch>> result = protocol::TypeBuilder::Array<protocol::TypeBuilder::Debugger::Se archMatch>::create(); 178 OwnPtr<protocol::Array<protocol::Debugger::SearchMatch>> result = protocol:: Array<protocol::Debugger::SearchMatch>::create();
179 OwnPtr<V8Regex> regex = createSearchRegex(static_cast<V8DebuggerImpl*>(debug ger), query, caseSensitive, isRegex); 179 OwnPtr<V8Regex> regex = createSearchRegex(static_cast<V8DebuggerImpl*>(debug ger), query, caseSensitive, isRegex);
180 Vector<std::pair<int, String>> matches = scriptRegexpMatchesByLines(*regex.g et(), text); 180 Vector<std::pair<int, String>> matches = scriptRegexpMatchesByLines(*regex.g et(), text);
181 181
182 for (const auto& match : matches) 182 for (const auto& match : matches)
183 result->addItem(buildObjectForSearchMatch(match.first, match.second)); 183 result->addItem(buildObjectForSearchMatch(match.first, match.second));
184 184
185 return result; 185 return result.release();
186 } 186 }
187 187
188 } // namespace V8ContentSearchUtil 188 } // namespace V8ContentSearchUtil
189 189
190 } // namespace blink 190 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698