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

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..c96e6ff95f3fc519898eeb10a1a4bf1800ccffde 100644
--- a/shell/child_process_host.cc
+++ b/shell/child_process_host.cc
@@ -26,23 +26,21 @@ ChildProcessHost::ChildProcessHost(Context* context,
ChildProcess::Type type)
: context_(context),
delegate_(delegate),
- type_(type),
- child_process_handle_(base::kNullProcessHandle) {
+ 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 +51,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))
- << "Failed to wait for child process";
- child_process_handle_ = base::kNullProcessHandle;
+ // Note: |WaitForExit()| closes the process handle.
viettrungluu 2015/01/21 22:27:04 It doesn't, so you should do |child_process_.Close
+ child_process_.WaitForExit(&rv);
+ LOG_IF(ERROR, rv != 0) << "Failed to wait for child process";
viettrungluu 2015/01/21 22:27:04 You should keep the form of the original LOG_IF:
return rv;
}
@@ -86,8 +83,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/child_process_host.h ('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