summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/utility/DEPS2
-rw-r--r--chrome/utility/chrome_content_utility_client.cc11
-rw-r--r--content/public/utility/utility_thread.h13
-rw-r--r--content/utility/utility_thread_impl.cc14
-rw-r--r--content/utility/utility_thread_impl.h5
5 files changed, 36 insertions, 9 deletions
diff --git a/chrome/utility/DEPS b/chrome/utility/DEPS
index 87d7ba5..4893780 100644
--- a/chrome/utility/DEPS
+++ b/chrome/utility/DEPS
@@ -1,5 +1,7 @@
include_rules = [
"+chrome/browser", # For out of process profile import.
+ # TODO(jam): remove this once all of chrome doesn't depend on content/common.
+ "-content/common",
"+content/public/utility",
"+webkit/glue",
]
diff --git a/chrome/utility/chrome_content_utility_client.cc b/chrome/utility/chrome_content_utility_client.cc
index d10bfb1..497ba56 100644
--- a/chrome/utility/chrome_content_utility_client.cc
+++ b/chrome/utility/chrome_content_utility_client.cc
@@ -31,8 +31,6 @@
#include "base/path_service.h"
#include "base/win/iat_patch_function.h"
#include "base/win/scoped_handle.h"
-#include "content/common/child_process_messages.h"
-#include "content/common/sandbox_init_wrapper.h"
#include "content/public/common/content_switches.h"
#include "printing/emf_win.h"
#endif // defined(OS_WIN)
@@ -234,12 +232,9 @@ DWORD WINAPI UtilityProcess_GetFontDataPatch(
LOGFONT logfont;
if (GetObject(font, sizeof(LOGFONT), &logfont)) {
std::vector<char> font_data;
- if (content::UtilityThread::Get()->Send(
- new ChildProcessHostMsg_PreCacheFont(logfont))) {
- rv = GetFontData(hdc, table, offset, buffer, length);
- content::UtilityThread::Get()->Send(
- new ChildProcessHostMsg_ReleaseCachedFonts());
- }
+ content::UtilityThread::Get()->PreCacheFont(logfont);
+ rv = GetFontData(hdc, table, offset, buffer, length);
+ content::UtilityThread::Get()->ReleaseCachedFonts();
}
}
return rv;
diff --git a/content/public/utility/utility_thread.h b/content/public/utility/utility_thread.h
index 7d22efa..d2e43b9 100644
--- a/content/public/utility/utility_thread.h
+++ b/content/public/utility/utility_thread.h
@@ -10,6 +10,10 @@
#include "content/common/content_export.h"
#include "ipc/ipc_message.h"
+#if defined(OS_WIN)
+#include <windows.h>
+#endif
+
namespace content {
class CONTENT_EXPORT UtilityThread : public IPC::Message::Sender {
@@ -23,6 +27,15 @@ namespace content {
// Releases the process if we are not (or no longer) in batch mode.
virtual void ReleaseProcessIfNeeded() = 0;
+
+#if defined(OS_WIN)
+ // Request that the given font be loaded by the browser so it's cached by the
+ // OS. Please see ChildProcessHost::PreCacheFont for details.
+ virtual void PreCacheFont(const LOGFONT& log_font) = 0;
+
+ // Release cached font.
+ virtual void ReleaseCachedFonts() = 0;
+#endif
};
} // namespace content
diff --git a/content/utility/utility_thread_impl.cc b/content/utility/utility_thread_impl.cc
index a743c27..f53fcd8 100644
--- a/content/utility/utility_thread_impl.cc
+++ b/content/utility/utility_thread_impl.cc
@@ -9,6 +9,7 @@
#include "base/file_path.h"
#include "base/memory/scoped_vector.h"
#include "content/common/child_process.h"
+#include "content/common/child_process_messages.h"
#include "content/common/indexed_db_key.h"
#include "content/common/utility_messages.h"
#include "content/public/utility/content_utility_client.h"
@@ -51,6 +52,19 @@ void UtilityThreadImpl::ReleaseProcessIfNeeded() {
ChildProcess::current()->ReleaseProcess();
}
+#if defined(OS_WIN)
+
+void UtilityThreadImpl::PreCacheFont(const LOGFONT& log_font) {
+ Send(new ChildProcessHostMsg_PreCacheFont(log_font));
+}
+
+void UtilityThreadImpl::ReleaseCachedFonts() {
+ Send(new ChildProcessHostMsg_ReleaseCachedFonts());
+}
+
+#endif // OS_WIN
+
+
bool UtilityThreadImpl::OnControlMessageReceived(const IPC::Message& msg) {
if (content::GetContentClient()->utility()->OnMessageReceived(msg))
return true;
diff --git a/content/utility/utility_thread_impl.h b/content/utility/utility_thread_impl.h
index 149fc6e..ab468c4 100644
--- a/content/utility/utility_thread_impl.h
+++ b/content/utility/utility_thread_impl.h
@@ -39,8 +39,11 @@ class UtilityThreadImpl : public content::UtilityThread,
virtual ~UtilityThreadImpl();
virtual bool Send(IPC::Message* msg) OVERRIDE;
-
virtual void ReleaseProcessIfNeeded() OVERRIDE;
+#if defined(OS_WIN)
+ virtual void PreCacheFont(const LOGFONT& log_font) OVERRIDE;
+ virtual void ReleaseCachedFonts() OVERRIDE;
+#endif
private:
// ChildThread implementation.