| 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/font_warmup_win.h" | 14 #include "content/common/font_warmup_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_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" | |
| 21 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" | 20 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
| 22 #include "third_party/WebKit/public/web/win/WebFontRendering.h" | 21 #include "third_party/WebKit/public/web/win/WebFontRendering.h" |
| 23 #include "third_party/icu/source/i18n/unicode/timezone.h" | 22 #include "third_party/icu/source/i18n/unicode/timezone.h" |
| 24 #include "third_party/skia/include/ports/SkFontMgr.h" | |
| 25 #include "third_party/skia/include/ports/SkTypeface_win.h" | 23 #include "third_party/skia/include/ports/SkTypeface_win.h" |
| 26 #include "ui/gfx/hud_font.h" | |
| 27 #include "ui/gfx/win/direct_write.h" | 24 #include "ui/gfx/win/direct_write.h" |
| 28 #include "ui/gfx/win/dpi.h" | 25 #include "ui/gfx/win/dpi.h" |
| 29 | 26 |
| 30 #include <dwrite.h> | 27 #include <dwrite.h> |
| 31 | 28 |
| 32 namespace content { | 29 namespace content { |
| 33 namespace { | 30 namespace { |
| 34 | 31 |
| 35 // Windows-only skia sandbox support | 32 // Windows-only skia sandbox support |
| 36 // These are used for GDI-path rendering. | 33 // These are used for GDI-path rendering. |
| 37 void SkiaPreCacheFont(const LOGFONT& logfont) { | 34 void SkiaPreCacheFont(const LOGFONT& logfont) { |
| 38 RenderThread* render_thread = RenderThread::Get(); | 35 RenderThread* render_thread = RenderThread::Get(); |
| 39 if (render_thread) { | 36 if (render_thread) { |
| 40 render_thread->PreCacheFont(logfont); | 37 render_thread->PreCacheFont(logfont); |
| 41 } | 38 } |
| 42 } | 39 } |
| 43 | 40 |
| 44 void WarmupDirectWrite() { | |
| 45 // The objects used here are intentionally not freed as we want the Skia | |
| 46 // code to use these objects after warmup. | |
| 47 SetDefaultSkiaFactory(GetPreSandboxWarmupFontMgr()); | |
| 48 | |
| 49 // We need to warm up *some* font for DirectWrite. We also need to pass one | |
| 50 // down for the CC HUD code, so use the same one here. Note that we don't use | |
| 51 // a monospace as would be nice in an attempt to avoid a small startup time | |
| 52 // regression, see http://crbug.com/463613. | |
| 53 skia::RefPtr<SkTypeface> hud_typeface = skia::AdoptRef( | |
| 54 GetPreSandboxWarmupFontMgr()->legacyCreateTypeface("Times New Roman", 0)); | |
| 55 DoPreSandboxWarmupForTypeface(hud_typeface.get()); | |
| 56 gfx::SetHudTypeface(hud_typeface); | |
| 57 } | |
| 58 | |
| 59 } // namespace | 41 } // namespace |
| 60 | 42 |
| 61 RendererMainPlatformDelegate::RendererMainPlatformDelegate( | 43 RendererMainPlatformDelegate::RendererMainPlatformDelegate( |
| 62 const MainFunctionParams& parameters) | 44 const MainFunctionParams& parameters) |
| 63 : parameters_(parameters), | 45 : parameters_(parameters), |
| 64 sandbox_test_module_(NULL) { | 46 sandbox_test_module_(NULL) { |
| 65 } | 47 } |
| 66 | 48 |
| 67 RendererMainPlatformDelegate::~RendererMainPlatformDelegate() { | 49 RendererMainPlatformDelegate::~RendererMainPlatformDelegate() { |
| 68 } | 50 } |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 ::GetUserDefaultLangID(); | 91 ::GetUserDefaultLangID(); |
| 110 ::GetUserDefaultLCID(); | 92 ::GetUserDefaultLCID(); |
| 111 | 93 |
| 112 target_services->LowerToken(); | 94 target_services->LowerToken(); |
| 113 return true; | 95 return true; |
| 114 } | 96 } |
| 115 return false; | 97 return false; |
| 116 } | 98 } |
| 117 | 99 |
| 118 } // namespace content | 100 } // namespace content |
| OLD | NEW |