OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 namespace base { | 7 namespace base { |
8 | 8 |
9 #if defined(OS_POSIX) | 9 #if defined(OS_POSIX) |
10 ProcessEntry::ProcessEntry() : pid_(0), ppid_(0), gid_(0) {} | 10 ProcessEntry::ProcessEntry() : pid_(0), ppid_(0), gid_(0) {} |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
53 } | 53 } |
54 | 54 |
55 bool ProcessIterator::IncludeEntry() { | 55 bool ProcessIterator::IncludeEntry() { |
56 return !filter_ || filter_->Includes(entry_); | 56 return !filter_ || filter_->Includes(entry_); |
57 } | 57 } |
58 | 58 |
59 NamedProcessIterator::NamedProcessIterator( | 59 NamedProcessIterator::NamedProcessIterator( |
60 const FilePath::StringType& executable_name, | 60 const FilePath::StringType& executable_name, |
61 const ProcessFilter* filter) : ProcessIterator(filter), | 61 const ProcessFilter* filter) : ProcessIterator(filter), |
62 executable_name_(executable_name) { | 62 executable_name_(executable_name) { |
63 #if defined(OS_ANDROID) | |
64 // On Android, the process name contains only the last 15 characters, which | |
65 // is in file /proc/<pid>/stat, the string between open parenthesis and close | |
66 // parenthesis. Please See ProcessIterator::CheckForNextProcess for details. | |
67 // Now if the length of input process name is greater than 15, only save the | |
68 // last 15 characters. | |
69 if (executable_name_.size() > 15) | |
brettw
2011/08/24 20:46:58
Use {} for multiple-line conditionals.
michaelbai
2011/08/24 23:02:18
Done.
| |
70 executable_name_ = FilePath::StringType(executable_name_, | |
71 executable_name_.size() - 15, 15); | |
72 #endif | |
63 } | 73 } |
64 | 74 |
65 NamedProcessIterator::~NamedProcessIterator() { | 75 NamedProcessIterator::~NamedProcessIterator() { |
66 } | 76 } |
67 | 77 |
68 } // namespace base | 78 } // namespace base |
OLD | NEW |