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

Unified Diff: chrome/browser/extensions/api/messaging/native_message_process_host.cc

Issue 759903002: Upgrade the windows specific version of LaunchProcess to avoid raw handles. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix chrome build Created 6 years 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: chrome/browser/extensions/api/messaging/native_message_process_host.cc
diff --git a/chrome/browser/extensions/api/messaging/native_message_process_host.cc b/chrome/browser/extensions/api/messaging/native_message_process_host.cc
index 98976a103bf4c9c14c3da1eb1ada08c304067f41..c28b233dea7333b39a2e885cab378926a1657e05 100644
--- a/chrome/browser/extensions/api/messaging/native_message_process_host.cc
+++ b/chrome/browser/extensions/api/messaging/native_message_process_host.cc
@@ -47,7 +47,6 @@ NativeMessageProcessHost::NativeMessageProcessHost(
native_host_name_(native_host_name),
launcher_(launcher.Pass()),
closed_(false),
- process_handle_(base::kNullProcessHandle),
#if defined(OS_POSIX)
read_file_(-1),
#endif
@@ -103,7 +102,7 @@ void NativeMessageProcessHost::LaunchHostProcess() {
void NativeMessageProcessHost::OnHostProcessLaunched(
NativeProcessLauncher::LaunchResult result,
- base::ProcessHandle process_handle,
+ base::Process process,
base::File read_file,
base::File write_file) {
DCHECK(task_runner_->BelongsToCurrentThread());
@@ -125,7 +124,7 @@ void NativeMessageProcessHost::OnHostProcessLaunched(
break;
}
- process_handle_ = process_handle;
+ process_ = process.Pass();
#if defined(OS_POSIX)
// This object is not the owner of the file so it should not keep an fd.
read_file_ = read_file.GetPlatformFile();
@@ -349,17 +348,17 @@ void NativeMessageProcessHost::Close(const std::string& error_message) {
client_->CloseChannel(error_message);
}
- if (process_handle_ != base::kNullProcessHandle) {
+ if (process_.IsValid()) {
// Kill the host process if necessary to make sure we don't leave zombies.
// On OSX base::EnsureProcessTerminated() may block, so we have to post a
// task on the blocking pool.
#if defined(OS_MACOSX)
content::BrowserThread::PostBlockingPoolTask(
- FROM_HERE, base::Bind(&base::EnsureProcessTerminated, process_handle_));
+ FROM_HERE,
+ base::Bind(&base::EnsureProcessTerminated, Passed(&process_)));
#else
- base::EnsureProcessTerminated(process_handle_);
+ base::EnsureProcessTerminated(process_.Pass());
#endif
- process_handle_ = base::kNullProcessHandle;
}
}

Powered by Google App Engine
This is Rietveld 408576698