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

Unified Diff: base/trace_event/trace_event_memory.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
« no previous file with comments | « base/trace_event/trace_event_impl.cc ('k') | chrome/browser/autocomplete/in_memory_url_index_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/trace_event/trace_event_memory.cc
diff --git a/base/trace_event/trace_event_memory.cc b/base/trace_event/trace_event_memory.cc
index 89595890aec54030196028121956e501b0536662..b173838cb4f00fd5fa4c2b0abe7288028d61e9f2 100644
--- a/base/trace_event/trace_event_memory.cc
+++ b/base/trace_event/trace_event_memory.cc
@@ -11,6 +11,7 @@
#include "base/memory/scoped_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/threading/thread_local_storage.h"
#include "base/trace_event/trace_event.h"
@@ -318,9 +319,9 @@ void AppendHeapProfileAsTraceFormat(const char* input, std::string* output) {
input_string.assign(input);
}
- std::vector<std::string> lines;
- size_t line_count = Tokenize(input_string, "\n", &lines);
- if (line_count == 0) {
+ std::vector<std::string> lines = base::SplitString(
+ input_string, "\n", base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
+ if (lines.empty()) {
DLOG(WARNING) << "No lines found";
return;
}
@@ -330,10 +331,8 @@ void AppendHeapProfileAsTraceFormat(const char* input, std::string* output) {
AppendHeapProfileTotalsAsTraceFormat(lines[0], output);
// Handle the following stack trace lines.
- for (size_t i = 1; i < line_count; ++i) {
- const std::string& line = lines[i];
- AppendHeapProfileLineAsTraceFormat(line, output);
- }
+ for (size_t i = 1; i < lines.size(); i++)
+ AppendHeapProfileLineAsTraceFormat(lines[i], output);
output->append("]\n");
}
« no previous file with comments | « base/trace_event/trace_event_impl.cc ('k') | chrome/browser/autocomplete/in_memory_url_index_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698