| 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 // This file/namespace contains utility functions for enumerating, ending and | 5 // This file/namespace contains utility functions for enumerating, ending and |
| 6 // computing statistics of processes. | 6 // computing statistics of processes. |
| 7 | 7 |
| 8 #ifndef BASE_PROCESS_UTIL_H_ | 8 #ifndef BASE_PROCESS_UTIL_H_ |
| 9 #define BASE_PROCESS_UTIL_H_ | 9 #define BASE_PROCESS_UTIL_H_ |
| 10 | 10 |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 // methods. | 362 // methods. |
| 363 class ProcessMetrics { | 363 class ProcessMetrics { |
| 364 public: | 364 public: |
| 365 // Creates a ProcessMetrics for the specified process. | 365 // Creates a ProcessMetrics for the specified process. |
| 366 // The caller owns the returned object. | 366 // The caller owns the returned object. |
| 367 #if !defined(OS_MACOSX) | 367 #if !defined(OS_MACOSX) |
| 368 static ProcessMetrics* CreateProcessMetrics(ProcessHandle process); | 368 static ProcessMetrics* CreateProcessMetrics(ProcessHandle process); |
| 369 #else | 369 #else |
| 370 class PortProvider { | 370 class PortProvider { |
| 371 public: | 371 public: |
| 372 // Should return the mach task for |process| if possible, or else 0. Only | 372 // Should return the mach task for |process| if possible, or else |
| 373 // processes that this returns tasks for will have metrics on OS X (except | 373 // |MACH_PORT_NULL|. Only processes that this returns tasks for will have |
| 374 // for the current process, which always gets metrics). | 374 // metrics on OS X (except for the current process, which always gets |
| 375 // metrics). |
| 375 virtual mach_port_t TaskForPid(ProcessHandle process) const = 0; | 376 virtual mach_port_t TaskForPid(ProcessHandle process) const = 0; |
| 376 }; | 377 }; |
| 377 | 378 |
| 378 // The port provider needs to outlive the ProcessMetrics object returned by | 379 // The port provider needs to outlive the ProcessMetrics object returned by |
| 379 // this function. If NULL is passed as provider, the returned object | 380 // this function. If NULL is passed as provider, the returned object |
| 380 // only returns valid metrics if |process| is the current process. | 381 // only returns valid metrics if |process| is the current process. |
| 381 static ProcessMetrics* CreateProcessMetrics(ProcessHandle process, | 382 static ProcessMetrics* CreateProcessMetrics(ProcessHandle process, |
| 382 PortProvider* port_provider); | 383 PortProvider* port_provider); |
| 383 #endif | 384 #endif |
| 384 | 385 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 // instance running inside the parent. The parent's Breakpad instance should | 499 // instance running inside the parent. The parent's Breakpad instance should |
| 499 // not handle the child's exceptions. Calling RestoreDefaultExceptionHandler | 500 // not handle the child's exceptions. Calling RestoreDefaultExceptionHandler |
| 500 // in the child after forking will restore the standard exception handler. | 501 // in the child after forking will restore the standard exception handler. |
| 501 // See http://crbug.com/20371/ for more details. | 502 // See http://crbug.com/20371/ for more details. |
| 502 void RestoreDefaultExceptionHandler(); | 503 void RestoreDefaultExceptionHandler(); |
| 503 #endif | 504 #endif |
| 504 | 505 |
| 505 } // namespace base | 506 } // namespace base |
| 506 | 507 |
| 507 #endif // BASE_PROCESS_UTIL_H_ | 508 #endif // BASE_PROCESS_UTIL_H_ |
| OLD | NEW |