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 "third_party/WebKit/public/web/WebRuntimeFeatures.h" | 21 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
22 #include "third_party/WebKit/public/web/win/WebFontRendering.h" | 22 #include "third_party/WebKit/public/web/win/WebFontRendering.h" |
23 #include "third_party/icu/source/i18n/unicode/timezone.h" | 23 #include "third_party/icu/source/i18n/unicode/timezone.h" |
24 #include "third_party/skia/include/ports/SkFontMgr.h" | 24 #include "third_party/skia/include/ports/SkFontMgr.h" |
25 #include "third_party/skia/include/ports/SkTypeface_win.h" | 25 #include "third_party/skia/include/ports/SkTypeface_win.h" |
26 #include "ui/gfx/hud_font.h" | |
27 #include "ui/gfx/win/direct_write.h" | 26 #include "ui/gfx/win/direct_write.h" |
28 #include "ui/gfx/win/dpi.h" | 27 #include "ui/gfx/win/dpi.h" |
29 | 28 |
30 #include <dwrite.h> | 29 #include <dwrite.h> |
31 | 30 |
32 namespace content { | 31 namespace content { |
33 namespace { | 32 namespace { |
34 | 33 |
35 // Windows-only skia sandbox support | 34 // Windows-only skia sandbox support |
36 // These are used for GDI-path rendering. | 35 // These are used for GDI-path rendering. |
(...skipping 11 matching lines...) Expand all Loading... |
48 if (render_thread_impl) { | 47 if (render_thread_impl) { |
49 render_thread_impl->PreCacheFontCharacters( | 48 render_thread_impl->PreCacheFontCharacters( |
50 logfont, | 49 logfont, |
51 base::string16(text, text_length)); | 50 base::string16(text, text_length)); |
52 } | 51 } |
53 } | 52 } |
54 | 53 |
55 void WarmupDirectWrite() { | 54 void WarmupDirectWrite() { |
56 // The objects used here are intentionally not freed as we want the Skia | 55 // The objects used here are intentionally not freed as we want the Skia |
57 // code to use these objects after warmup. | 56 // code to use these objects after warmup. |
58 SetDefaultSkiaFactory(GetPreSandboxWarmupFontMgr()); | |
59 SkTypeface* typeface = | 57 SkTypeface* typeface = |
60 GetPreSandboxWarmupFontMgr()->legacyCreateTypeface("Times New Roman", 0); | 58 GetPreSandboxWarmupFontMgr()->legacyCreateTypeface("Times New Roman", 0); |
61 DoPreSandboxWarmupForTypeface(typeface); | 59 DoPreSandboxWarmupForTypeface(typeface); |
62 | 60 SetDefaultSkiaFactory(GetPreSandboxWarmupFontMgr()); |
63 // The CC HUD needs a debug font, we warm that up here and pass it down. | |
64 skia::RefPtr<SkTypeface> hud_typeface = | |
65 skia::AdoptRef(GetPreSandboxWarmupFontMgr()->legacyCreateTypeface( | |
66 "Consolas", SkTypeface::kBold)); | |
67 DoPreSandboxWarmupForTypeface(hud_typeface.get()); | |
68 ui::SetHudTypeface(hud_typeface); | |
69 } | 61 } |
70 | 62 |
71 } // namespace | 63 } // namespace |
72 | 64 |
73 RendererMainPlatformDelegate::RendererMainPlatformDelegate( | 65 RendererMainPlatformDelegate::RendererMainPlatformDelegate( |
74 const MainFunctionParams& parameters) | 66 const MainFunctionParams& parameters) |
75 : parameters_(parameters), | 67 : parameters_(parameters), |
76 sandbox_test_module_(NULL) { | 68 sandbox_test_module_(NULL) { |
77 } | 69 } |
78 | 70 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 return false; | 120 return false; |
129 #endif | 121 #endif |
130 | 122 |
131 target_services->LowerToken(); | 123 target_services->LowerToken(); |
132 return true; | 124 return true; |
133 } | 125 } |
134 return false; | 126 return false; |
135 } | 127 } |
136 | 128 |
137 } // namespace content | 129 } // namespace content |
OLD | NEW |