| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef CHROME_TEST_CHROME_PROCESS_UTIL_H_ | 5 #ifndef CHROME_TEST_CHROME_PROCESS_UTIL_H_ |
| 6 #define CHROME_TEST_CHROME_PROCESS_UTIL_H_ | 6 #define CHROME_TEST_CHROME_PROCESS_UTIL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 size_t GetPeakWorkingSetSize() { | 45 size_t GetPeakWorkingSetSize() { |
| 46 return process_metrics_->GetPeakWorkingSetSize(); | 46 return process_metrics_->GetPeakWorkingSetSize(); |
| 47 } | 47 } |
| 48 | 48 |
| 49 bool GetIOCounters(base::IoCounters* io_counters) { | 49 bool GetIOCounters(base::IoCounters* io_counters) { |
| 50 return process_metrics_->GetIOCounters(io_counters); | 50 return process_metrics_->GetIOCounters(io_counters); |
| 51 } | 51 } |
| 52 | 52 |
| 53 base::ProcessHandle process_handle_; | 53 base::ProcessHandle process_handle_; |
| 54 | 54 |
| 55 ~ChromeTestProcessMetrics(); |
| 56 |
| 55 private: | 57 private: |
| 56 explicit ChromeTestProcessMetrics(base::ProcessHandle process) { | 58 explicit ChromeTestProcessMetrics(base::ProcessHandle process); |
| 57 #if !defined(OS_MACOSX) | |
| 58 process_metrics_.reset( | |
| 59 base::ProcessMetrics::CreateProcessMetrics(process)); | |
| 60 #else | |
| 61 process_metrics_.reset( | |
| 62 base::ProcessMetrics::CreateProcessMetrics(process, NULL)); | |
| 63 #endif | |
| 64 process_handle_ = process; | |
| 65 } | |
| 66 | 59 |
| 67 scoped_ptr<base::ProcessMetrics> process_metrics_; | 60 scoped_ptr<base::ProcessMetrics> process_metrics_; |
| 68 | 61 |
| 69 DISALLOW_COPY_AND_ASSIGN(ChromeTestProcessMetrics); | 62 DISALLOW_COPY_AND_ASSIGN(ChromeTestProcessMetrics); |
| 70 }; | 63 }; |
| 71 | 64 |
| 72 #if defined(OS_MACOSX) | 65 #if defined(OS_MACOSX) |
| 73 | 66 |
| 74 // These types and API are here to fetch the information about a set of running | 67 // These types and API are here to fetch the information about a set of running |
| 75 // processes by ID on the Mac. There are also APIs in base, but fetching the | 68 // processes by ID on the Mac. There are also APIs in base, but fetching the |
| (...skipping 12 matching lines...) Expand all Loading... |
| 88 | 81 |
| 89 typedef std::vector<MacChromeProcessInfo> MacChromeProcessInfoList; | 82 typedef std::vector<MacChromeProcessInfo> MacChromeProcessInfoList; |
| 90 | 83 |
| 91 // Any ProcessId that info can't be found for will be left out. | 84 // Any ProcessId that info can't be found for will be left out. |
| 92 MacChromeProcessInfoList GetRunningMacProcessInfo( | 85 MacChromeProcessInfoList GetRunningMacProcessInfo( |
| 93 const ChromeProcessList& process_list); | 86 const ChromeProcessList& process_list); |
| 94 | 87 |
| 95 #endif // defined(OS_MACOSX) | 88 #endif // defined(OS_MACOSX) |
| 96 | 89 |
| 97 #endif // CHROME_TEST_CHROME_PROCESS_UTIL_H_ | 90 #endif // CHROME_TEST_CHROME_PROCESS_UTIL_H_ |
| OLD | NEW |