diff options
author | tfarina <tfarina@chromium.org> | 2015-03-10 20:15:14 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-03-11 03:16:01 +0000 |
commit | b1681f640a14a36bf240f83669d6db3109f4d267 (patch) | |
tree | 020748bc730cfb18781ad9cdfe03f6c167ff7e79 /net/tools/flip_server | |
parent | f4b997ac4c3756ef0f095c8066a7fac7e8ecb7f9 (diff) | |
download | chromium_src-b1681f640a14a36bf240f83669d6db3109f4d267.zip chromium_src-b1681f640a14a36bf240f83669d6db3109f4d267.tar.gz chromium_src-b1681f640a14a36bf240f83669d6db3109f4d267.tar.bz2 |
flip_server: Replace some split() functions by the one from //base library.
//base has SplitString() function in //base/strings/, so we could make
use of it here.
BUG=None
R=rch@chromium.org
Review URL: https://codereview.chromium.org/999483002
Cr-Commit-Position: refs/heads/master@{#320041}
Diffstat (limited to 'net/tools/flip_server')
-rw-r--r-- | net/tools/flip_server/flip_in_mem_edsm_server.cc | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/net/tools/flip_server/flip_in_mem_edsm_server.cc b/net/tools/flip_server/flip_in_mem_edsm_server.cc index 80c5e6c..d646b2e 100644 --- a/net/tools/flip_server/flip_in_mem_edsm_server.cc +++ b/net/tools/flip_server/flip_in_mem_edsm_server.cc @@ -13,6 +13,7 @@ #include "base/command_line.h" #include "base/logging.h" +#include "base/strings/string_split.h" #include "base/synchronization/lock.h" #include "net/tools/balsa/split.h" #include "net/tools/flip_server/acceptor_thread.h" @@ -51,22 +52,6 @@ double FLAGS_server_think_time_in_s = 0; net::FlipConfig g_proxy_config; -std::vector<std::string>& split(const std::string& s, - char delim, - std::vector<std::string>& elems) { - std::stringstream ss(s); - std::string item; - while (std::getline(ss, item, delim)) { - elems.push_back(item); - } - return elems; -} - -std::vector<std::string> split(const std::string& s, char delim) { - std::vector<std::string> elems; - return split(s, delim, elems); -} - bool GotQuitFromStdin() { // Make stdin nonblocking. Yes this is done each time. Oh well. fcntl(0, F_SETFL, O_NONBLOCK); @@ -301,7 +286,8 @@ int main(int argc, char** argv) { break; } std::string value = cl.GetSwitchValueASCII(name.str()); - std::vector<std::string> valueArgs = split(value, ','); + std::vector<std::string> valueArgs; + base::SplitString(value, ',', &valueArgs); CHECK_EQ((unsigned int)9, valueArgs.size()); int spdy_only = atoi(valueArgs[8].c_str()); // If wait_for_iface is enabled, then this call will block @@ -329,7 +315,8 @@ int main(int argc, char** argv) { if (cl.HasSwitch("spdy-server")) { spdy_memory_cache.AddFiles(); std::string value = cl.GetSwitchValueASCII("spdy-server"); - std::vector<std::string> valueArgs = split(value, ','); + std::vector<std::string> valueArgs; + base::SplitString(value, ',', &valueArgs); while (valueArgs.size() < 4) valueArgs.push_back(std::string()); g_proxy_config.AddAcceptor(net::FLIP_HANDLER_SPDY_SERVER, @@ -355,7 +342,8 @@ int main(int argc, char** argv) { if (cl.HasSwitch("http-server")) { http_memory_cache.AddFiles(); std::string value = cl.GetSwitchValueASCII("http-server"); - std::vector<std::string> valueArgs = split(value, ','); + std::vector<std::string> valueArgs; + base::SplitString(value, ',', &valueArgs); while (valueArgs.size() < 4) valueArgs.push_back(std::string()); g_proxy_config.AddAcceptor(net::FLIP_HANDLER_HTTP_SERVER, |