OLD | NEW |
---|---|
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 Loading... | |
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 1102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1149 return false; | 1148 return false; |
1150 } | 1149 } |
1151 | 1150 |
1152 DCHECK(!g_shared_font_cache.IsValid()); | 1151 DCHECK(!g_shared_font_cache.IsValid()); |
1153 g_shared_font_cache.Set(mapping); | 1152 g_shared_font_cache.Set(mapping); |
1154 | 1153 |
1155 return true; | 1154 return true; |
1156 } | 1155 } |
1157 | 1156 |
1158 // Assumption for this function is that it will get called through a posted task | 1157 // Assumption for this function is that it will get called through a posted task |
1159 // on FILE thread. | 1158 // on FILE thread. |
scottmg
2014/11/13 07:35:30
not sure how important it is, but maybe
DCHECK(Br
Shrikant Kelkar
2014/11/13 20:29:21
Removed comment, didn't add DCHECK as all base::Fi
| |
1160 bool BuildAndLoadFontCache(const base::FilePath& file) { | 1159 bool BuildFontCache(const base::FilePath& file) { |
1161 if (BuildFontCacheInternal(file.value().c_str())) | 1160 return BuildFontCacheInternal(file.value().c_str()); |
1162 return LoadFontCache(file); | |
1163 return false; | |
1164 } | 1161 } |
1165 | 1162 |
1166 } // namespace content | 1163 } // namespace content |
OLD | NEW |