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

Side by Side Diff: base/debug/proc_maps_linux.cc

Issue 1272823003: Update SplitString calls to new form (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 unified diff | Download patch
« no previous file with comments | « base/command_line.cc ('k') | base/process/internal_linux.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/debug/proc_maps_linux.h" 5 #include "base/debug/proc_maps_linux.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 8
9 #if defined(OS_LINUX) || defined(OS_ANDROID) 9 #if defined(OS_LINUX) || defined(OS_ANDROID)
10 #include <inttypes.h> 10 #include <inttypes.h>
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 return true; 89 return true;
90 } 90 }
91 91
92 bool ParseProcMaps(const std::string& input, 92 bool ParseProcMaps(const std::string& input,
93 std::vector<MappedMemoryRegion>* regions_out) { 93 std::vector<MappedMemoryRegion>* regions_out) {
94 CHECK(regions_out); 94 CHECK(regions_out);
95 std::vector<MappedMemoryRegion> regions; 95 std::vector<MappedMemoryRegion> regions;
96 96
97 // This isn't async safe nor terribly efficient, but it doesn't need to be at 97 // This isn't async safe nor terribly efficient, but it doesn't need to be at
98 // this point in time. 98 // this point in time.
99 std::vector<std::string> lines; 99 std::vector<std::string> lines = SplitString(
100 SplitString(input, '\n', &lines); 100 input, "\n", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
101 101
102 for (size_t i = 0; i < lines.size(); ++i) { 102 for (size_t i = 0; i < lines.size(); ++i) {
103 // Due to splitting on '\n' the last line should be empty. 103 // Due to splitting on '\n' the last line should be empty.
104 if (i == lines.size() - 1) { 104 if (i == lines.size() - 1) {
105 if (!lines[i].empty()) { 105 if (!lines[i].empty()) {
106 DLOG(WARNING) << "Last line not empty"; 106 DLOG(WARNING) << "Last line not empty";
107 return false; 107 return false;
108 } 108 }
109 break; 109 break;
110 } 110 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 regions.push_back(region); 158 regions.push_back(region);
159 regions.back().path.assign(line + path_index); 159 regions.back().path.assign(line + path_index);
160 } 160 }
161 161
162 regions_out->swap(regions); 162 regions_out->swap(regions);
163 return true; 163 return true;
164 } 164 }
165 165
166 } // namespace debug 166 } // namespace debug
167 } // namespace base 167 } // namespace base
OLDNEW
« no previous file with comments | « base/command_line.cc ('k') | base/process/internal_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698