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

Unified Diff: chrome/service/service_utility_process_host.cc

Issue 725353003: Don't pass ProcessHandle through ChildProcessHostDelegate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix typo Created 6 years, 1 month 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
« no previous file with comments | « chrome/service/service_utility_process_host.h ('k') | content/browser/browser_child_process_host_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/service/service_utility_process_host.cc
diff --git a/chrome/service/service_utility_process_host.cc b/chrome/service/service_utility_process_host.cc
index 86a7d3940edc99337d1e3043d59934cab391a37b..529a2484711bdb180a9ac8e7c605a497a3175177 100644
--- a/chrome/service/service_utility_process_host.cc
+++ b/chrome/service/service_utility_process_host.cc
@@ -17,6 +17,7 @@
#include "base/metrics/histogram.h"
#include "base/process/kill.h"
#include "base/process/launch.h"
+#include "base/process/process_handle.h"
#include "base/task_runner_util.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/chrome_utility_printing_messages.h"
@@ -153,8 +154,7 @@ class ServiceUtilityProcessHost::PdfToEmfState {
ServiceUtilityProcessHost::ServiceUtilityProcessHost(
Client* client,
base::MessageLoopProxy* client_message_loop_proxy)
- : handle_(base::kNullProcessHandle),
- client_(client),
+ : client_(client),
client_message_loop_proxy_(client_message_loop_proxy),
waiting_for_reply_(false),
weak_ptr_factory_(this) {
@@ -163,7 +163,7 @@ ServiceUtilityProcessHost::ServiceUtilityProcessHost(
ServiceUtilityProcessHost::~ServiceUtilityProcessHost() {
// We need to kill the child process when the host dies.
- base::KillProcess(handle_, content::RESULT_CODE_NORMAL_EXIT, false);
+ base::KillProcess(process_.Handle(), content::RESULT_CODE_NORMAL_EXIT, false);
}
bool ServiceUtilityProcessHost::StartRenderPDFPagesToMetafile(
@@ -233,12 +233,15 @@ bool ServiceUtilityProcessHost::Launch(base::CommandLine* cmd_line,
bool no_sandbox) {
if (no_sandbox) {
cmd_line->AppendSwitch(switches::kNoSandbox);
- base::LaunchProcess(*cmd_line, base::LaunchOptions(), &handle_);
+ base::ProcessHandle handle;
+ if (base::LaunchProcess(*cmd_line, base::LaunchOptions(), &handle))
+ process_ = base::Process(handle);
} else {
ServiceSandboxedProcessLauncherDelegate delegate;
- handle_ = content::StartSandboxedProcess(&delegate, cmd_line);
+ process_ =
+ base::Process(content::StartSandboxedProcess(&delegate, cmd_line));
}
- return (handle_ != base::kNullProcessHandle);
+ return process_.IsValid();
}
bool ServiceUtilityProcessHost::Send(IPC::Message* msg) {
@@ -294,8 +297,8 @@ bool ServiceUtilityProcessHost::OnMessageReceived(const IPC::Message& message) {
return handled;
}
-base::ProcessHandle ServiceUtilityProcessHost::GetHandle() const {
- return handle_;
+const base::Process& ServiceUtilityProcessHost::GetProcess() const {
+ return process_;
}
void ServiceUtilityProcessHost::OnMetafileSpooled(bool success) {
« no previous file with comments | « chrome/service/service_utility_process_host.h ('k') | content/browser/browser_child_process_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698