| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_COMMON_PROCESS_WATCHER_H__ | 5 #ifndef CHROME_COMMON_PROCESS_WATCHER_H_ |
| 6 #define CHROME_COMMON_PROCESS_WATCHER_H__ | 6 #define CHROME_COMMON_PROCESS_WATCHER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" |
| 8 #include "base/process_util.h" | 9 #include "base/process_util.h" |
| 9 | 10 |
| 10 class ProcessWatcher { | 11 class ProcessWatcher { |
| 11 public: | 12 public: |
| 12 // This method ensures that the specified process eventually terminates, and | 13 // This method ensures that the specified process eventually terminates, and |
| 13 // then it closes the given process handle. | 14 // then it closes the given process handle. |
| 14 // | 15 // |
| 15 // It assumes that the process has already been signalled to exit, and it | 16 // It assumes that the process has already been signalled to exit, and it |
| 16 // begins by waiting a small amount of time for it to exit. If the process | 17 // begins by waiting a small amount of time for it to exit. If the process |
| 17 // does not appear to have exited, then this function starts to become | 18 // does not appear to have exited, then this function starts to become |
| 18 // aggressive about ensuring that the process terminates. | 19 // aggressive about ensuring that the process terminates. |
| 19 // | 20 // |
| 20 // This method does not block the calling thread. | 21 // This method does not block the calling thread. |
| 21 // | 22 // |
| 22 // NOTE: The process handle must have been opened with the PROCESS_TERMINATE | 23 // NOTE: The process handle must have been opened with the PROCESS_TERMINATE |
| 23 // and SYNCHRONIZE permissions. | 24 // and SYNCHRONIZE permissions. |
| 24 // | 25 // |
| 25 static void EnsureProcessTerminated(ProcessHandle process_handle); | 26 static void EnsureProcessTerminated(base::ProcessHandle process_handle); |
| 26 | 27 |
| 27 private: | 28 private: |
| 28 // Do not instantiate this class. | 29 // Do not instantiate this class. |
| 29 ProcessWatcher(); | 30 ProcessWatcher(); |
| 30 | 31 |
| 31 DISALLOW_EVIL_CONSTRUCTORS(ProcessWatcher); | 32 DISALLOW_COPY_AND_ASSIGN(ProcessWatcher); |
| 32 }; | 33 }; |
| 33 | 34 |
| 34 #endif // CHROME_COMMON_PROCESS_WATCHER_H__ | 35 #endif // CHROME_COMMON_PROCESS_WATCHER_H_ |
| 35 | 36 |
| OLD | NEW |