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

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

Issue 7631063: Prefix all IPC messages used by src\chrome with Chrome. For e.g ChromeViewMsg_, ChromeViewHostMsg... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « chrome/renderer/visitedlink_slave.cc ('k') | chrome/utility/chrome_content_utility_client.cc » ('j') | 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/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/message_loop_proxy.h" 10 #include "base/message_loop_proxy.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 if (pdf_file == INVALID_HANDLE_VALUE) 67 if (pdf_file == INVALID_HANDLE_VALUE)
68 return false; 68 return false;
69 HANDLE pdf_file_in_utility_process = NULL; 69 HANDLE pdf_file_in_utility_process = NULL;
70 ::DuplicateHandle(::GetCurrentProcess(), pdf_file, handle(), 70 ::DuplicateHandle(::GetCurrentProcess(), pdf_file, handle(),
71 &pdf_file_in_utility_process, 0, false, 71 &pdf_file_in_utility_process, 0, false,
72 DUPLICATE_SAME_ACCESS); 72 DUPLICATE_SAME_ACCESS);
73 if (!pdf_file_in_utility_process) 73 if (!pdf_file_in_utility_process)
74 return false; 74 return false;
75 waiting_for_reply_ = true; 75 waiting_for_reply_ = true;
76 return Send( 76 return Send(
77 new UtilityMsg_RenderPDFPagesToMetafile(pdf_file_in_utility_process, 77 new ChromeUtilityMsg_RenderPDFPagesToMetafile(
78 metafile_path_, 78 pdf_file_in_utility_process,
79 render_area, 79 metafile_path_,
80 render_dpi, 80 render_area,
81 page_ranges)); 81 render_dpi,
82 page_ranges));
82 #endif // !defined(OS_WIN) 83 #endif // !defined(OS_WIN)
83 } 84 }
84 85
85 bool ServiceUtilityProcessHost::StartGetPrinterCapsAndDefaults( 86 bool ServiceUtilityProcessHost::StartGetPrinterCapsAndDefaults(
86 const std::string& printer_name) { 87 const std::string& printer_name) {
87 FilePath exposed_path; 88 FilePath exposed_path;
88 if (!StartProcess(true, exposed_path)) 89 if (!StartProcess(true, exposed_path))
89 return false; 90 return false;
90 waiting_for_reply_ = true; 91 waiting_for_reply_ = true;
91 return Send(new UtilityMsg_GetPrinterCapsAndDefaults(printer_name)); 92 return Send(new ChromeUtilityMsg_GetPrinterCapsAndDefaults(printer_name));
92 } 93 }
93 94
94 bool ServiceUtilityProcessHost::StartProcess(bool no_sandbox, 95 bool ServiceUtilityProcessHost::StartProcess(bool no_sandbox,
95 const FilePath& exposed_dir) { 96 const FilePath& exposed_dir) {
96 // Name must be set or metrics_service will crash in any test which 97 // Name must be set or metrics_service will crash in any test which
97 // launches a UtilityProcessHost. 98 // launches a UtilityProcessHost.
98 set_name(ASCIIToUTF16("utility process")); 99 set_name(ASCIIToUTF16("utility process"));
99 100
100 if (!CreateChannel()) 101 if (!CreateChannel())
101 return false; 102 return false;
(...skipping 29 matching lines...) Expand all
131 NewRunnableMethod(client_.get(), &Client::OnChildDied)); 132 NewRunnableMethod(client_.get(), &Client::OnChildDied));
132 } 133 }
133 // The base class implementation will delete |this|. 134 // The base class implementation will delete |this|.
134 ServiceChildProcessHost::OnChildDied(); 135 ServiceChildProcessHost::OnChildDied();
135 } 136 }
136 137
137 bool ServiceUtilityProcessHost::OnMessageReceived(const IPC::Message& message) { 138 bool ServiceUtilityProcessHost::OnMessageReceived(const IPC::Message& message) {
138 bool msg_is_ok = false; 139 bool msg_is_ok = false;
139 IPC_BEGIN_MESSAGE_MAP_EX(ServiceUtilityProcessHost, message, msg_is_ok) 140 IPC_BEGIN_MESSAGE_MAP_EX(ServiceUtilityProcessHost, message, msg_is_ok)
140 #if defined(OS_WIN) // This hack is Windows-specific. 141 #if defined(OS_WIN) // This hack is Windows-specific.
141 IPC_MESSAGE_HANDLER(UtilityHostMsg_PreCacheFont, OnPreCacheFont) 142 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_PreCacheFont, OnPreCacheFont)
142 #endif 143 #endif
143 IPC_MESSAGE_HANDLER(UtilityHostMsg_RenderPDFPagesToMetafile_Succeeded, 144 IPC_MESSAGE_HANDLER(
144 OnRenderPDFPagesToMetafileSucceeded) 145 ChromeUtilityHostMsg_RenderPDFPagesToMetafile_Succeeded,
146 OnRenderPDFPagesToMetafileSucceeded)
145 IPC_MESSAGE_UNHANDLED(msg_is_ok__ = MessageForClient(message)) 147 IPC_MESSAGE_UNHANDLED(msg_is_ok__ = MessageForClient(message))
146 IPC_END_MESSAGE_MAP_EX() 148 IPC_END_MESSAGE_MAP_EX()
147 return true; 149 return true;
148 } 150 }
149 151
150 bool ServiceUtilityProcessHost::MessageForClient(const IPC::Message& message) { 152 bool ServiceUtilityProcessHost::MessageForClient(const IPC::Message& message) {
151 DCHECK(waiting_for_reply_); 153 DCHECK(waiting_for_reply_);
152 bool ret = client_message_loop_proxy_->PostTask( 154 bool ret = client_message_loop_proxy_->PostTask(
153 FROM_HERE, 155 FROM_HERE,
154 NewRunnableMethod(client_.get(), &Client::OnMessageReceived, 156 NewRunnableMethod(client_.get(), &Client::OnMessageReceived,
(...skipping 22 matching lines...) Expand all
177 metafile_path_, 179 metafile_path_,
178 highest_rendered_page_number)); 180 highest_rendered_page_number));
179 waiting_for_reply_ = false; 181 waiting_for_reply_ = false;
180 } 182 }
181 183
182 bool ServiceUtilityProcessHost::Client::OnMessageReceived( 184 bool ServiceUtilityProcessHost::Client::OnMessageReceived(
183 const IPC::Message& message) { 185 const IPC::Message& message) {
184 bool msg_is_ok = true; 186 bool msg_is_ok = true;
185 bool handled = true; 187 bool handled = true;
186 IPC_BEGIN_MESSAGE_MAP_EX(ServiceUtilityProcessHost, message, msg_is_ok) 188 IPC_BEGIN_MESSAGE_MAP_EX(ServiceUtilityProcessHost, message, msg_is_ok)
187 IPC_MESSAGE_HANDLER(UtilityHostMsg_RenderPDFPagesToMetafile_Failed, 189 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_RenderPDFPagesToMetafile_Failed,
188 Client::OnRenderPDFPagesToMetafileFailed) 190 Client::OnRenderPDFPagesToMetafileFailed)
189 IPC_MESSAGE_HANDLER(UtilityHostMsg_GetPrinterCapsAndDefaults_Succeeded, 191 IPC_MESSAGE_HANDLER(
190 Client::OnGetPrinterCapsAndDefaultsSucceeded) 192 ChromeUtilityHostMsg_GetPrinterCapsAndDefaults_Succeeded,
191 IPC_MESSAGE_HANDLER(UtilityHostMsg_GetPrinterCapsAndDefaults_Failed, 193 Client::OnGetPrinterCapsAndDefaultsSucceeded)
194 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_GetPrinterCapsAndDefaults_Failed,
192 Client::OnGetPrinterCapsAndDefaultsFailed) 195 Client::OnGetPrinterCapsAndDefaultsFailed)
193 IPC_MESSAGE_UNHANDLED(handled = false) 196 IPC_MESSAGE_UNHANDLED(handled = false)
194 IPC_END_MESSAGE_MAP_EX() 197 IPC_END_MESSAGE_MAP_EX()
195 return handled; 198 return handled;
196 } 199 }
197 200
198 void ServiceUtilityProcessHost::Client::MetafileAvailable( 201 void ServiceUtilityProcessHost::Client::MetafileAvailable(
199 const FilePath& metafile_path, 202 const FilePath& metafile_path,
200 int highest_rendered_page_number) { 203 int highest_rendered_page_number) {
201 // The metafile was created in a temp folder which needs to get deleted after 204 // The metafile was created in a temp folder which needs to get deleted after
202 // we have processed it. 205 // we have processed it.
203 ScopedTempDir scratch_metafile_dir; 206 ScopedTempDir scratch_metafile_dir;
204 if (!scratch_metafile_dir.Set(metafile_path.DirName())) 207 if (!scratch_metafile_dir.Set(metafile_path.DirName()))
205 LOG(WARNING) << "Unable to set scratch metafile directory"; 208 LOG(WARNING) << "Unable to set scratch metafile directory";
206 #if defined(OS_WIN) 209 #if defined(OS_WIN)
207 // It's important that metafile is declared after scratch_metafile_dir so 210 // It's important that metafile is declared after scratch_metafile_dir so
208 // that the metafile destructor closes the file before the ScopedTempDir 211 // that the metafile destructor closes the file before the ScopedTempDir
209 // destructor tries to remove the directory. 212 // destructor tries to remove the directory.
210 printing::Emf metafile; 213 printing::Emf metafile;
211 if (!metafile.InitFromFile(metafile_path)) { 214 if (!metafile.InitFromFile(metafile_path)) {
212 OnRenderPDFPagesToMetafileFailed(); 215 OnRenderPDFPagesToMetafileFailed();
213 } else { 216 } else {
214 OnRenderPDFPagesToMetafileSucceeded(metafile, 217 OnRenderPDFPagesToMetafileSucceeded(metafile,
215 highest_rendered_page_number); 218 highest_rendered_page_number);
216 } 219 }
217 #endif // defined(OS_WIN) 220 #endif // defined(OS_WIN)
218 } 221 }
219 222
OLDNEW
« no previous file with comments | « chrome/renderer/visitedlink_slave.cc ('k') | chrome/utility/chrome_content_utility_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698