OLD | NEW |
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/inspector_protocol/String16.h" | 7 #include "platform/inspector_protocol/String16.h" |
8 #include "platform/v8_inspector/V8DebuggerImpl.h" | 8 #include "platform/v8_inspector/V8DebuggerImpl.h" |
9 #include "platform/v8_inspector/V8InspectorSessionImpl.h" | 9 #include "platform/v8_inspector/V8InspectorSessionImpl.h" |
10 #include "platform/v8_inspector/V8Regex.h" | 10 #include "platform/v8_inspector/V8Regex.h" |
11 #include "platform/v8_inspector/public/V8ContentSearchUtil.h" | |
12 | 11 |
13 namespace blink { | 12 namespace blink { |
14 | 13 |
15 namespace { | 14 namespace { |
16 | 15 |
17 String16 findMagicComment(const String16& content, const String16& name, bool mu
ltiline, bool* deprecated) | 16 String16 findMagicComment(const String16& content, const String16& name, bool mu
ltiline, bool* deprecated) |
18 { | 17 { |
19 DCHECK(name.find("=") == kNotFound); | 18 DCHECK(name.find("=") == kNotFound); |
20 if (deprecated) | 19 if (deprecated) |
21 *deprecated = false; | 20 *deprecated = false; |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 String16 findSourceURL(const String16& content, bool multiline, bool* deprecated
) | 195 String16 findSourceURL(const String16& content, bool multiline, bool* deprecated
) |
197 { | 196 { |
198 return findMagicComment(content, "sourceURL", multiline, deprecated); | 197 return findMagicComment(content, "sourceURL", multiline, deprecated); |
199 } | 198 } |
200 | 199 |
201 String16 findSourceMapURL(const String16& content, bool multiline, bool* depreca
ted) | 200 String16 findSourceMapURL(const String16& content, bool multiline, bool* depreca
ted) |
202 { | 201 { |
203 return findMagicComment(content, "sourceMappingURL", multiline, deprecated); | 202 return findMagicComment(content, "sourceMappingURL", multiline, deprecated); |
204 } | 203 } |
205 | 204 |
206 namespace V8ContentSearchUtil { | |
207 | |
208 std::unique_ptr<protocol::Array<protocol::Debugger::API::SearchMatch>> searchInT
extByLines(V8InspectorSession* session, const String16& text, const String16& qu
ery, const bool caseSensitive, const bool isRegex) | |
209 { | |
210 std::vector<std::unique_ptr<protocol::Debugger::SearchMatch>> matches = sear
chInTextByLinesImpl(session, text, query, caseSensitive, isRegex); | |
211 std::unique_ptr<protocol::Array<protocol::Debugger::API::SearchMatch>> resul
t = protocol::Array<protocol::Debugger::API::SearchMatch>::create(); | |
212 for (size_t i = 0; i < matches.size(); ++i) | |
213 result->addItem(std::move(matches[i])); | |
214 return result; | |
215 } | |
216 | |
217 } // namespace V8ContentSearchUtil | |
218 | |
219 std::unique_ptr<protocol::Value> toProtocolValue(v8::Local<v8::Context> context,
v8::Local<v8::Value> value, int maxDepth) | 205 std::unique_ptr<protocol::Value> toProtocolValue(v8::Local<v8::Context> context,
v8::Local<v8::Value> value, int maxDepth) |
220 { | 206 { |
221 if (value.IsEmpty()) { | 207 if (value.IsEmpty()) { |
222 NOTREACHED(); | 208 NOTREACHED(); |
223 return nullptr; | 209 return nullptr; |
224 } | 210 } |
225 | 211 |
226 if (!maxDepth) | 212 if (!maxDepth) |
227 return nullptr; | 213 return nullptr; |
228 maxDepth--; | 214 maxDepth--; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 return nullptr; | 269 return nullptr; |
284 jsonObject->setValue(toProtocolString(propertyName), std::move(prope
rtyValue)); | 270 jsonObject->setValue(toProtocolString(propertyName), std::move(prope
rtyValue)); |
285 } | 271 } |
286 return std::move(jsonObject); | 272 return std::move(jsonObject); |
287 } | 273 } |
288 NOTREACHED(); | 274 NOTREACHED(); |
289 return nullptr; | 275 return nullptr; |
290 } | 276 } |
291 | 277 |
292 } // namespace blink | 278 } // namespace blink |
OLD | NEW |