summaryrefslogtreecommitdiffstats
path: root/chrome/utility/font_cache_handler_win.cc
diff options
context:
space:
mode:
authorshrikant <shrikant@chromium.org>2014-11-14 14:18:10 -0800
committerCommit bot <commit-bot@chromium.org>2014-11-14 22:19:27 +0000
commit5140a1f1ba5bd57d5c7d9af04ed3eb8ac83f487d (patch)
treefa569a66510fce8db7a1b798f4dc17f8cd210731 /chrome/utility/font_cache_handler_win.cc
parent1ac3c511c7ad46264aa6c33d685ce7d9305a976c (diff)
downloadchromium_src-5140a1f1ba5bd57d5c7d9af04ed3eb8ac83f487d.zip
chromium_src-5140a1f1ba5bd57d5c7d9af04ed3eb8ac83f487d.tar.gz
chromium_src-5140a1f1ba5bd57d5c7d9af04ed3eb8ac83f487d.tar.bz2
DirectWrite Font Cache browser side hookup
This part is mainly to hookup browser side for building and loading font cache. In browser's postprofileinit if font cache already exists in user profile directory then we load that and create a read only shared memory section. If cache is not there then we spawn a Chrome utility process to build font cache, which will be used when browser restarts. For details on how whole thing works please look at design document at https://goto.google.com/font-cache-design BUG=406659 R=cpu, scottmg, ananta Review URL: https://codereview.chromium.org/724633002 Cr-Commit-Position: refs/heads/master@{#304277}
Diffstat (limited to 'chrome/utility/font_cache_handler_win.cc')
-rw-r--r--chrome/utility/font_cache_handler_win.cc24
1 files changed, 24 insertions, 0 deletions
diff --git a/chrome/utility/font_cache_handler_win.cc b/chrome/utility/font_cache_handler_win.cc
new file mode 100644
index 0000000..19e097b
--- /dev/null
+++ b/chrome/utility/font_cache_handler_win.cc
@@ -0,0 +1,24 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/utility/font_cache_handler_win.h"
+
+#include "chrome/common/chrome_utility_messages.h"
+#include "content/public/common/dwrite_font_platform_win.h"
+#include "content/public/utility/utility_thread.h"
+
+bool FontCacheHandler::OnMessageReceived(const IPC::Message& message) {
+ bool handled = true;
+ IPC_BEGIN_MESSAGE_MAP(FontCacheHandler, message)
+ IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_BuildDirectWriteFontCache,
+ OnBuildFontCache)
+ IPC_MESSAGE_UNHANDLED(handled = false)
+ IPC_END_MESSAGE_MAP()
+ return handled;
+}
+
+void FontCacheHandler::OnBuildFontCache(const base::FilePath& full_path) {
+ content::BuildFontCache(full_path);
+ content::UtilityThread::Get()->ReleaseProcessIfNeeded();
+}