| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_UTILITY_FONT_CACHE_HANDLER_WIN_H_ | |
| 6 #define CHROME_UTILITY_FONT_CACHE_HANDLER_WIN_H_ | |
| 7 | |
| 8 #include "base/files/file_path.h" | |
| 9 #include "base/memory/ref_counted.h" | |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "chrome/utility/utility_message_handler.h" | |
| 12 | |
| 13 namespace base { | |
| 14 class TaskRunner; | |
| 15 class Thread; | |
| 16 } | |
| 17 | |
| 18 // Handles requests to build a static direct write font cache. Must be invoked | |
| 19 // in a non-sandboxed utility process. We build static font cache in utility | |
| 20 // process as it is time consuming as well as crash prone thing. We already | |
| 21 // have fall back of loading fonts from system fonts directory in place, so even | |
| 22 // if we fail to build static cache in utility process, chrome will still | |
| 23 // continue to run as is. | |
| 24 class FontCacheHandler : public UtilityMessageHandler { | |
| 25 public: | |
| 26 FontCacheHandler(); | |
| 27 ~FontCacheHandler() override; | |
| 28 | |
| 29 // IPC::Listener implementation | |
| 30 bool OnMessageReceived(const IPC::Message& message) override; | |
| 31 | |
| 32 private: | |
| 33 void OnBuildFontCache(const base::FilePath& full_path); | |
| 34 void StartBuildingFontCache(const base::FilePath& full_path); | |
| 35 void Cleanup(); | |
| 36 | |
| 37 scoped_refptr<base::TaskRunner> utility_task_runner_; | |
| 38 | |
| 39 // Thread that caching process runs on, while FontCacheHandler handles | |
| 40 // messages from the browser process. | |
| 41 scoped_ptr<base::Thread> cache_thread_; | |
| 42 | |
| 43 DISALLOW_COPY_AND_ASSIGN(FontCacheHandler); | |
| 44 }; | |
| 45 | |
| 46 #endif // CHROME_UTILITY_FONT_CACHE_HANDLER_WIN_H_ | |
| OLD | NEW |