ipc/chromium/src/chrome/common/process_watcher.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/ipc/chromium/src/chrome/common/process_watcher.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,37 @@
     1.4 +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
     1.5 +// Use of this source code is governed by a BSD-style license that can be
     1.6 +// found in the LICENSE file.
     1.7 +
     1.8 +#ifndef CHROME_COMMON_PROCESS_WATCHER_H_
     1.9 +#define CHROME_COMMON_PROCESS_WATCHER_H_
    1.10 +
    1.11 +#include "base/basictypes.h"
    1.12 +#include "base/process_util.h"
    1.13 +
    1.14 +class ProcessWatcher {
    1.15 + public:
    1.16 +  // This method ensures that the specified process eventually terminates, and
    1.17 +  // then it closes the given process handle.
    1.18 +  //
    1.19 +  // It assumes that the process has already been signalled to exit, and it
    1.20 +  // begins by waiting a small amount of time for it to exit.  If the process
    1.21 +  // does not appear to have exited, then this function starts to become
    1.22 +  // aggressive about ensuring that the process terminates.
    1.23 +  //
    1.24 +  // This method does not block the calling thread.
    1.25 +  //
    1.26 +  // NOTE: The process handle must have been opened with the PROCESS_TERMINATE
    1.27 +  // and SYNCHRONIZE permissions.
    1.28 +  //
    1.29 +  static void EnsureProcessTerminated(base::ProcessHandle process_handle
    1.30 +                                      , bool force=true
    1.31 +  );
    1.32 +
    1.33 + private:
    1.34 +  // Do not instantiate this class.
    1.35 +  ProcessWatcher();
    1.36 +
    1.37 +  DISALLOW_COPY_AND_ASSIGN(ProcessWatcher);
    1.38 +};
    1.39 +
    1.40 +#endif  // CHROME_COMMON_PROCESS_WATCHER_H_

mercurial