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

Unified Diff: third_party/WebKit/Source/platform/v8_inspector/V8StringUtil.cpp

Issue 2159633002: [DevTools] Generate public versions of protocol classes to be exposed in v8_inspector/public. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: removed extra files Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/v8_inspector/V8StringUtil.cpp
diff --git a/third_party/WebKit/Source/platform/v8_inspector/V8StringUtil.cpp b/third_party/WebKit/Source/platform/v8_inspector/V8StringUtil.cpp
index 4ba7898bc581621b6330061948a2d1ed69415156..843c7c0eb048772f4274ead287b9ef24c57cc34d 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/V8StringUtil.cpp
+++ b/third_party/WebKit/Source/platform/v8_inspector/V8StringUtil.cpp
@@ -182,6 +182,17 @@ String16 toProtocolStringWithTypeCheck(v8::Local<v8::Value> value)
return toProtocolString(value.As<v8::String>());
}
+std::vector<std::unique_ptr<protocol::Debugger::SearchMatch>> searchInTextByLinesImpl(V8InspectorSession* session, const String16& text, const String16& query, const bool caseSensitive, const bool isRegex)
+{
+ std::unique_ptr<V8Regex> regex = createSearchRegex(static_cast<V8InspectorSessionImpl*>(session)->debugger(), query, caseSensitive, isRegex);
+ std::vector<std::pair<int, String16>> matches = scriptRegexpMatchesByLines(*regex.get(), text);
+
+ std::vector<std::unique_ptr<protocol::Debugger::SearchMatch>> result;
+ for (const auto& match : matches)
+ result.push_back(buildObjectForSearchMatch(match.first, match.second));
+ return result;
+}
+
namespace V8ContentSearchUtil {
String16 findSourceURL(const String16& content, bool multiline, bool* deprecated)
@@ -194,15 +205,12 @@ String16 findSourceMapURL(const String16& content, bool multiline, bool* depreca
return findMagicComment(content, "sourceMappingURL", multiline, deprecated);
}
-std::unique_ptr<protocol::Array<protocol::Debugger::SearchMatch>> searchInTextByLines(V8InspectorSession* session, const String16& text, const String16& query, const bool caseSensitive, const bool isRegex)
+std::unique_ptr<protocol::Array<protocol::Debugger::API::SearchMatch>> searchInTextByLines(V8InspectorSession* session, const String16& text, const String16& query, const bool caseSensitive, const bool isRegex)
{
- std::unique_ptr<protocol::Array<protocol::Debugger::SearchMatch>> result = protocol::Array<protocol::Debugger::SearchMatch>::create();
- std::unique_ptr<V8Regex> regex = createSearchRegex(static_cast<V8InspectorSessionImpl*>(session)->debugger(), query, caseSensitive, isRegex);
- std::vector<std::pair<int, String16>> matches = scriptRegexpMatchesByLines(*regex.get(), text);
-
- for (const auto& match : matches)
- result->addItem(buildObjectForSearchMatch(match.first, match.second));
-
+ std::vector<std::unique_ptr<protocol::Debugger::SearchMatch>> matches = searchInTextByLinesImpl(session, text, query, caseSensitive, isRegex);
+ std::unique_ptr<protocol::Array<protocol::Debugger::API::SearchMatch>> result = protocol::Array<protocol::Debugger::API::SearchMatch>::create();
+ for (size_t i = 0; i < matches.size(); ++i)
+ result->addItem(std::move(matches[i]));
return result;
}

Powered by Google App Engine
This is Rietveld 408576698