| 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 if (executable_name_ != entry().exe_file()) |
| 224 if (WideToASCII(executable_name_) != entry().exe_file()) | |
| 225 return false; | 224 return false; |
| 226 return ProcessIterator::IncludeEntry(); | 225 return ProcessIterator::IncludeEntry(); |
| 227 } | 226 } |
| 228 | 227 |
| 229 | 228 |
| 230 ProcessMetrics::ProcessMetrics(ProcessHandle process) | 229 ProcessMetrics::ProcessMetrics(ProcessHandle process) |
| 231 : process_(process), | 230 : process_(process), |
| 232 last_time_(0), | 231 last_time_(0), |
| 233 last_system_time_(0), | 232 last_system_time_(0), |
| 234 last_cpu_(0) { | 233 last_cpu_(0) { |
| (...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 707 | 706 |
| 708 if (!file_util::PathExists(oom_adj)) | 707 if (!file_util::PathExists(oom_adj)) |
| 709 return false; | 708 return false; |
| 710 | 709 |
| 711 std::string score_str = base::IntToString(score); | 710 std::string score_str = base::IntToString(score); |
| 712 return (static_cast<int>(score_str.length()) == | 711 return (static_cast<int>(score_str.length()) == |
| 713 file_util::WriteFile(oom_adj, score_str.c_str(), score_str.length())); | 712 file_util::WriteFile(oom_adj, score_str.c_str(), score_str.length())); |
| 714 } | 713 } |
| 715 | 714 |
| 716 } // namespace base | 715 } // namespace base |
| OLD | NEW |