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

Unified Diff: chrome/browser/devtools/device/adb/adb_device_provider.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/adb_device_provider.cc
diff --git a/chrome/browser/devtools/device/adb/adb_device_provider.cc b/chrome/browser/devtools/device/adb/adb_device_provider.cc
index 9f5b33a916da3f6f050293f4721f05f7a87d0898..fda0496597c7bb75cc4e7e3814f1a38de91819f4 100644
--- a/chrome/browser/devtools/device/adb/adb_device_provider.cc
+++ b/chrome/browser/devtools/device/adb/adb_device_provider.cc
@@ -4,7 +4,7 @@
#include "chrome/browser/devtools/device/adb/adb_device_provider.h"
-#include "base/strings/string_util.h"
+#include "base/strings/string_split.h"
#include "base/strings/stringprintf.h"
#include "chrome/browser/devtools/device/adb/adb_client_socket.h"
@@ -33,12 +33,13 @@ static void ReceivedAdbDevices(
callback.Run(result);
return;
}
- std::vector<std::string> serials;
- Tokenize(response, "\n", &serials);
- for (size_t i = 0; i < serials.size(); ++i) {
- std::vector<std::string> tokens;
- Tokenize(serials[i], "\t ", &tokens);
- result.push_back(tokens[0]);
+ for (const base::StringPiece& line :
+ base::SplitStringPiece(response, "\n", base::KEEP_WHITESPACE,
+ base::SPLIT_WANT_NONEMPTY)) {
+ std::vector<base::StringPiece> tokens =
+ base::SplitStringPiece(line, "\t ", base::KEEP_WHITESPACE,
+ base::SPLIT_WANT_NONEMPTY);
+ result.push_back(tokens[0].as_string());
}
callback.Run(result);
}
« no previous file with comments | « chrome/browser/devtools/device/adb/adb_client_socket.cc ('k') | chrome/browser/devtools/device/adb/mock_adb_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698