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

Side by Side Diff: content/common/dwrite_font_platform_win.cc

Issue 724633002: DirectWrite Font Cache browser side hookup (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review.. Created 6 years, 1 month 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/common/dwrite_font_platform_win.h" 5 #include "content/public/common/dwrite_font_platform_win.h"
6 6
7 #include <dwrite.h> 7 #include <dwrite.h>
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
11 #include <vector> 11 #include <vector>
12 #include <wrl/implements.h> 12 #include <wrl/implements.h>
13 #include <wrl/wrappers/corewrappers.h> 13 #include <wrl/wrappers/corewrappers.h>
14 14
15 #include "base/command_line.h" 15 #include "base/command_line.h"
(...skipping 10 matching lines...) Expand all
26 #include "base/path_service.h" 26 #include "base/path_service.h"
27 #include "base/process/process_handle.h" 27 #include "base/process/process_handle.h"
28 #include "base/stl_util.h" 28 #include "base/stl_util.h"
29 #include "base/strings/string_number_conversions.h" 29 #include "base/strings/string_number_conversions.h"
30 #include "base/strings/utf_string_conversions.h" 30 #include "base/strings/utf_string_conversions.h"
31 #include "base/synchronization/lock.h" 31 #include "base/synchronization/lock.h"
32 #include "base/time/time.h" 32 #include "base/time/time.h"
33 #include "base/win/registry.h" 33 #include "base/win/registry.h"
34 #include "base/win/scoped_comptr.h" 34 #include "base/win/scoped_comptr.h"
35 #include "content/public/common/content_switches.h" 35 #include "content/public/common/content_switches.h"
36 #include "content/public/common/dwrite_font_cache_win.h"
37 36
38 namespace { 37 namespace {
39 38
40 // Font Cache implementation short story: 39 // Font Cache implementation short story:
41 // Due to our sandboxing restrictions, we cannot connect to Windows font cache 40 // Due to our sandboxing restrictions, we cannot connect to Windows font cache
42 // service from Renderer and need to use DirectWrite isolated font loading 41 // service from Renderer and need to use DirectWrite isolated font loading
43 // mechanism. 42 // mechanism.
44 // DirectWrite needs to be initialized before any of the API could be used. 43 // DirectWrite needs to be initialized before any of the API could be used.
45 // During initialization DirectWrite loads all font files and populates 44 // During initialization DirectWrite loads all font files and populates
46 // internal cache, we refer this phase as enumeration and we are trying 45 // internal cache, we refer this phase as enumeration and we are trying
(...skipping 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after
1166 CHECK(false); 1165 CHECK(false);
1167 return false; 1166 return false;
1168 } 1167 }
1169 1168
1170 DCHECK(!g_shared_font_cache.IsValid()); 1169 DCHECK(!g_shared_font_cache.IsValid());
1171 g_shared_font_cache.Set(mapping); 1170 g_shared_font_cache.Set(mapping);
1172 1171
1173 return true; 1172 return true;
1174 } 1173 }
1175 1174
1176 // Assumption for this function is that it will get called through a posted task 1175 bool BuildFontCache(const base::FilePath& file) {
1177 // on FILE thread. 1176 return BuildFontCacheInternal(file.value().c_str());
1178 bool BuildAndLoadFontCache(const base::FilePath& file) {
1179 if (BuildFontCacheInternal(file.value().c_str()))
1180 return LoadFontCache(file);
1181 return false;
1182 } 1177 }
1183 1178
1184 } // namespace content 1179 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698