| 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" | |
| 22 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" | 21 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
| 23 #include "third_party/WebKit/public/web/win/WebFontRendering.h" | 22 #include "third_party/WebKit/public/web/win/WebFontRendering.h" |
| 24 #include "third_party/icu/source/i18n/unicode/timezone.h" | 23 #include "third_party/icu/source/i18n/unicode/timezone.h" |
| 25 #include "third_party/skia/include/ports/SkFontMgr.h" | 24 #include "third_party/skia/include/ports/SkFontMgr.h" |
| 26 #include "third_party/skia/include/ports/SkTypeface_win.h" | 25 #include "third_party/skia/include/ports/SkTypeface_win.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 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 // HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones. | 85 // HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones. |
| 87 // After TimeZone::createDefault is called once here, the timezone ID is | 86 // After TimeZone::createDefault is called once here, the timezone ID is |
| 88 // cached and there's no more need to access the registry. If the sandbox | 87 // cached and there's no more need to access the registry. If the sandbox |
| 89 // is disabled, we don't have to make this dummy call. | 88 // is disabled, we don't have to make this dummy call. |
| 90 scoped_ptr<icu::TimeZone> zone(icu::TimeZone::createDefault()); | 89 scoped_ptr<icu::TimeZone> zone(icu::TimeZone::createDefault()); |
| 91 | 90 |
| 92 if (use_direct_write) { | 91 if (use_direct_write) { |
| 93 WarmupDirectWrite(); | 92 WarmupDirectWrite(); |
| 94 } else { | 93 } else { |
| 95 SkTypeface_SetEnsureLOGFONTAccessibleProc(SkiaPreCacheFont); | 94 SkTypeface_SetEnsureLOGFONTAccessibleProc(SkiaPreCacheFont); |
| 96 skia::SetSkiaEnsureTypefaceCharactersAccessible( | |
| 97 SkiaPreCacheFontCharacters); | |
| 98 } | 95 } |
| 99 } | 96 } |
| 100 blink::WebFontRendering::setUseDirectWrite(use_direct_write); | 97 blink::WebFontRendering::setUseDirectWrite(use_direct_write); |
| 101 blink::WebFontRendering::setDeviceScaleFactor(gfx::GetDPIScale()); | 98 blink::WebFontRendering::setDeviceScaleFactor(gfx::GetDPIScale()); |
| 102 } | 99 } |
| 103 | 100 |
| 104 void RendererMainPlatformDelegate::PlatformUninitialize() { | 101 void RendererMainPlatformDelegate::PlatformUninitialize() { |
| 105 } | 102 } |
| 106 | 103 |
| 107 bool RendererMainPlatformDelegate::EnableSandbox() { | 104 bool RendererMainPlatformDelegate::EnableSandbox() { |
| 108 sandbox::TargetServices* target_services = | 105 sandbox::TargetServices* target_services = |
| 109 parameters_.sandbox_info->target_services; | 106 parameters_.sandbox_info->target_services; |
| 110 | 107 |
| 111 if (target_services) { | 108 if (target_services) { |
| 112 // Cause advapi32 to load before the sandbox is turned on. | 109 // Cause advapi32 to load before the sandbox is turned on. |
| 113 unsigned int dummy_rand; | 110 unsigned int dummy_rand; |
| 114 rand_s(&dummy_rand); | 111 rand_s(&dummy_rand); |
| 115 // Warm up language subsystems before the sandbox is turned on. | 112 // Warm up language subsystems before the sandbox is turned on. |
| 116 ::GetUserDefaultLangID(); | 113 ::GetUserDefaultLangID(); |
| 117 ::GetUserDefaultLCID(); | 114 ::GetUserDefaultLCID(); |
| 118 | 115 |
| 119 target_services->LowerToken(); | 116 target_services->LowerToken(); |
| 120 return true; | 117 return true; |
| 121 } | 118 } |
| 122 return false; | 119 return false; |
| 123 } | 120 } |
| 124 | 121 |
| 125 } // namespace content | 122 } // namespace content |
| OLD | NEW |