| 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 #ifndef BASE_PROCESS_PROCESS_PROCESS_H_ | 5 #ifndef BASE_PROCESS_PROCESS_PROCESS_H_ |
| 6 #define BASE_PROCESS_PROCESS_PROCESS_H_ | 6 #define BASE_PROCESS_PROCESS_PROCESS_H_ |
| 7 | 7 |
| 8 #include "base/base_export.h" | 8 #include "base/base_export.h" |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/move.h" | 10 #include "base/move.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 Process& operator=(RValue other); | 47 Process& operator=(RValue other); |
| 48 | 48 |
| 49 // Returns an object for the current process. | 49 // Returns an object for the current process. |
| 50 static Process Current(); | 50 static Process Current(); |
| 51 | 51 |
| 52 // Returns a Process for the given |pid|. On Windows the handle is opened | 52 // Returns a Process for the given |pid|. On Windows the handle is opened |
| 53 // with more access rights and must only be used by trusted code (can read the | 53 // with more access rights and must only be used by trusted code (can read the |
| 54 // address space and duplicate handles). | 54 // address space and duplicate handles). |
| 55 static Process OpenWithExtraPriviles(ProcessId pid); | 55 static Process OpenWithExtraPriviles(ProcessId pid); |
| 56 | 56 |
| 57 #if defined(OS_WIN) |
| 58 // Returns a Process for the given |pid|, using some |desired_access|. |
| 59 // See ::OpenProcess documentation for valid |desired_access|. |
| 60 static Process OpenWithAccess(ProcessId pid, DWORD desired_access); |
| 61 #endif |
| 62 |
| 57 // Creates an object from a |handle| owned by someone else. | 63 // Creates an object from a |handle| owned by someone else. |
| 58 // Don't use this for new code. It is only intended to ease the migration to | 64 // Don't use this for new code. It is only intended to ease the migration to |
| 59 // a strict ownership model. | 65 // a strict ownership model. |
| 60 // TODO(rvargas) crbug.com/417532: Remove this code. | 66 // TODO(rvargas) crbug.com/417532: Remove this code. |
| 61 static Process DeprecatedGetProcessFromHandle(ProcessHandle handle); | 67 static Process DeprecatedGetProcessFromHandle(ProcessHandle handle); |
| 62 | 68 |
| 63 // Returns true if processes can be backgrounded. | 69 // Returns true if processes can be backgrounded. |
| 64 static bool CanBackgroundProcesses(); | 70 static bool CanBackgroundProcesses(); |
| 65 | 71 |
| 66 // Returns true if this objects represents a valid process. | 72 // Returns true if this objects represents a valid process. |
| 67 bool IsValid() const; | 73 bool IsValid() const; |
| 68 | 74 |
| 69 // Returns a handle for this process. There is no guarantee about when that | 75 // Returns a handle for this process. There is no guarantee about when that |
| 70 // handle becomes invalid because this object retains ownership. | 76 // handle becomes invalid because this object retains ownership. |
| 71 ProcessHandle Handle() const; | 77 ProcessHandle Handle() const; |
| 72 | 78 |
| 73 // Returns a second object that represents this process. | 79 // Returns a second object that represents this process. |
| 74 Process Duplicate() const; | 80 Process Duplicate() const; |
| 75 | 81 |
| 76 // Get the PID for this process. | 82 // Get the PID for this process. |
| 77 ProcessId pid() const; | 83 ProcessId Pid() const; |
| 78 | 84 |
| 79 // Returns true if this process is the current process. | 85 // Returns true if this process is the current process. |
| 80 bool is_current() const; | 86 bool is_current() const; |
| 81 | 87 |
| 82 // Close the process handle. This will not terminate the process. | 88 // Close the process handle. This will not terminate the process. |
| 83 void Close(); | 89 void Close(); |
| 84 | 90 |
| 85 // Terminates the process with extreme prejudice. The given |result_code| will | 91 // Terminates the process with extreme prejudice. The given |result_code| will |
| 86 // be the exit code of the process. | 92 // be the exit code of the process. |
| 87 // NOTE: On POSIX |result_code| is ignored. | 93 // NOTE: On POSIX |result_code| is ignored. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 113 bool is_current_process_; | 119 bool is_current_process_; |
| 114 win::ScopedHandle process_; | 120 win::ScopedHandle process_; |
| 115 #else | 121 #else |
| 116 ProcessHandle process_; | 122 ProcessHandle process_; |
| 117 #endif | 123 #endif |
| 118 }; | 124 }; |
| 119 | 125 |
| 120 } // namespace base | 126 } // namespace base |
| 121 | 127 |
| 122 #endif // BASE_PROCESS_PROCESS_PROCESS_H_ | 128 #endif // BASE_PROCESS_PROCESS_PROCESS_H_ |
| OLD | NEW |