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

Side by Side Diff: sandbox/win/src/target_process.cc

Issue 614813002: Cleanup sandbox/ in advance of re-enabling some MSVC warnings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "sandbox/win/src/target_process.h" 5 #include "sandbox/win/src/target_process.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/win/pe_image.h" 9 #include "base/win/pe_image.h"
10 #include "base/win/startup_information.h" 10 #include "base/win/startup_information.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 // from showing up in purify. 88 // from showing up in purify.
89 if (sandbox_process_info_.IsValid()) { 89 if (sandbox_process_info_.IsValid()) {
90 ::WaitForSingleObject(sandbox_process_info_.process_handle(), 50); 90 ::WaitForSingleObject(sandbox_process_info_.process_handle(), 50);
91 if (!::GetExitCodeProcess(sandbox_process_info_.process_handle(), 91 if (!::GetExitCodeProcess(sandbox_process_info_.process_handle(),
92 &exit_code) || (STILL_ACTIVE == exit_code)) { 92 &exit_code) || (STILL_ACTIVE == exit_code)) {
93 // It is an error to destroy this object while the target process is still 93 // It is an error to destroy this object while the target process is still
94 // alive because we need to destroy the IPC subsystem and cannot risk to 94 // alive because we need to destroy the IPC subsystem and cannot risk to
95 // have an IPC reach us after this point. 95 // have an IPC reach us after this point.
96 if (shared_section_.IsValid()) 96 if (shared_section_.IsValid())
97 shared_section_.Take(); 97 shared_section_.Take();
98 SharedMemIPCServer* server = ipc_server_.release(); 98 // !!! Does |ipc_server_| get cleaned up properly somewhere else, or is
99 // leaking it OK?
Peter Kasting 2014/09/29 23:09:26 This question must be answered before this change
cpu_(ooo_6.6-7.5) 2014/09/30 20:23:45 The theory is that the job object has been closed
Peter Kasting 2014/09/30 20:35:39 It sounds like I should basically leave this code
Peter Kasting 2014/10/01 02:32:13 I attempted to clarify the comments here.
100 ipc_server_.release();
99 sandbox_process_info_.TakeProcessHandle(); 101 sandbox_process_info_.TakeProcessHandle();
100 return; 102 return;
101 } 103 }
102 } 104 }
103 105
104 // ipc_server_ references our process handle, so make sure the former is shut 106 // ipc_server_ references our process handle, so make sure the former is shut
105 // down before the latter is closed (by ScopedProcessInformation). 107 // down before the latter is closed (by ScopedProcessInformation).
106 ipc_server_.reset(); 108 ipc_server_.reset();
107 } 109 }
108 110
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 TargetProcess* MakeTestTargetProcess(HANDLE process, HMODULE base_address) { 330 TargetProcess* MakeTestTargetProcess(HANDLE process, HMODULE base_address) {
329 TargetProcess* target = new TargetProcess(NULL, NULL, NULL, NULL); 331 TargetProcess* target = new TargetProcess(NULL, NULL, NULL, NULL);
330 PROCESS_INFORMATION process_info = {}; 332 PROCESS_INFORMATION process_info = {};
331 process_info.hProcess = process; 333 process_info.hProcess = process;
332 target->sandbox_process_info_.Set(process_info); 334 target->sandbox_process_info_.Set(process_info);
333 target->base_address_ = base_address; 335 target->base_address_ = base_address;
334 return target; 336 return target;
335 } 337 }
336 338
337 } // namespace sandbox 339 } // namespace sandbox
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698