michael@0: // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. michael@0: // Use of this source code is governed by a BSD-style license that can be michael@0: // found in the LICENSE file. michael@0: michael@0: #ifndef CHROME_COMMON_PROCESS_WATCHER_H_ michael@0: #define CHROME_COMMON_PROCESS_WATCHER_H_ michael@0: michael@0: #include "base/basictypes.h" michael@0: #include "base/process_util.h" michael@0: michael@0: class ProcessWatcher { michael@0: public: michael@0: // This method ensures that the specified process eventually terminates, and michael@0: // then it closes the given process handle. michael@0: // michael@0: // It assumes that the process has already been signalled to exit, and it michael@0: // begins by waiting a small amount of time for it to exit. If the process michael@0: // does not appear to have exited, then this function starts to become michael@0: // aggressive about ensuring that the process terminates. michael@0: // michael@0: // This method does not block the calling thread. michael@0: // michael@0: // NOTE: The process handle must have been opened with the PROCESS_TERMINATE michael@0: // and SYNCHRONIZE permissions. michael@0: // michael@0: static void EnsureProcessTerminated(base::ProcessHandle process_handle michael@0: , bool force=true michael@0: ); michael@0: michael@0: private: michael@0: // Do not instantiate this class. michael@0: ProcessWatcher(); michael@0: michael@0: DISALLOW_COPY_AND_ASSIGN(ProcessWatcher); michael@0: }; michael@0: michael@0: #endif // CHROME_COMMON_PROCESS_WATCHER_H_