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

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

Issue 8755002: Don't make ServiceChildProcessHost derive from ChildProcessInfo. It didn't really need to. This i... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/service/service_child_process_host.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
11 #include "base/message_loop_proxy.h" 11 #include "base/message_loop_proxy.h"
12 #include "base/scoped_temp_dir.h" 12 #include "base/scoped_temp_dir.h"
13 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
14 #include "chrome/common/chrome_switches.h" 14 #include "chrome/common/chrome_switches.h"
15 #include "chrome/common/chrome_utility_messages.h" 15 #include "chrome/common/chrome_utility_messages.h"
16 #include "ipc/ipc_switches.h" 16 #include "ipc/ipc_switches.h"
17 #include "printing/page_range.h" 17 #include "printing/page_range.h"
18 #include "ui/base/ui_base_switches.h" 18 #include "ui/base/ui_base_switches.h"
19 #include "ui/gfx/rect.h" 19 #include "ui/gfx/rect.h"
20 20
21 #if defined(OS_WIN) 21 #if defined(OS_WIN)
22 #include "base/memory/scoped_ptr.h" 22 #include "base/memory/scoped_ptr.h"
23 #include "base/win/scoped_handle.h" 23 #include "base/win/scoped_handle.h"
24 #include "content/common/child_process_info.h"
Scott Byer 2011/11/30 20:48:33 nit: include order
jam 2011/11/30 20:54:20 ?
24 #include "content/common/child_process_messages.h" 25 #include "content/common/child_process_messages.h"
25 #include "printing/emf_win.h" 26 #include "printing/emf_win.h"
26 #endif 27 #endif
27 28
28 ServiceUtilityProcessHost::ServiceUtilityProcessHost( 29 ServiceUtilityProcessHost::ServiceUtilityProcessHost(
29 Client* client, base::MessageLoopProxy* client_message_loop_proxy) 30 Client* client, base::MessageLoopProxy* client_message_loop_proxy)
30 : ServiceChildProcessHost(ChildProcessInfo::UTILITY_PROCESS), 31 : client_(client),
31 client_(client),
32 client_message_loop_proxy_(client_message_loop_proxy), 32 client_message_loop_proxy_(client_message_loop_proxy),
33 waiting_for_reply_(false) { 33 waiting_for_reply_(false) {
34 process_id_ = ChildProcessInfo::GenerateChildProcessUniqueId(); 34 process_id_ = ChildProcessInfo::GenerateChildProcessUniqueId();
35 } 35 }
36 36
37 ServiceUtilityProcessHost::~ServiceUtilityProcessHost() { 37 ServiceUtilityProcessHost::~ServiceUtilityProcessHost() {
38 } 38 }
39 39
40 bool ServiceUtilityProcessHost::StartRenderPDFPagesToMetafile( 40 bool ServiceUtilityProcessHost::StartRenderPDFPagesToMetafile(
41 const FilePath& pdf_path, 41 const FilePath& pdf_path,
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 const std::string& printer_name) { 88 const std::string& printer_name) {
89 FilePath exposed_path; 89 FilePath exposed_path;
90 if (!StartProcess(true, exposed_path)) 90 if (!StartProcess(true, exposed_path))
91 return false; 91 return false;
92 waiting_for_reply_ = true; 92 waiting_for_reply_ = true;
93 return Send(new ChromeUtilityMsg_GetPrinterCapsAndDefaults(printer_name)); 93 return Send(new ChromeUtilityMsg_GetPrinterCapsAndDefaults(printer_name));
94 } 94 }
95 95
96 bool ServiceUtilityProcessHost::StartProcess(bool no_sandbox, 96 bool ServiceUtilityProcessHost::StartProcess(bool no_sandbox,
97 const FilePath& exposed_dir) { 97 const FilePath& exposed_dir) {
98 // Name must be set or metrics_service will crash in any test which
99 // launches a UtilityProcessHost.
100 set_name(ASCIIToUTF16("utility process"));
101
102 if (!CreateChannel()) 98 if (!CreateChannel())
103 return false; 99 return false;
104 100
105 FilePath exe_path = GetUtilityProcessCmd(); 101 FilePath exe_path = GetUtilityProcessCmd();
106 if (exe_path.empty()) { 102 if (exe_path.empty()) {
107 NOTREACHED() << "Unable to get utility process binary name."; 103 NOTREACHED() << "Unable to get utility process binary name.";
108 return false; 104 return false;
109 } 105 }
110 106
111 CommandLine cmd_line(exe_path); 107 CommandLine cmd_line(exe_path);
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 printing::Emf metafile; 227 printing::Emf metafile;
232 if (!metafile.InitFromFile(metafile_path)) { 228 if (!metafile.InitFromFile(metafile_path)) {
233 OnRenderPDFPagesToMetafileFailed(); 229 OnRenderPDFPagesToMetafileFailed();
234 } else { 230 } else {
235 OnRenderPDFPagesToMetafileSucceeded(metafile, 231 OnRenderPDFPagesToMetafileSucceeded(metafile,
236 highest_rendered_page_number); 232 highest_rendered_page_number);
237 } 233 }
238 #endif // defined(OS_WIN) 234 #endif // defined(OS_WIN)
239 } 235 }
240 236
OLDNEW
« no previous file with comments | « chrome/service/service_child_process_host.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698