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

Unified 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: Fix Linux/Mac build break 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 side-by-side diff with in-line comments
Download patch
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 0c4e88c03a49d5935afb7bbc34827030c762ffde..cb53b9e6808d7fa1176c942c0ffcbc9984e715fa 100644
--- a/chrome/service/service_utility_process_host.cc
+++ b/chrome/service/service_utility_process_host.cc
@@ -20,6 +20,7 @@
#if defined(OS_WIN)
#include "base/memory/scoped_ptr.h"
#include "base/win/scoped_handle.h"
+#include "content/common/child_process_messages.h"
#include "printing/emf_win.h"
#endif
@@ -28,7 +29,8 @@ ServiceUtilityProcessHost::ServiceUtilityProcessHost(
: ServiceChildProcessHost(ChildProcessInfo::UTILITY_PROCESS),
client_(client),
client_message_loop_proxy_(client_message_loop_proxy),
- waiting_for_reply_(false) {
+ waiting_for_reply_(false),
+ unique_process_id_(0) {
}
ServiceUtilityProcessHost::~ServiceUtilityProcessHost() {
@@ -92,6 +94,10 @@ bool ServiceUtilityProcessHost::StartGetPrinterCapsAndDefaults(
return Send(new ChromeUtilityMsg_GetPrinterCapsAndDefaults(printer_name));
}
+int ServiceUtilityProcessHost::unique_process_id() {
+ return unique_process_id_;
+}
+
bool ServiceUtilityProcessHost::StartProcess(bool no_sandbox,
const FilePath& exposed_dir) {
// Name must be set or metrics_service will crash in any test which
@@ -112,7 +118,12 @@ bool ServiceUtilityProcessHost::StartProcess(bool no_sandbox,
cmd_line.AppendSwitchASCII(switches::kProcessChannelID, channel_id());
cmd_line.AppendSwitch(switches::kLang);
- return Launch(&cmd_line, no_sandbox, exposed_dir);
+ if (Launch(&cmd_line, no_sandbox, exposed_dir)) {
+ unique_process_id_ = ChildProcessInfo::GenerateChildProcessUniqueId();
jam 2011/09/19 16:31:17 we usually set this in the constructor. that way t
arthurhsu 2011/09/19 18:22:51 Done.
+ return true;
+ }
+
+ return false;
}
FilePath ServiceUtilityProcessHost::GetUtilityProcessCmd() {
@@ -145,6 +156,8 @@ bool ServiceUtilityProcessHost::OnMessageReceived(const IPC::Message& message) {
IPC_BEGIN_MESSAGE_MAP_EX(ServiceUtilityProcessHost, message, msg_is_ok)
#if defined(OS_WIN) // This hack is Windows-specific.
IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_PreCacheFont, OnPreCacheFont)
+ IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_ReleaseCachedFonts,
+ OnReleaseCachedFonts)
#endif
IPC_MESSAGE_HANDLER(
ChromeUtilityHostMsg_RenderPDFPagesToMetafile_Succeeded,
@@ -166,7 +179,11 @@ bool ServiceUtilityProcessHost::MessageForClient(const IPC::Message& message) {
#if defined(OS_WIN) // This hack is Windows-specific.
void ServiceUtilityProcessHost::OnPreCacheFont(const LOGFONT& font) {
- PreCacheFont(font);
+ PreCacheFont(font, unique_process_id());
+}
+
+void ServiceUtilityProcessHost::OnReleaseCachedFonts() {
+ ReleaseCachedFonts(unique_process_id());
}
#endif // OS_WIN

Powered by Google App Engine
This is Rietveld 408576698