| 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" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 // Windows-only skia sandbox support | 35 // Windows-only skia sandbox support |
| 36 // These are used for GDI-path rendering. | 36 // These are used for GDI-path rendering. |
| 37 void SkiaPreCacheFont(const LOGFONT& logfont) { | 37 void SkiaPreCacheFont(const LOGFONT& logfont) { |
| 38 RenderThread* render_thread = RenderThread::Get(); | 38 RenderThread* render_thread = RenderThread::Get(); |
| 39 if (render_thread) { | 39 if (render_thread) { |
| 40 render_thread->PreCacheFont(logfont); | 40 render_thread->PreCacheFont(logfont); |
| 41 } | 41 } |
| 42 } | 42 } |
| 43 | 43 |
| 44 void WarmupDirectWrite() { | 44 void WarmupDirectWrite() { |
| 45 InitializeDirectWrite(); |
| 46 } |
| 47 |
| 48 void CreateDirectWriteGlobalFactory() { |
| 45 // The objects used here are intentionally not freed as we want the Skia | 49 // The objects used here are intentionally not freed as we want the Skia |
| 46 // code to use these objects after warmup. | 50 // code to use these objects after warmup. |
| 47 SetDefaultSkiaFactory(GetPreSandboxWarmupFontMgr()); | 51 SetDefaultSkiaFactory(GetPreSandboxWarmupFontMgr()); |
| 48 | 52 |
| 53 #if 0 |
| 49 // We need to warm up *some* font for DirectWrite. We also need to pass one | 54 // 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 | 55 // 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 | 56 // a monospace as would be nice in an attempt to avoid a small startup time |
| 52 // regression, see http://crbug.com/463613. | 57 // regression, see http://crbug.com/463613. |
| 53 skia::RefPtr<SkTypeface> hud_typeface = skia::AdoptRef( | 58 skia::RefPtr<SkTypeface> hud_typeface = skia::AdoptRef( |
| 54 GetPreSandboxWarmupFontMgr()->legacyCreateTypeface("Times New Roman", 0)); | 59 GetPreSandboxWarmupFontMgr()->legacyCreateTypeface("Times New Roman", 0)); |
| 55 DoPreSandboxWarmupForTypeface(hud_typeface.get()); | 60 DoPreSandboxWarmupForTypeface(hud_typeface.get()); |
| 56 gfx::SetHudTypeface(hud_typeface); | 61 gfx::SetHudTypeface(hud_typeface); |
| 62 #endif |
| 57 } | 63 } |
| 58 | 64 |
| 59 } // namespace | 65 } // namespace |
| 60 | 66 |
| 61 RendererMainPlatformDelegate::RendererMainPlatformDelegate( | 67 RendererMainPlatformDelegate::RendererMainPlatformDelegate( |
| 62 const MainFunctionParams& parameters) | 68 const MainFunctionParams& parameters) |
| 63 : parameters_(parameters), | 69 : parameters_(parameters), |
| 64 sandbox_test_module_(NULL) { | 70 sandbox_test_module_(NULL) { |
| 65 } | 71 } |
| 66 | 72 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 parameters_.sandbox_info->target_services; | 108 parameters_.sandbox_info->target_services; |
| 103 | 109 |
| 104 if (target_services) { | 110 if (target_services) { |
| 105 // Cause advapi32 to load before the sandbox is turned on. | 111 // Cause advapi32 to load before the sandbox is turned on. |
| 106 unsigned int dummy_rand; | 112 unsigned int dummy_rand; |
| 107 rand_s(&dummy_rand); | 113 rand_s(&dummy_rand); |
| 108 // Warm up language subsystems before the sandbox is turned on. | 114 // Warm up language subsystems before the sandbox is turned on. |
| 109 ::GetUserDefaultLangID(); | 115 ::GetUserDefaultLangID(); |
| 110 ::GetUserDefaultLCID(); | 116 ::GetUserDefaultLCID(); |
| 111 | 117 |
| 112 target_services->LowerToken(); | 118 // target_services->LowerToken(); |
| 119 |
| 120 if (gfx::win::ShouldUseDirectWrite()) |
| 121 CreateDirectWriteGlobalFactory(); |
| 113 return true; | 122 return true; |
| 114 } | 123 } |
| 115 return false; | 124 return false; |
| 116 } | 125 } |
| 117 | 126 |
| 118 } // namespace content | 127 } // namespace content |
| OLD | NEW |