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

Unified Diff: chrome/utility/font_cache_handler_win.h

Issue 1845063002: Revert of Remove font cache code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « chrome/utility/chrome_content_utility_client.cc ('k') | chrome/utility/font_cache_handler_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/utility/font_cache_handler_win.h
diff --git a/chrome/utility/font_cache_handler_win.h b/chrome/utility/font_cache_handler_win.h
new file mode 100644
index 0000000000000000000000000000000000000000..b3bb90ae2da84619c38215570e88f42677c7d2b9
--- /dev/null
+++ b/chrome/utility/font_cache_handler_win.h
@@ -0,0 +1,46 @@
+// 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.
+
+#ifndef CHROME_UTILITY_FONT_CACHE_HANDLER_WIN_H_
+#define CHROME_UTILITY_FONT_CACHE_HANDLER_WIN_H_
+
+#include "base/files/file_path.h"
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
+#include "chrome/utility/utility_message_handler.h"
+
+namespace base {
+class TaskRunner;
+class Thread;
+}
+
+// Handles requests to build a static direct write font cache. Must be invoked
+// in a non-sandboxed utility process. We build static font cache in utility
+// process as it is time consuming as well as crash prone thing. We already
+// have fall back of loading fonts from system fonts directory in place, so even
+// if we fail to build static cache in utility process, chrome will still
+// continue to run as is.
+class FontCacheHandler : public UtilityMessageHandler {
+ public:
+ FontCacheHandler();
+ ~FontCacheHandler() override;
+
+ // IPC::Listener implementation
+ bool OnMessageReceived(const IPC::Message& message) override;
+
+ private:
+ void OnBuildFontCache(const base::FilePath& full_path);
+ void StartBuildingFontCache(const base::FilePath& full_path);
+ void Cleanup();
+
+ scoped_refptr<base::TaskRunner> utility_task_runner_;
+
+ // Thread that caching process runs on, while FontCacheHandler handles
+ // messages from the browser process.
+ scoped_ptr<base::Thread> cache_thread_;
+
+ DISALLOW_COPY_AND_ASSIGN(FontCacheHandler);
+};
+
+#endif // CHROME_UTILITY_FONT_CACHE_HANDLER_WIN_H_
« no previous file with comments | « chrome/utility/chrome_content_utility_client.cc ('k') | chrome/utility/font_cache_handler_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698