OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/renderer/renderer_main_platform_delegate.h" | 5 #include "content/renderer/renderer_main_platform_delegate.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
11 #include "base/win/scoped_comptr.h" | 11 #include "base/win/scoped_comptr.h" |
12 #include "base/win/win_util.h" | 12 #include "base/win/win_util.h" |
13 #include "base/win/windows_version.h" | 13 #include "base/win/windows_version.h" |
14 #include "content/public/common/content_switches.h" | 14 #include "content/public/common/content_switches.h" |
15 #include "content/public/common/injection_test_win.h" | 15 #include "content/public/common/injection_test_win.h" |
16 #include "content/public/renderer/render_font_warmup_win.h" | 16 #include "content/public/renderer/render_font_warmup_win.h" |
17 #include "content/public/renderer/render_thread.h" | 17 #include "content/public/renderer/render_thread.h" |
18 #include "content/renderer/render_thread_impl.h" | 18 #include "content/renderer/render_thread_impl.h" |
19 #include "sandbox/win/src/sandbox.h" | 19 #include "sandbox/win/src/sandbox.h" |
20 #include "skia/ext/fontmgr_default_win.h" | 20 #include "skia/ext/fontmgr_default_win.h" |
21 #include "skia/ext/vector_platform_device_emf_win.h" | 21 #include "skia/ext/vector_platform_device_emf_win.h" |
22 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" | 22 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
23 #include "third_party/WebKit/public/web/win/WebFontRendering.h" | 23 #include "third_party/WebKit/public/web/win/WebFontRendering.h" |
24 #include "third_party/icu/source/i18n/unicode/timezone.h" | 24 #include "third_party/icu/source/i18n/unicode/timezone.h" |
25 #include "third_party/skia/include/ports/SkFontMgr.h" | 25 #include "third_party/skia/include/ports/SkFontMgr.h" |
26 #include "third_party/skia/include/ports/SkTypeface_win.h" | 26 #include "third_party/skia/include/ports/SkTypeface_win.h" |
27 #include "ui/gfx/hud_font.h" | |
27 #include "ui/gfx/win/direct_write.h" | 28 #include "ui/gfx/win/direct_write.h" |
28 #include "ui/gfx/win/dpi.h" | 29 #include "ui/gfx/win/dpi.h" |
29 | 30 |
30 #include <dwrite.h> | 31 #include <dwrite.h> |
31 | 32 |
32 namespace content { | 33 namespace content { |
33 namespace { | 34 namespace { |
34 | 35 |
35 // Windows-only skia sandbox support | 36 // Windows-only skia sandbox support |
36 // These are used for GDI-path rendering. | 37 // These are used for GDI-path rendering. |
(...skipping 11 matching lines...) Expand all Loading... | |
48 if (render_thread_impl) { | 49 if (render_thread_impl) { |
49 render_thread_impl->PreCacheFontCharacters( | 50 render_thread_impl->PreCacheFontCharacters( |
50 logfont, | 51 logfont, |
51 base::string16(text, text_length)); | 52 base::string16(text, text_length)); |
52 } | 53 } |
53 } | 54 } |
54 | 55 |
55 void WarmupDirectWrite() { | 56 void WarmupDirectWrite() { |
56 // The objects used here are intentionally not freed as we want the Skia | 57 // The objects used here are intentionally not freed as we want the Skia |
57 // code to use these objects after warmup. | 58 // code to use these objects after warmup. |
59 SetDefaultSkiaFactory(GetPreSandboxWarmupFontMgr()); | |
58 SkTypeface* typeface = | 60 SkTypeface* typeface = |
59 GetPreSandboxWarmupFontMgr()->legacyCreateTypeface("Times New Roman", 0); | 61 GetPreSandboxWarmupFontMgr()->legacyCreateTypeface("Times New Roman", 0); |
60 DoPreSandboxWarmupForTypeface(typeface); | 62 DoPreSandboxWarmupForTypeface(typeface); |
61 SetDefaultSkiaFactory(GetPreSandboxWarmupFontMgr()); | 63 |
64 // The CC HUD needs a debug font, we warm that up here and pass it down. | |
65 skia::RefPtr<SkTypeface> hud_typeface = | |
danakj
2015/02/05 23:49:47
OH! I failed to read that there were 2 different t
| |
66 skia::AdoptRef(GetPreSandboxWarmupFontMgr()->legacyCreateTypeface( | |
67 "Consolas", SkTypeface::kBold)); | |
68 DoPreSandboxWarmupForTypeface(hud_typeface.get()); | |
69 ui::SetHudTypeface(hud_typeface); | |
62 } | 70 } |
63 | 71 |
64 } // namespace | 72 } // namespace |
65 | 73 |
66 RendererMainPlatformDelegate::RendererMainPlatformDelegate( | 74 RendererMainPlatformDelegate::RendererMainPlatformDelegate( |
67 const MainFunctionParams& parameters) | 75 const MainFunctionParams& parameters) |
68 : parameters_(parameters), | 76 : parameters_(parameters), |
69 sandbox_test_module_(NULL) { | 77 sandbox_test_module_(NULL) { |
70 } | 78 } |
71 | 79 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
116 ::GetUserDefaultLangID(); | 124 ::GetUserDefaultLangID(); |
117 ::GetUserDefaultLCID(); | 125 ::GetUserDefaultLCID(); |
118 | 126 |
119 target_services->LowerToken(); | 127 target_services->LowerToken(); |
120 return true; | 128 return true; |
121 } | 129 } |
122 return false; | 130 return false; |
123 } | 131 } |
124 | 132 |
125 } // namespace content | 133 } // namespace content |
OLD | NEW |