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

Side by Side Diff: chrome/utility/font_cache_handler_win.cc

Issue 1847173002: Revert "Revert of Remove font cache code (patchset #3 id:40001 of https://codereview.chromium.org/1… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add test expectations to rebaseline tests on Win10 Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « chrome/utility/font_cache_handler_win.h ('k') | content/child/font_warmup_win.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 #include "chrome/utility/font_cache_handler_win.h"
6
7 #include "base/task_runner_util.h"
8 #include "base/threading/thread.h"
9 #include "chrome/common/chrome_utility_messages.h"
10 #include "content/public/common/dwrite_font_platform_win.h"
11 #include "content/public/utility/utility_thread.h"
12
13 FontCacheHandler::FontCacheHandler() {
14 }
15
16 FontCacheHandler::~FontCacheHandler() {
17 }
18
19 bool FontCacheHandler::OnMessageReceived(const IPC::Message& message) {
20 bool handled = true;
21 IPC_BEGIN_MESSAGE_MAP(FontCacheHandler, message)
22 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_BuildDirectWriteFontCache,
23 OnBuildFontCache)
24 IPC_MESSAGE_UNHANDLED(handled = false)
25 IPC_END_MESSAGE_MAP()
26 return handled;
27 }
28
29 void FontCacheHandler::OnBuildFontCache(const base::FilePath& full_path) {
30 DCHECK(!cache_thread_);
31
32 utility_task_runner_ = base::MessageLoop::current()->task_runner();
33
34 // Create worker thread for building font cache.
35 cache_thread_.reset(new base::Thread("font_cache_thread"));
36 if (!cache_thread_->Start()) {
37 NOTREACHED();
38 return;
39 }
40 cache_thread_->message_loop()->PostTask(
41 FROM_HERE, base::Bind(&FontCacheHandler::StartBuildingFontCache,
42 base::Unretained(this),
43 full_path));
44 }
45
46 void FontCacheHandler::StartBuildingFontCache(const base::FilePath& full_path) {
47 content::BuildFontCache(full_path);
48 utility_task_runner_->PostTask(FROM_HERE,
49 base::Bind(&FontCacheHandler::Cleanup,
50 base::Unretained(this)));
51 }
52
53 void FontCacheHandler::Cleanup() {
54 cache_thread_.reset();
55 content::UtilityThread::Get()->ReleaseProcessIfNeeded();
56 }
OLDNEW
« no previous file with comments | « chrome/utility/font_cache_handler_win.h ('k') | content/child/font_warmup_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698