| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_COMMON_PROCESS_WATCHER_H_ | |
| 6 #define CONTENT_COMMON_PROCESS_WATCHER_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include "build/build_config.h" | |
| 10 | |
| 11 #include "base/basictypes.h" | |
| 12 #include "base/process.h" | |
| 13 #include "content/common/content_export.h" | |
| 14 | |
| 15 class CONTENT_EXPORT ProcessWatcher { | |
| 16 public: | |
| 17 // This method ensures that the specified process eventually terminates, and | |
| 18 // then it closes the given process handle. | |
| 19 // | |
| 20 // It assumes that the process has already been signalled to exit, and it | |
| 21 // begins by waiting a small amount of time for it to exit. If the process | |
| 22 // does not appear to have exited, then this function starts to become | |
| 23 // aggressive about ensuring that the process terminates. | |
| 24 // | |
| 25 // On Linux this method does not block the calling thread. | |
| 26 // On OS X this method may block for up to 2 seconds. | |
| 27 // | |
| 28 // NOTE: The process handle must have been opened with the PROCESS_TERMINATE | |
| 29 // and SYNCHRONIZE permissions. | |
| 30 // | |
| 31 static void EnsureProcessTerminated(base::ProcessHandle process_handle); | |
| 32 | |
| 33 #if defined(OS_POSIX) && !defined(OS_MACOSX) | |
| 34 // The nicer version of EnsureProcessTerminated() that is patient and will | |
| 35 // wait for |process_handle| to finish and then reap it. | |
| 36 static void EnsureProcessGetsReaped(base::ProcessHandle process_handle); | |
| 37 #endif | |
| 38 | |
| 39 private: | |
| 40 // Do not instantiate this class. | |
| 41 ProcessWatcher(); | |
| 42 | |
| 43 DISALLOW_COPY_AND_ASSIGN(ProcessWatcher); | |
| 44 }; | |
| 45 | |
| 46 #endif // CONTENT_COMMON_PROCESS_WATCHER_H_ | |
| OLD | NEW |