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

Side by Side Diff: net/tools/gdig/gdig.cc

Issue 102843002: Move RemoveChars, ReplaceChars, TrimString, and TruncateUTF8ToByteSize to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <stdio.h> 5 #include <stdio.h>
6 #include <string> 6 #include <string>
7 7
8 #include "base/at_exit.h" 8 #include "base/at_exit.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/cancelable_callback.h" 10 #include "base/cancelable_callback.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 if (!base::ReadFileToString(file_path, &original_replay_log_contents)) { 119 if (!base::ReadFileToString(file_path, &original_replay_log_contents)) {
120 fprintf(stderr, "Unable to open replay file %s\n", 120 fprintf(stderr, "Unable to open replay file %s\n",
121 file_path.MaybeAsASCII().c_str()); 121 file_path.MaybeAsASCII().c_str());
122 return false; 122 return false;
123 } 123 }
124 124
125 // Strip out \r characters for Windows files. This isn't as efficient as a 125 // Strip out \r characters for Windows files. This isn't as efficient as a
126 // smarter line splitter, but this particular use does not need to target 126 // smarter line splitter, but this particular use does not need to target
127 // efficiency. 127 // efficiency.
128 std::string replay_log_contents; 128 std::string replay_log_contents;
129 RemoveChars(original_replay_log_contents, "\r", &replay_log_contents); 129 base::RemoveChars(original_replay_log_contents, "\r", &replay_log_contents);
130 130
131 std::vector<std::string> lines; 131 std::vector<std::string> lines;
132 base::SplitString(replay_log_contents, '\n', &lines); 132 base::SplitString(replay_log_contents, '\n', &lines);
133 base::TimeDelta previous_delta; 133 base::TimeDelta previous_delta;
134 bool bad_parse = false; 134 bool bad_parse = false;
135 for (unsigned i = 0; i < lines.size(); ++i) { 135 for (unsigned i = 0; i < lines.size(); ++i) {
136 if (lines[i].empty()) 136 if (lines[i].empty())
137 continue; 137 continue;
138 std::vector<std::string> time_and_name; 138 std::vector<std::string> time_and_name;
139 base::SplitString(lines[i], ' ', &time_and_name); 139 base::SplitString(lines[i], ' ', &time_and_name);
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 } 506 }
507 507
508 } // empty namespace 508 } // empty namespace
509 509
510 } // namespace net 510 } // namespace net
511 511
512 int main(int argc, const char* argv[]) { 512 int main(int argc, const char* argv[]) {
513 net::GDig dig; 513 net::GDig dig;
514 return dig.Main(argc, argv); 514 return dig.Main(argc, argv);
515 } 515 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698