Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(192)

Side by Side Diff: base/process/kill.h

Issue 23866011: Fix a bug where killing pages doesn't yield a sad-tab (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Clean up whitespace Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | base/process/kill_posix.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 // This file contains routines to kill processes and get the exit code and 5 // This file contains routines to kill processes and get the exit code and
6 // termination status. 6 // termination status.
7 7
8 #ifndef BASE_PROCESS_KILL_H_ 8 #ifndef BASE_PROCESS_KILL_H_
9 #define BASE_PROCESS_KILL_H_ 9 #define BASE_PROCESS_KILL_H_
10 10
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 // the status returned by waitpid() on POSIX, and from 60 // the status returned by waitpid() on POSIX, and from
61 // GetExitCodeProcess() on Windows. |exit_code| may be NULL if the 61 // GetExitCodeProcess() on Windows. |exit_code| may be NULL if the
62 // caller is not interested in it. Note that on Linux, this function 62 // caller is not interested in it. Note that on Linux, this function
63 // will only return a useful result the first time it is called after 63 // will only return a useful result the first time it is called after
64 // the child exits (because it will reap the child and the information 64 // the child exits (because it will reap the child and the information
65 // will no longer be available). 65 // will no longer be available).
66 BASE_EXPORT TerminationStatus GetTerminationStatus(ProcessHandle handle, 66 BASE_EXPORT TerminationStatus GetTerminationStatus(ProcessHandle handle,
67 int* exit_code); 67 int* exit_code);
68 68
69 #if defined(OS_POSIX) 69 #if defined(OS_POSIX)
70 // Wait for the process to exit and get the termination status. See 70 // Send a kill signal to the process and then wait for the process to exit
71 // GetTerminationStatus for more information. On POSIX systems, we can't call 71 // and get the termination status.
72 // WaitForExitCode and then GetTerminationStatus as the child will be reaped 72 //
73 // when WaitForExitCode return and this information will be lost. 73 // This is used in situations where it is believed that the process is dead
74 BASE_EXPORT TerminationStatus WaitForTerminationStatus(ProcessHandle handle, 74 // or dying (because communication with the child process has been cut).
75 int* exit_code); 75 // In order to avoid erroneously returning that the process is still running
76 // because the kernel is still cleaning it up, this will wait for the process
77 // to terminate. In order to avoid the risk of hanging while waiting for the
78 // process to terminate, send a SIGKILL to the process before waiting for the
79 // termination status.
80 //
81 // Note that it is not an option to call WaitForExitCode and then
82 // GetTerminationStatus as the child will be reaped when WaitForExitCode
83 // returns, and this information will be lost.
84 //
85 BASE_EXPORT TerminationStatus GetKnownDeadTerminationStatus(
86 ProcessHandle handle, int* exit_code);
76 #endif // defined(OS_POSIX) 87 #endif // defined(OS_POSIX)
77 88
78 // Waits for process to exit. On POSIX systems, if the process hasn't been 89 // Waits for process to exit. On POSIX systems, if the process hasn't been
79 // signaled then puts the exit code in |exit_code|; otherwise it's considered 90 // signaled then puts the exit code in |exit_code|; otherwise it's considered
80 // a failure. On Windows |exit_code| is always filled. Returns true on success, 91 // a failure. On Windows |exit_code| is always filled. Returns true on success,
81 // and closes |handle| in any case. 92 // and closes |handle| in any case.
82 BASE_EXPORT bool WaitForExitCode(ProcessHandle handle, int* exit_code); 93 BASE_EXPORT bool WaitForExitCode(ProcessHandle handle, int* exit_code);
83 94
84 // Waits for process to exit. If it did exit within |timeout_milliseconds|, 95 // Waits for process to exit. If it did exit within |timeout_milliseconds|,
85 // then puts the exit code in |exit_code|, and returns true. 96 // then puts the exit code in |exit_code|, and returns true.
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 146
136 #if defined(OS_POSIX) && !defined(OS_MACOSX) 147 #if defined(OS_POSIX) && !defined(OS_MACOSX)
137 // The nicer version of EnsureProcessTerminated() that is patient and will 148 // The nicer version of EnsureProcessTerminated() that is patient and will
138 // wait for |process_handle| to finish and then reap it. 149 // wait for |process_handle| to finish and then reap it.
139 BASE_EXPORT void EnsureProcessGetsReaped(ProcessHandle process_handle); 150 BASE_EXPORT void EnsureProcessGetsReaped(ProcessHandle process_handle);
140 #endif 151 #endif
141 152
142 } // namespace base 153 } // namespace base
143 154
144 #endif // BASE_PROCESS_KILL_H_ 155 #endif // BASE_PROCESS_KILL_H_
OLDNEW
« no previous file with comments | « no previous file | base/process/kill_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698