| 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" |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 { | 186 { |
| 187 std::unique_ptr<V8Regex> regex = createSearchRegex(static_cast<V8InspectorSe
ssionImpl*>(session)->debugger(), query, caseSensitive, isRegex); | 187 std::unique_ptr<V8Regex> regex = createSearchRegex(static_cast<V8InspectorSe
ssionImpl*>(session)->debugger(), query, caseSensitive, isRegex); |
| 188 std::vector<std::pair<int, String16>> matches = scriptRegexpMatchesByLines(*
regex.get(), text); | 188 std::vector<std::pair<int, String16>> matches = scriptRegexpMatchesByLines(*
regex.get(), text); |
| 189 | 189 |
| 190 std::vector<std::unique_ptr<protocol::Debugger::SearchMatch>> result; | 190 std::vector<std::unique_ptr<protocol::Debugger::SearchMatch>> result; |
| 191 for (const auto& match : matches) | 191 for (const auto& match : matches) |
| 192 result.push_back(buildObjectForSearchMatch(match.first, match.second)); | 192 result.push_back(buildObjectForSearchMatch(match.first, match.second)); |
| 193 return result; | 193 return result; |
| 194 } | 194 } |
| 195 | 195 |
| 196 namespace V8ContentSearchUtil { | |
| 197 | |
| 198 String16 findSourceURL(const String16& content, bool multiline, bool* deprecated
) | 196 String16 findSourceURL(const String16& content, bool multiline, bool* deprecated
) |
| 199 { | 197 { |
| 200 return findMagicComment(content, "sourceURL", multiline, deprecated); | 198 return findMagicComment(content, "sourceURL", multiline, deprecated); |
| 201 } | 199 } |
| 202 | 200 |
| 203 String16 findSourceMapURL(const String16& content, bool multiline, bool* depreca
ted) | 201 String16 findSourceMapURL(const String16& content, bool multiline, bool* depreca
ted) |
| 204 { | 202 { |
| 205 return findMagicComment(content, "sourceMappingURL", multiline, deprecated); | 203 return findMagicComment(content, "sourceMappingURL", multiline, deprecated); |
| 206 } | 204 } |
| 207 | 205 |
| 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) | 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 { | 209 { |
| 210 std::vector<std::unique_ptr<protocol::Debugger::SearchMatch>> matches = sear
chInTextByLinesImpl(session, text, query, caseSensitive, isRegex); | 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(); | 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) | 212 for (size_t i = 0; i < matches.size(); ++i) |
| 213 result->addItem(std::move(matches[i])); | 213 result->addItem(std::move(matches[i])); |
| 214 return result; | 214 return result; |
| 215 } | 215 } |
| 216 | 216 |
| 217 } // namespace V8ContentSearchUtil | 217 } // namespace V8ContentSearchUtil |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 return nullptr; | 283 return nullptr; |
| 284 jsonObject->setValue(toProtocolString(propertyName), std::move(prope
rtyValue)); | 284 jsonObject->setValue(toProtocolString(propertyName), std::move(prope
rtyValue)); |
| 285 } | 285 } |
| 286 return std::move(jsonObject); | 286 return std::move(jsonObject); |
| 287 } | 287 } |
| 288 NOTREACHED(); | 288 NOTREACHED(); |
| 289 return nullptr; | 289 return nullptr; |
| 290 } | 290 } |
| 291 | 291 |
| 292 } // namespace blink | 292 } // namespace blink |
| OLD | NEW |