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/common/sandbox_win.h" | 14 #include "content/common/sandbox_win.h" |
15 #include "content/public/common/content_switches.h" | 15 #include "content/public/common/content_switches.h" |
16 #include "content/public/common/injection_test_win.h" | 16 #include "content/public/common/injection_test_win.h" |
17 #include "content/public/renderer/render_font_warmup_win.h" | 17 #include "content/public/renderer/render_font_warmup_win.h" |
18 #include "content/public/renderer/render_thread.h" | 18 #include "content/public/renderer/render_thread.h" |
19 #include "content/renderer/render_thread_impl.h" | 19 #include "content/renderer/render_thread_impl.h" |
20 #include "sandbox/win/src/sandbox.h" | 20 #include "sandbox/win/src/sandbox.h" |
21 #include "skia/ext/fontmgr_default_win.h" | 21 #include "skia/ext/fontmgr_default_win.h" |
22 #include "skia/ext/vector_platform_device_emf_win.h" | 22 #include "skia/ext/vector_platform_device_emf_win.h" |
23 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" | 23 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
24 #include "third_party/WebKit/public/web/win/WebFontRendering.h" | 24 #include "third_party/WebKit/public/web/win/WebFontRendering.h" |
25 #include "third_party/icu/source/i18n/unicode/timezone.h" | 25 #include "third_party/icu/source/i18n/unicode/timezone.h" |
26 #include "third_party/skia/include/ports/SkFontMgr.h" | 26 #include "third_party/skia/include/ports/SkFontMgr.h" |
27 #include "third_party/skia/include/ports/SkTypeface_win.h" | 27 #include "third_party/skia/include/ports/SkTypeface_win.h" |
| 28 #include "ui/gfx/win/dpi.h" |
28 | 29 |
29 #ifdef ENABLE_VTUNE_JIT_INTERFACE | 30 #ifdef ENABLE_VTUNE_JIT_INTERFACE |
30 #include "v8/src/third_party/vtune/v8-vtune.h" | 31 #include "v8/src/third_party/vtune/v8-vtune.h" |
31 #endif | 32 #endif |
32 | 33 |
33 #include <dwrite.h> | 34 #include <dwrite.h> |
34 | 35 |
35 namespace content { | 36 namespace content { |
36 namespace { | 37 namespace { |
37 | 38 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 | 100 |
100 if (use_direct_write) { | 101 if (use_direct_write) { |
101 WarmupDirectWrite(); | 102 WarmupDirectWrite(); |
102 } else { | 103 } else { |
103 SkTypeface_SetEnsureLOGFONTAccessibleProc(SkiaPreCacheFont); | 104 SkTypeface_SetEnsureLOGFONTAccessibleProc(SkiaPreCacheFont); |
104 skia::SetSkiaEnsureTypefaceCharactersAccessible( | 105 skia::SetSkiaEnsureTypefaceCharactersAccessible( |
105 SkiaPreCacheFontCharacters); | 106 SkiaPreCacheFontCharacters); |
106 } | 107 } |
107 } | 108 } |
108 blink::WebFontRendering::setUseDirectWrite(use_direct_write); | 109 blink::WebFontRendering::setUseDirectWrite(use_direct_write); |
| 110 blink::WebFontRendering::setDeviceScaleFactor(gfx::GetDPIScale()); |
109 if (use_direct_write) { | 111 if (use_direct_write) { |
110 blink::WebRuntimeFeatures::enableSubpixelFontScaling(true); | 112 blink::WebRuntimeFeatures::enableSubpixelFontScaling(true); |
111 } | 113 } |
112 } | 114 } |
113 | 115 |
114 void RendererMainPlatformDelegate::PlatformUninitialize() { | 116 void RendererMainPlatformDelegate::PlatformUninitialize() { |
115 } | 117 } |
116 | 118 |
117 bool RendererMainPlatformDelegate::EnableSandbox() { | 119 bool RendererMainPlatformDelegate::EnableSandbox() { |
118 sandbox::TargetServices* target_services = | 120 sandbox::TargetServices* target_services = |
119 parameters_.sandbox_info->target_services; | 121 parameters_.sandbox_info->target_services; |
120 | 122 |
121 if (target_services) { | 123 if (target_services) { |
122 // Cause advapi32 to load before the sandbox is turned on. | 124 // Cause advapi32 to load before the sandbox is turned on. |
123 unsigned int dummy_rand; | 125 unsigned int dummy_rand; |
124 rand_s(&dummy_rand); | 126 rand_s(&dummy_rand); |
125 // Warm up language subsystems before the sandbox is turned on. | 127 // Warm up language subsystems before the sandbox is turned on. |
126 ::GetUserDefaultLangID(); | 128 ::GetUserDefaultLangID(); |
127 ::GetUserDefaultLCID(); | 129 ::GetUserDefaultLCID(); |
128 | 130 |
129 target_services->LowerToken(); | 131 target_services->LowerToken(); |
130 return true; | 132 return true; |
131 } | 133 } |
132 return false; | 134 return false; |
133 } | 135 } |
134 | 136 |
135 } // namespace content | 137 } // namespace content |
OLD | NEW |