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

Side by Side Diff: chrome/service/service_utility_process_host.cc

Issue 999033003: Remove uses of KillProcess() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 "chrome/service/service_utility_process_host.h" 5 #include "chrome/service/service_utility_process_host.h"
6 6
7 #include <queue> 7 #include <queue>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/files/file.h" 11 #include "base/files/file.h"
12 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
13 #include "base/files/file_util.h" 13 #include "base/files/file_util.h"
14 #include "base/files/scoped_temp_dir.h" 14 #include "base/files/scoped_temp_dir.h"
15 #include "base/logging.h" 15 #include "base/logging.h"
16 #include "base/message_loop/message_loop_proxy.h" 16 #include "base/message_loop/message_loop_proxy.h"
17 #include "base/metrics/histogram.h" 17 #include "base/metrics/histogram.h"
18 #include "base/process/kill.h"
19 #include "base/process/launch.h" 18 #include "base/process/launch.h"
20 #include "base/process/process_handle.h"
21 #include "base/task_runner_util.h" 19 #include "base/task_runner_util.h"
22 #include "chrome/common/chrome_switches.h" 20 #include "chrome/common/chrome_switches.h"
23 #include "chrome/common/chrome_utility_printing_messages.h" 21 #include "chrome/common/chrome_utility_printing_messages.h"
24 #include "content/public/common/child_process_host.h" 22 #include "content/public/common/child_process_host.h"
25 #include "content/public/common/result_codes.h" 23 #include "content/public/common/result_codes.h"
26 #include "content/public/common/sandbox_init.h" 24 #include "content/public/common/sandbox_init.h"
27 #include "content/public/common/sandboxed_process_launcher_delegate.h" 25 #include "content/public/common/sandboxed_process_launcher_delegate.h"
28 #include "ipc/ipc_switches.h" 26 #include "ipc/ipc_switches.h"
29 #include "printing/emf_win.h" 27 #include "printing/emf_win.h"
30 #include "sandbox/win/src/sandbox_policy_base.h" 28 #include "sandbox/win/src/sandbox_policy_base.h"
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 base::MessageLoopProxy* client_message_loop_proxy) 154 base::MessageLoopProxy* client_message_loop_proxy)
157 : client_(client), 155 : client_(client),
158 client_message_loop_proxy_(client_message_loop_proxy), 156 client_message_loop_proxy_(client_message_loop_proxy),
159 waiting_for_reply_(false), 157 waiting_for_reply_(false),
160 weak_ptr_factory_(this) { 158 weak_ptr_factory_(this) {
161 child_process_host_.reset(ChildProcessHost::Create(this)); 159 child_process_host_.reset(ChildProcessHost::Create(this));
162 } 160 }
163 161
164 ServiceUtilityProcessHost::~ServiceUtilityProcessHost() { 162 ServiceUtilityProcessHost::~ServiceUtilityProcessHost() {
165 // We need to kill the child process when the host dies. 163 // We need to kill the child process when the host dies.
166 base::KillProcess(process_.Handle(), content::RESULT_CODE_NORMAL_EXIT, false); 164 process_.Terminate(content::RESULT_CODE_NORMAL_EXIT, false);
167 } 165 }
168 166
169 bool ServiceUtilityProcessHost::StartRenderPDFPagesToMetafile( 167 bool ServiceUtilityProcessHost::StartRenderPDFPagesToMetafile(
170 const base::FilePath& pdf_path, 168 const base::FilePath& pdf_path,
171 const printing::PdfRenderSettings& render_settings) { 169 const printing::PdfRenderSettings& render_settings) {
172 ReportUmaEvent(SERVICE_UTILITY_METAFILE_REQUEST); 170 ReportUmaEvent(SERVICE_UTILITY_METAFILE_REQUEST);
173 start_time_ = base::Time::Now(); 171 start_time_ = base::Time::Now();
174 base::File pdf_file(pdf_path, base::File::FLAG_OPEN | base::File::FLAG_READ); 172 base::File pdf_file(pdf_path, base::File::FLAG_OPEN | base::File::FLAG_READ);
175 if (!pdf_file.IsValid() || !StartProcess(false)) 173 if (!pdf_file.IsValid() || !StartProcess(false))
176 return false; 174 return false;
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 return false; 416 return false;
419 } 417 }
420 printing::Emf emf; 418 printing::Emf emf;
421 if (!emf.InitFromData(data.data(), data.size())) { 419 if (!emf.InitFromData(data.data(), data.size())) {
422 OnRenderPDFPagesToMetafileDone(false); 420 OnRenderPDFPagesToMetafileDone(false);
423 return false; 421 return false;
424 } 422 }
425 OnRenderPDFPagesToMetafilePageDone(scale_factor, emf); 423 OnRenderPDFPagesToMetafilePageDone(scale_factor, emf);
426 return true; 424 return true;
427 } 425 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698