OLD | NEW |
---|---|
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 <ctype.h> | 7 #include <ctype.h> |
8 #include <dirent.h> | 8 #include <dirent.h> |
9 #include <dlfcn.h> | 9 #include <dlfcn.h> |
10 #include <errno.h> | 10 #include <errno.h> |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
213 entry_.cmd_line_args_.assign(cmd_line_args.begin(), cmd_line_args.end()); | 213 entry_.cmd_line_args_.assign(cmd_line_args.begin(), cmd_line_args.end()); |
214 | 214 |
215 // TODO(port): read pid's commandline's $0, like killall does. Using the | 215 // TODO(port): read pid's commandline's $0, like killall does. Using the |
216 // short name between openparen and closeparen won't work for long names! | 216 // short name between openparen and closeparen won't work for long names! |
217 int len = closeparen - openparen - 1; | 217 int len = closeparen - openparen - 1; |
218 entry_.exe_file_.assign(openparen + 1, len); | 218 entry_.exe_file_.assign(openparen + 1, len); |
219 return true; | 219 return true; |
220 } | 220 } |
221 | 221 |
222 bool NamedProcessIterator::IncludeEntry() { | 222 bool NamedProcessIterator::IncludeEntry() { |
223 // TODO(port): make this also work for non-ASCII filenames | 223 // TODO(port): make this also work for non-ASCII filenames |
Evan Martin
2010/12/22 23:03:59
You can remove this TODO, since you've fixed it.
Avi (use Gerrit)
2010/12/22 23:25:02
Done.
| |
224 if (WideToASCII(executable_name_) != entry().exe_file()) | 224 if (executable_name_ != entry().exe_file()) |
225 return false; | 225 return false; |
226 return ProcessIterator::IncludeEntry(); | 226 return ProcessIterator::IncludeEntry(); |
227 } | 227 } |
228 | 228 |
229 | 229 |
230 ProcessMetrics::ProcessMetrics(ProcessHandle process) | 230 ProcessMetrics::ProcessMetrics(ProcessHandle process) |
231 : process_(process), | 231 : process_(process), |
232 last_time_(0), | 232 last_time_(0), |
233 last_system_time_(0), | 233 last_system_time_(0), |
234 last_cpu_(0) { | 234 last_cpu_(0) { |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
707 | 707 |
708 if (!file_util::PathExists(oom_adj)) | 708 if (!file_util::PathExists(oom_adj)) |
709 return false; | 709 return false; |
710 | 710 |
711 std::string score_str = base::IntToString(score); | 711 std::string score_str = base::IntToString(score); |
712 return (static_cast<int>(score_str.length()) == | 712 return (static_cast<int>(score_str.length()) == |
713 file_util::WriteFile(oom_adj, score_str.c_str(), score_str.length())); | 713 file_util::WriteFile(oom_adj, score_str.c_str(), score_str.length())); |
714 } | 714 } |
715 | 715 |
716 } // namespace base | 716 } // namespace base |
OLD | NEW |