Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
michael@0 | 2 | // Use of this source code is governed by a BSD-style license that can be |
michael@0 | 3 | // found in the LICENSE file. |
michael@0 | 4 | |
michael@0 | 5 | #ifndef CHROME_COMMON_PROCESS_WATCHER_H_ |
michael@0 | 6 | #define CHROME_COMMON_PROCESS_WATCHER_H_ |
michael@0 | 7 | |
michael@0 | 8 | #include "base/basictypes.h" |
michael@0 | 9 | #include "base/process_util.h" |
michael@0 | 10 | |
michael@0 | 11 | class ProcessWatcher { |
michael@0 | 12 | public: |
michael@0 | 13 | // This method ensures that the specified process eventually terminates, and |
michael@0 | 14 | // then it closes the given process handle. |
michael@0 | 15 | // |
michael@0 | 16 | // It assumes that the process has already been signalled to exit, and it |
michael@0 | 17 | // begins by waiting a small amount of time for it to exit. If the process |
michael@0 | 18 | // does not appear to have exited, then this function starts to become |
michael@0 | 19 | // aggressive about ensuring that the process terminates. |
michael@0 | 20 | // |
michael@0 | 21 | // This method does not block the calling thread. |
michael@0 | 22 | // |
michael@0 | 23 | // NOTE: The process handle must have been opened with the PROCESS_TERMINATE |
michael@0 | 24 | // and SYNCHRONIZE permissions. |
michael@0 | 25 | // |
michael@0 | 26 | static void EnsureProcessTerminated(base::ProcessHandle process_handle |
michael@0 | 27 | , bool force=true |
michael@0 | 28 | ); |
michael@0 | 29 | |
michael@0 | 30 | private: |
michael@0 | 31 | // Do not instantiate this class. |
michael@0 | 32 | ProcessWatcher(); |
michael@0 | 33 | |
michael@0 | 34 | DISALLOW_COPY_AND_ASSIGN(ProcessWatcher); |
michael@0 | 35 | }; |
michael@0 | 36 | |
michael@0 | 37 | #endif // CHROME_COMMON_PROCESS_WATCHER_H_ |