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

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

Issue 7866019: New implementation of font precache on Windows. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Update per code review Created 9 years, 3 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
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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 } 138 }
139 // The base class implementation will delete |this|. 139 // The base class implementation will delete |this|.
140 ServiceChildProcessHost::OnChildDied(); 140 ServiceChildProcessHost::OnChildDied();
141 } 141 }
142 142
143 bool ServiceUtilityProcessHost::OnMessageReceived(const IPC::Message& message) { 143 bool ServiceUtilityProcessHost::OnMessageReceived(const IPC::Message& message) {
144 bool msg_is_ok = false; 144 bool msg_is_ok = false;
145 IPC_BEGIN_MESSAGE_MAP_EX(ServiceUtilityProcessHost, message, msg_is_ok) 145 IPC_BEGIN_MESSAGE_MAP_EX(ServiceUtilityProcessHost, message, msg_is_ok)
146 #if defined(OS_WIN) // This hack is Windows-specific. 146 #if defined(OS_WIN) // This hack is Windows-specific.
147 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_PreCacheFont, OnPreCacheFont) 147 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_PreCacheFont, OnPreCacheFont)
148 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_ReleaseCachedFont,
149 OnReleaseCachedFont)
148 #endif 150 #endif
149 IPC_MESSAGE_HANDLER( 151 IPC_MESSAGE_HANDLER(
150 ChromeUtilityHostMsg_RenderPDFPagesToMetafile_Succeeded, 152 ChromeUtilityHostMsg_RenderPDFPagesToMetafile_Succeeded,
151 OnRenderPDFPagesToMetafileSucceeded) 153 OnRenderPDFPagesToMetafileSucceeded)
152 IPC_MESSAGE_UNHANDLED(msg_is_ok__ = MessageForClient(message)) 154 IPC_MESSAGE_UNHANDLED(msg_is_ok__ = MessageForClient(message))
153 IPC_END_MESSAGE_MAP_EX() 155 IPC_END_MESSAGE_MAP_EX()
154 return true; 156 return true;
155 } 157 }
156 158
157 bool ServiceUtilityProcessHost::MessageForClient(const IPC::Message& message) { 159 bool ServiceUtilityProcessHost::MessageForClient(const IPC::Message& message) {
158 DCHECK(waiting_for_reply_); 160 DCHECK(waiting_for_reply_);
159 bool ret = client_message_loop_proxy_->PostTask( 161 bool ret = client_message_loop_proxy_->PostTask(
160 FROM_HERE, 162 FROM_HERE,
161 NewRunnableMethod(client_.get(), &Client::OnMessageReceived, 163 NewRunnableMethod(client_.get(), &Client::OnMessageReceived,
162 message)); 164 message));
163 waiting_for_reply_ = false; 165 waiting_for_reply_ = false;
164 return ret; 166 return ret;
165 } 167 }
166 168
167 #if defined(OS_WIN) // This hack is Windows-specific. 169 #if defined(OS_WIN) // This hack is Windows-specific.
168 void ServiceUtilityProcessHost::OnPreCacheFont(const LOGFONT& font) { 170 void ServiceUtilityProcessHost::OnPreCacheFont(const LOGFONT& font, int pid) {
169 PreCacheFont(font); 171 PreCacheFont(font, pid);
172 }
173
174 void ServiceUtilityProcessHost::OnReleaseCachedFont(int pid) {
175 ReleaseCachedFont(pid);
170 } 176 }
171 #endif // OS_WIN 177 #endif // OS_WIN
172 178
173 void ServiceUtilityProcessHost::OnRenderPDFPagesToMetafileSucceeded( 179 void ServiceUtilityProcessHost::OnRenderPDFPagesToMetafileSucceeded(
174 int highest_rendered_page_number) { 180 int highest_rendered_page_number) {
175 DCHECK(waiting_for_reply_); 181 DCHECK(waiting_for_reply_);
176 // If the metafile was successfully created, we need to take our hands off the 182 // If the metafile was successfully created, we need to take our hands off the
177 // scratch metafile directory. The client will delete it when it is done with 183 // scratch metafile directory. The client will delete it when it is done with
178 // metafile. 184 // metafile.
179 scratch_metafile_dir_->Take(); 185 scratch_metafile_dir_->Take();
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 printing::Emf metafile; 224 printing::Emf metafile;
219 if (!metafile.InitFromFile(metafile_path)) { 225 if (!metafile.InitFromFile(metafile_path)) {
220 OnRenderPDFPagesToMetafileFailed(); 226 OnRenderPDFPagesToMetafileFailed();
221 } else { 227 } else {
222 OnRenderPDFPagesToMetafileSucceeded(metafile, 228 OnRenderPDFPagesToMetafileSucceeded(metafile,
223 highest_rendered_page_number); 229 highest_rendered_page_number);
224 } 230 }
225 #endif // defined(OS_WIN) 231 #endif // defined(OS_WIN)
226 } 232 }
227 233
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698