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

Side by Side Diff: tools/android/memdump/memdump.cc

Issue 1284833004: Remove remaining legacy SplitString calls. (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 | « third_party/mojo/src/mojo/edk/test/test_support_impl.cc ('k') | tools/gn/command_clean.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 <fcntl.h> 5 #include <fcntl.h>
6 #include <signal.h> 6 #include <signal.h>
7 #include <sys/types.h> 7 #include <sys/types.h>
8 #include <unistd.h> 8 #include <unistd.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 } 123 }
124 124
125 // Number of times a physical page is mapped in a process. 125 // Number of times a physical page is mapped in a process.
126 typedef base::hash_map<uint64, int> PFNMap; 126 typedef base::hash_map<uint64, int> PFNMap;
127 127
128 // Parses lines from /proc/<PID>/maps, e.g.: 128 // Parses lines from /proc/<PID>/maps, e.g.:
129 // 401e7000-401f5000 r-xp 00000000 103:02 158 /system/bin/linker 129 // 401e7000-401f5000 r-xp 00000000 103:02 158 /system/bin/linker
130 bool ParseMemoryMapLine(const std::string& line, 130 bool ParseMemoryMapLine(const std::string& line,
131 std::vector<std::string>* tokens, 131 std::vector<std::string>* tokens,
132 MemoryMap* memory_map) { 132 MemoryMap* memory_map) {
133 tokens->clear(); 133 *tokens = base::SplitString(
134 base::SplitString(line, ' ', tokens); 134 line, " ", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
135 if (tokens->size() < 2) 135 if (tokens->size() < 2)
136 return false; 136 return false;
137 const std::string& addr_range = tokens->at(0); 137 const std::string& addr_range = tokens->at(0);
138 std::vector<std::string> range_tokens; 138 std::vector<std::string> range_tokens = base::SplitString(
139 base::SplitString(addr_range, '-', &range_tokens); 139 addr_range, "-", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
140 const std::string& start_address_token = range_tokens.at(0); 140 const std::string& start_address_token = range_tokens.at(0);
141 if (!base::HexStringToUInt64(start_address_token, 141 if (!base::HexStringToUInt64(start_address_token,
142 &memory_map->start_address)) { 142 &memory_map->start_address)) {
143 return false; 143 return false;
144 } 144 }
145 const std::string& end_address_token = range_tokens.at(1); 145 const std::string& end_address_token = range_tokens.at(1);
146 if (!base::HexStringToUInt64(end_address_token, &memory_map->end_address)) { 146 if (!base::HexStringToUInt64(end_address_token, &memory_map->end_address)) {
147 return false; 147 return false;
148 } 148 }
149 if (tokens->at(1).size() != strlen("rwxp")) 149 if (tokens->at(1).size() != strlen("rwxp"))
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 } 525 }
526 } 526 }
527 527
528 ClassifyPages(&processes_memory); 528 ClassifyPages(&processes_memory);
529 if (short_output) 529 if (short_output)
530 DumpProcessesMemoryMapsInShortFormat(processes_memory); 530 DumpProcessesMemoryMapsInShortFormat(processes_memory);
531 else 531 else
532 DumpProcessesMemoryMapsInExtendedFormat(processes_memory); 532 DumpProcessesMemoryMapsInExtendedFormat(processes_memory);
533 return EXIT_SUCCESS; 533 return EXIT_SUCCESS;
534 } 534 }
OLDNEW
« no previous file with comments | « third_party/mojo/src/mojo/edk/test/test_support_impl.cc ('k') | tools/gn/command_clean.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698