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 = |
danakj
2015/02/05 22:56:47
bonus points for doing the AdoptRef here, though.
scottmg
2015/02/05 23:21:57
This one has to leak for the sandbox, so I'd have
danakj
2015/02/05 23:24:11
Then I'm concerned about below. You adopt-ref it t
| |
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 typeface = GetPreSandboxWarmupFontMgr()->legacyCreateTypeface( | |
66 "Consolas", SkTypeface::kBold); | |
67 DoPreSandboxWarmupForTypeface(typeface); | |
68 ui::SetHudTypeface(skia::AdoptRef(typeface)); | |
62 } | 69 } |
63 | 70 |
64 } // namespace | 71 } // namespace |
65 | 72 |
66 RendererMainPlatformDelegate::RendererMainPlatformDelegate( | 73 RendererMainPlatformDelegate::RendererMainPlatformDelegate( |
67 const MainFunctionParams& parameters) | 74 const MainFunctionParams& parameters) |
68 : parameters_(parameters), | 75 : parameters_(parameters), |
69 sandbox_test_module_(NULL) { | 76 sandbox_test_module_(NULL) { |
70 } | 77 } |
71 | 78 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
116 ::GetUserDefaultLangID(); | 123 ::GetUserDefaultLangID(); |
117 ::GetUserDefaultLCID(); | 124 ::GetUserDefaultLCID(); |
118 | 125 |
119 target_services->LowerToken(); | 126 target_services->LowerToken(); |
120 return true; | 127 return true; |
121 } | 128 } |
122 return false; | 129 return false; |
123 } | 130 } |
124 | 131 |
125 } // namespace content | 132 } // namespace content |
OLD | NEW |