| 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 "chrome/test/chrome_process_util.h" | 5 #include "chrome/test/chrome_process_util.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 // are children of one of the processes that we've already seen. | 93 // are children of one of the processes that we've already seen. |
| 94 { | 94 { |
| 95 ChildProcessFilter filter(result); | 95 ChildProcessFilter filter(result); |
| 96 base::NamedProcessIterator it(chrome::kBrowserProcessExecutableName, | 96 base::NamedProcessIterator it(chrome::kBrowserProcessExecutableName, |
| 97 &filter); | 97 &filter); |
| 98 while ((process_entry = it.NextProcessEntry())) | 98 while ((process_entry = it.NextProcessEntry())) |
| 99 result.push_back(process_entry->pid); | 99 result.push_back(process_entry->pid); |
| 100 } | 100 } |
| 101 #endif // defined(OS_LINUX) | 101 #endif // defined(OS_LINUX) |
| 102 | 102 |
| 103 #if defined(OS_MACOSX) | 103 #if defined(OS_LINUX) || defined(OS_MACOSX) |
| 104 // On Mac OS X we run the subprocesses with a different bundle, so they end | 104 // On Mac OS X we run the subprocesses with a different bundle, and |
| 105 // up with a different name, so we have to collect them in a second pass. | 105 // on Linux via /proc/self/exe, so they end up with a different |
| 106 // name. We must collect them in a second pass. |
| 106 { | 107 { |
| 107 ChildProcessFilter filter(browser_pid); | 108 ChildProcessFilter filter(browser_pid); |
| 108 base::NamedProcessIterator it(chrome::kHelperProcessExecutableName, | 109 base::NamedProcessIterator it(chrome::kHelperProcessExecutableName, |
| 109 &filter); | 110 &filter); |
| 110 while ((process_entry = it.NextProcessEntry())) | 111 while ((process_entry = it.NextProcessEntry())) |
| 111 result.push_back(process_entry->pid); | 112 result.push_back(process_entry->pid); |
| 112 } | 113 } |
| 113 #endif // defined(OS_MACOSX) | 114 #endif // defined(OS_MACOSX) |
| 114 | 115 |
| 115 result.push_back(browser_pid); | 116 result.push_back(browser_pid); |
| 116 | 117 |
| 117 return result; | 118 return result; |
| 118 } | 119 } |
| 119 | 120 |
| 120 #if !defined(OS_MACOSX) | 121 #if !defined(OS_MACOSX) |
| 121 | 122 |
| 122 size_t ChromeTestProcessMetrics::GetPagefileUsage() { | 123 size_t ChromeTestProcessMetrics::GetPagefileUsage() { |
| 123 return process_metrics_->GetPagefileUsage(); | 124 return process_metrics_->GetPagefileUsage(); |
| 124 } | 125 } |
| 125 | 126 |
| 126 size_t ChromeTestProcessMetrics::GetWorkingSetSize() { | 127 size_t ChromeTestProcessMetrics::GetWorkingSetSize() { |
| 127 return process_metrics_->GetWorkingSetSize(); | 128 return process_metrics_->GetWorkingSetSize(); |
| 128 } | 129 } |
| 129 | 130 |
| 130 #endif // !defined(OS_MACOSX) | 131 #endif // !defined(OS_MACOSX) |
| OLD | NEW |