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

Unified Diff: shell/child_process_host.cc

Issue 862133002: Update from https://crrev.com/312398 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: shell/child_process_host.cc
diff --git a/shell/child_process_host.cc b/shell/child_process_host.cc
index 9a68ec4f1b751ad9b20e7780a2ec895396d7a6b7..dd749a7e4a865e98531bac15d04e751dc4aa171e 100644
--- a/shell/child_process_host.cc
+++ b/shell/child_process_host.cc
@@ -24,25 +24,21 @@ namespace shell {
ChildProcessHost::ChildProcessHost(Context* context,
Delegate* delegate,
ChildProcess::Type type)
- : context_(context),
- delegate_(delegate),
- type_(type),
- child_process_handle_(base::kNullProcessHandle) {
+ : context_(context), delegate_(delegate), type_(type) {
DCHECK(delegate);
platform_channel_ = platform_channel_pair_.PassServerHandle();
CHECK(platform_channel_.is_valid());
}
ChildProcessHost::~ChildProcessHost() {
- if (child_process_handle_ != base::kNullProcessHandle) {
+ if (child_process_.IsValid()) {
LOG(WARNING) << "Destroying ChildProcessHost with unjoined child";
- base::CloseProcessHandle(child_process_handle_);
- child_process_handle_ = base::kNullProcessHandle;
+ child_process_.Close();
}
}
void ChildProcessHost::Start() {
- DCHECK_EQ(child_process_handle_, base::kNullProcessHandle);
+ DCHECK(!child_process_.IsValid());
delegate_->WillStart();
@@ -53,12 +49,11 @@ void ChildProcessHost::Start() {
}
int ChildProcessHost::Join() {
- DCHECK_NE(child_process_handle_, base::kNullProcessHandle);
+ DCHECK(child_process_.IsValid());
int rv = -1;
- // Note: |WaitForExitCode()| closes the process handle.
- LOG_IF(ERROR, !base::WaitForExitCode(child_process_handle_, &rv))
+ LOG_IF(ERROR, child_process_.WaitForExit(&rv))
<< "Failed to wait for child process";
- child_process_handle_ = base::kNullProcessHandle;
+ child_process_.Close();
return rv;
}
@@ -86,8 +81,8 @@ bool ChildProcessHost::DoLaunch() {
#elif defined(OS_POSIX)
options.fds_to_remap = &handle_passing_info;
#endif
-
- if (!base::LaunchProcess(child_command_line, options, &child_process_handle_))
+ child_process_ = base::LaunchProcess(child_command_line, options);
+ if (!child_process_.IsValid())
return false;
platform_channel_pair_.ChildProcessLaunched();
« shell/BUILD.gn ('K') | « shell/child_process_host.h ('k') | skia/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698