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

Unified Diff: chrome/browser/devtools/device/adb/mock_adb_server.cc

Issue 1197243004: Replace some Tokenize calls with SplitString. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix android Created 5 years, 6 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: chrome/browser/devtools/device/adb/mock_adb_server.cc
diff --git a/chrome/browser/devtools/device/adb/mock_adb_server.cc b/chrome/browser/devtools/device/adb/mock_adb_server.cc
index b12a36f4b323a77e515f801c4a382d07243083b8..e52299caec5e02503b200405025cd1e9830ef662 100644
--- a/chrome/browser/devtools/device/adb/mock_adb_server.cc
+++ b/chrome/browser/devtools/device/adb/mock_adb_server.cc
@@ -8,6 +8,7 @@
#include "base/memory/weak_ptr.h"
#include "base/single_thread_task_runner.h"
#include "base/strings/string_number_conversions.h"
+#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/thread_task_runner_handle.h"
@@ -498,8 +499,9 @@ void MockAndroidConnection::Receive(const std::string& data) {
return;
std::string request(request_.substr(0, request_end_pos));
- std::vector<std::string> tokens;
- Tokenize(request, " ", &tokens);
+ std::vector<std::string> tokens =
+ base::SplitString(request, " ", base::KEEP_WHITESPACE,
+ base::SPLIT_WANT_NONEMPTY);
CHECK_EQ(3U, tokens.size());
CHECK_EQ("GET", tokens[0]);
CHECK_EQ("HTTP/1.1", tokens[2]);
@@ -547,10 +549,11 @@ void MockAndroidConnection::ProcessCommand(const std::string& command) {
delegate_->SendSuccess(std::string());
} else {
if (command.find(kShellPrefix) == 0) {
- std::vector<std::string> lines;
- Tokenize(command.substr(strlen(kShellPrefix)), "\n", &lines);
std::string result;
- for (const auto& line : lines) {
+ for (const auto& line :
+ base::SplitString(command.substr(strlen(kShellPrefix)), "\n",
+ base::KEEP_WHITESPACE,
+ base::SPLIT_WANT_NONEMPTY)) {
if (line == kDeviceModelCommand) {
result += kDeviceModel;
result += "\r\n";
« no previous file with comments | « chrome/browser/devtools/device/adb/adb_device_provider.cc ('k') | chrome/browser/devtools/device/android_device_info_query.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698