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

Side by Side Diff: base/process_util_linux.cc

Issue 10026013: Update use of TimeDelta in chrome/browser/*, ui/views/*, and other places. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Remove debug comment. Created 8 years, 7 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
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 "base/process_util.h" 5 #include "base/process_util.h"
6 6
7 #include <dirent.h> 7 #include <dirent.h>
8 #include <malloc.h> 8 #include <malloc.h>
9 #include <sys/time.h> 9 #include <sys/time.h>
10 #include <sys/types.h> 10 #include <sys/types.h>
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 std::vector<std::string>* proc_stats) { 68 std::vector<std::string>* proc_stats) {
69 // The stat file is formatted as: 69 // The stat file is formatted as:
70 // pid (process name) data1 data2 .... dataN 70 // pid (process name) data1 data2 .... dataN
71 // Look for the closing paren by scanning backwards, to avoid being fooled by 71 // Look for the closing paren by scanning backwards, to avoid being fooled by
72 // processes with ')' in the name. 72 // processes with ')' in the name.
73 size_t open_parens_idx = stats_data.find(" ("); 73 size_t open_parens_idx = stats_data.find(" (");
74 size_t close_parens_idx = stats_data.rfind(") "); 74 size_t close_parens_idx = stats_data.rfind(") ");
75 if (open_parens_idx == std::string::npos || 75 if (open_parens_idx == std::string::npos ||
76 close_parens_idx == std::string::npos || 76 close_parens_idx == std::string::npos ||
77 open_parens_idx > close_parens_idx) { 77 open_parens_idx > close_parens_idx) {
78 DLOG(WARNING) << "Failed to find matched parens in '" << stats_data
79 << "'\n";
Ilya Sherman 2012/05/15 05:30:02 nit: No need for the trailing "\n" unless you want
78 NOTREACHED(); 80 NOTREACHED();
79 return false; 81 return false;
80 } 82 }
81 open_parens_idx++; 83 open_parens_idx++;
82 84
83 proc_stats->clear(); 85 proc_stats->clear();
84 // PID. 86 // PID.
85 proc_stats->push_back(stats_data.substr(0, open_parens_idx)); 87 proc_stats->push_back(stats_data.substr(0, open_parens_idx));
86 // Process name without parentheses. 88 // Process name without parentheses.
87 proc_stats->push_back( 89 proc_stats->push_back(
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 int score_len = static_cast<int>(score_str.length()); 818 int score_len = static_cast<int>(score_str.length());
817 return (score_len == file_util::WriteFile(oom_file, 819 return (score_len == file_util::WriteFile(oom_file,
818 score_str.c_str(), 820 score_str.c_str(),
819 score_len)); 821 score_len));
820 } 822 }
821 823
822 return false; 824 return false;
823 } 825 }
824 826
825 } // namespace base 827 } // namespace base
OLDNEW
« no previous file with comments | « ash/wm/workspace/multi_window_resize_controller.cc ('k') | chrome/browser/app_controller_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698