| 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 // 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 #pragma once | 10 #pragma once |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 #include "base/base_export.h" | 36 #include "base/base_export.h" |
| 37 #include "base/file_descriptor_shuffle.h" | 37 #include "base/file_descriptor_shuffle.h" |
| 38 #include "base/file_path.h" | 38 #include "base/file_path.h" |
| 39 #include "base/process.h" | 39 #include "base/process.h" |
| 40 | 40 |
| 41 class CommandLine; | 41 class CommandLine; |
| 42 | 42 |
| 43 namespace base { | 43 namespace base { |
| 44 | 44 |
| 45 #if defined(OS_WIN) | 45 #if defined(OS_WIN) |
| 46 |
| 47 namespace win { |
| 48 class ScopedHandle; |
| 49 } |
| 50 |
| 46 struct ProcessEntry : public PROCESSENTRY32 { | 51 struct ProcessEntry : public PROCESSENTRY32 { |
| 47 ProcessId pid() const { return th32ProcessID; } | 52 ProcessId pid() const { return th32ProcessID; } |
| 48 ProcessId parent_pid() const { return th32ParentProcessID; } | 53 ProcessId parent_pid() const { return th32ParentProcessID; } |
| 49 const wchar_t* exe_file() const { return szExeFile; } | 54 const wchar_t* exe_file() const { return szExeFile; } |
| 50 }; | 55 }; |
| 51 | 56 |
| 52 struct IoCounters : public IO_COUNTERS { | 57 struct IoCounters : public IO_COUNTERS { |
| 53 }; | 58 }; |
| 54 | 59 |
| 55 // Process access masks. These constants provide platform-independent | 60 // Process access masks. These constants provide platform-independent |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 // create and set, and that LaunchSynchronize will consume and destroy. | 211 // create and set, and that LaunchSynchronize will consume and destroy. |
| 207 typedef int* LaunchSynchronizationHandle; | 212 typedef int* LaunchSynchronizationHandle; |
| 208 #endif // defined(OS_MACOSX) | 213 #endif // defined(OS_MACOSX) |
| 209 | 214 |
| 210 // Options for launching a subprocess that are passed to LaunchProcess(). | 215 // Options for launching a subprocess that are passed to LaunchProcess(). |
| 211 // The default constructor constructs the object with default options. | 216 // The default constructor constructs the object with default options. |
| 212 struct LaunchOptions { | 217 struct LaunchOptions { |
| 213 LaunchOptions() : wait(false), | 218 LaunchOptions() : wait(false), |
| 214 #if defined(OS_WIN) | 219 #if defined(OS_WIN) |
| 215 start_hidden(false), inherit_handles(false), as_user(NULL), | 220 start_hidden(false), inherit_handles(false), as_user(NULL), |
| 216 empty_desktop_name(false) | 221 empty_desktop_name(false), job_handle(NULL) |
| 217 #else | 222 #else |
| 218 environ(NULL), fds_to_remap(NULL), new_process_group(false) | 223 environ(NULL), fds_to_remap(NULL), new_process_group(false) |
| 219 #if defined(OS_LINUX) | 224 #if defined(OS_LINUX) |
| 220 , clone_flags(0) | 225 , clone_flags(0) |
| 221 #endif // OS_LINUX | 226 #endif // OS_LINUX |
| 222 #if defined(OS_MACOSX) | 227 #if defined(OS_MACOSX) |
| 223 , synchronize(NULL) | 228 , synchronize(NULL) |
| 224 #endif // defined(OS_MACOSX) | 229 #endif // defined(OS_MACOSX) |
| 225 #endif // !defined(OS_WIN) | 230 #endif // !defined(OS_WIN) |
| 226 {} | 231 {} |
| (...skipping 11 matching lines...) Expand all Loading... |
| 238 // Whether the application is visible on the interactive desktop depends on | 243 // Whether the application is visible on the interactive desktop depends on |
| 239 // the token belonging to an interactive logon session. | 244 // the token belonging to an interactive logon session. |
| 240 // | 245 // |
| 241 // To avoid hard to diagnose problems, when specified this loads the | 246 // To avoid hard to diagnose problems, when specified this loads the |
| 242 // environment variables associated with the user and if this operation fails | 247 // environment variables associated with the user and if this operation fails |
| 243 // the entire call fails as well. | 248 // the entire call fails as well. |
| 244 UserTokenHandle as_user; | 249 UserTokenHandle as_user; |
| 245 | 250 |
| 246 // If true, use an empty string for the desktop name. | 251 // If true, use an empty string for the desktop name. |
| 247 bool empty_desktop_name; | 252 bool empty_desktop_name; |
| 253 |
| 254 // If non-NULL, launches the application in a new job object |
| 255 // and puts the job object handle in |job_handle|. |
| 256 win::ScopedHandle* job_handle; |
| 248 #else | 257 #else |
| 249 // If non-NULL, set/unset environment variables. | 258 // If non-NULL, set/unset environment variables. |
| 250 // See documentation of AlterEnvironment(). | 259 // See documentation of AlterEnvironment(). |
| 251 // This pointer is owned by the caller and must live through the | 260 // This pointer is owned by the caller and must live through the |
| 252 // call to LaunchProcess(). | 261 // call to LaunchProcess(). |
| 253 const environment_vector* environ; | 262 const environment_vector* environ; |
| 254 | 263 |
| 255 // If non-NULL, remap file descriptors according to the mapping of | 264 // If non-NULL, remap file descriptors according to the mapping of |
| 256 // src fd->dest fd to propagate FDs into the child process. | 265 // src fd->dest fd to propagate FDs into the child process. |
| 257 // This pointer is owned by the caller and must live through the | 266 // This pointer is owned by the caller and must live through the |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 769 // instance running inside the parent. The parent's Breakpad instance should | 778 // instance running inside the parent. The parent's Breakpad instance should |
| 770 // not handle the child's exceptions. Calling RestoreDefaultExceptionHandler | 779 // not handle the child's exceptions. Calling RestoreDefaultExceptionHandler |
| 771 // in the child after forking will restore the standard exception handler. | 780 // in the child after forking will restore the standard exception handler. |
| 772 // See http://crbug.com/20371/ for more details. | 781 // See http://crbug.com/20371/ for more details. |
| 773 void RestoreDefaultExceptionHandler(); | 782 void RestoreDefaultExceptionHandler(); |
| 774 #endif // defined(OS_MACOSX) | 783 #endif // defined(OS_MACOSX) |
| 775 | 784 |
| 776 } // namespace base | 785 } // namespace base |
| 777 | 786 |
| 778 #endif // BASE_PROCESS_UTIL_H_ | 787 #endif // BASE_PROCESS_UTIL_H_ |
| OLD | NEW |