Chromium Code Reviews| Index: sandbox/win/src/target_process.cc |
| diff --git a/sandbox/win/src/target_process.cc b/sandbox/win/src/target_process.cc |
| index 72e2780c8c3fff520c93704b4ca4b3c66e1a4283..fffdb79c4faacbfce2a8a9b84c874d6f24562896 100644 |
| --- a/sandbox/win/src/target_process.cc |
| +++ b/sandbox/win/src/target_process.cc |
| @@ -63,30 +63,17 @@ TargetProcess::TargetProcess(base::win::ScopedHandle initial_token, |
| base_address_(NULL) {} |
| TargetProcess::~TargetProcess() { |
| - DWORD exit_code = 0; |
| // Give a chance to the process to die. In most cases the JOB_KILL_ON_CLOSE |
| // will take effect only when the context changes. As far as the testing went, |
| // this wait was enough to switch context and kill the processes in the job. |
| // If this process is already dead, the function will return without waiting. |
| - // TODO(nsylvain): If the process is still alive at the end, we should kill |
| - // it. http://b/893891 |
| // For now, this wait is there only to do a best effort to prevent some leaks |
| // from showing up in purify. |
| if (sandbox_process_info_.IsValid()) { |
| ::WaitForSingleObject(sandbox_process_info_.process_handle(), 50); |
| - // At this point, the target process should have been killed. Check. |
| - if (!::GetExitCodeProcess(sandbox_process_info_.process_handle(), |
| - &exit_code) || (STILL_ACTIVE == exit_code)) { |
| - // Something went wrong. We don't know if the target is in a state where |
| - // it can manage to do another IPC call. If it can, and we've destroyed |
| - // the |ipc_server_|, it will crash the broker. So we intentionally leak |
| - // that. |
| - if (shared_section_.IsValid()) |
| - shared_section_.Take(); |
| - ignore_result(ipc_server_.release()); |
| - sandbox_process_info_.TakeProcessHandle(); |
| - return; |
| - } |
| + // Terminate the process if it's still alive, as its IPC server is going |
| + // away. |
| + ::TerminateProcess(sandbox_process_info_.process_handle(), 2); |
|
Will Harris
2016/11/23 16:44:23
why 2?
I think that's RESULT_CODE_HUNG. If it's m
|
| } |
| // ipc_server_ references our process handle, so make sure the former is shut |