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/win_util.h" | 11 #include "base/win/win_util.h" |
| 12 #include "content/common/fontmgr_proxy.h" |
12 #include "content/public/common/content_switches.h" | 13 #include "content/public/common/content_switches.h" |
13 #include "content/public/common/injection_test_win.h" | 14 #include "content/public/common/injection_test_win.h" |
14 #include "content/public/renderer/render_thread.h" | 15 #include "content/public/renderer/render_thread.h" |
15 #include "content/renderer/render_thread_impl.h" | 16 #include "content/renderer/render_thread_impl.h" |
16 #include "sandbox/win/src/sandbox.h" | 17 #include "sandbox/win/src/sandbox.h" |
| 18 #include "skia/ext/fontmgr_default_ipc.h" |
17 #include "skia/ext/vector_platform_device_emf_win.h" | 19 #include "skia/ext/vector_platform_device_emf_win.h" |
18 #include "third_party/icu/source/i18n/unicode/timezone.h" | 20 #include "third_party/icu/source/i18n/unicode/timezone.h" |
19 #include "third_party/skia/include/ports/SkTypeface_win.h" | 21 #include "third_party/skia/include/ports/SkTypeface_win.h" |
20 | 22 |
| 23 |
21 #ifdef ENABLE_VTUNE_JIT_INTERFACE | 24 #ifdef ENABLE_VTUNE_JIT_INTERFACE |
22 #include "v8/src/third_party/vtune/v8-vtune.h" | 25 #include "v8/src/third_party/vtune/v8-vtune.h" |
23 #endif | 26 #endif |
24 | 27 |
25 namespace content { | 28 namespace content { |
26 namespace { | 29 namespace { |
27 | 30 |
28 // Windows-only skia sandbox support | 31 // Windows-only skia sandbox support |
29 void SkiaPreCacheFont(const LOGFONT& logfont) { | 32 void SkiaPreCacheFont(const LOGFONT& logfont) { |
30 RenderThread* render_thread = RenderThread::Get(); | 33 RenderThread* render_thread = RenderThread::Get(); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 // ICU DateFormat class (used in base/time_format.cc) needs to get the | 91 // ICU DateFormat class (used in base/time_format.cc) needs to get the |
89 // Olson timezone ID by accessing the registry keys under | 92 // Olson timezone ID by accessing the registry keys under |
90 // HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones. | 93 // HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones. |
91 // After TimeZone::createDefault is called once here, the timezone ID is | 94 // After TimeZone::createDefault is called once here, the timezone ID is |
92 // cached and there's no more need to access the registry. If the sandbox | 95 // cached and there's no more need to access the registry. If the sandbox |
93 // is disabled, we don't have to make this dummy call. | 96 // is disabled, we don't have to make this dummy call. |
94 scoped_ptr<icu::TimeZone> zone(icu::TimeZone::createDefault()); | 97 scoped_ptr<icu::TimeZone> zone(icu::TimeZone::createDefault()); |
95 SkTypeface_SetEnsureLOGFONTAccessibleProc(SkiaPreCacheFont); | 98 SkTypeface_SetEnsureLOGFONTAccessibleProc(SkiaPreCacheFont); |
96 skia::SetSkiaEnsureTypefaceCharactersAccessible( | 99 skia::SetSkiaEnsureTypefaceCharactersAccessible( |
97 SkiaPreCacheFontCharacters); | 100 SkiaPreCacheFontCharacters); |
| 101 |
| 102 SkSetFontMgr(new SkFontMgr_Indirect(SkFontMgr_New_DirectWrite(), |
| 103 new FontMgrProxy())); |
98 } | 104 } |
99 } | 105 } |
100 | 106 |
101 void RendererMainPlatformDelegate::PlatformUninitialize() { | 107 void RendererMainPlatformDelegate::PlatformUninitialize() { |
102 } | 108 } |
103 | 109 |
104 bool RendererMainPlatformDelegate::InitSandboxTests(bool no_sandbox) { | 110 bool RendererMainPlatformDelegate::InitSandboxTests(bool no_sandbox) { |
105 const CommandLine& command_line = parameters_.command_line; | 111 const CommandLine& command_line = parameters_.command_line; |
106 | 112 |
107 DVLOG(1) << "Started renderer with " << command_line.GetCommandLineString(); | 113 DVLOG(1) << "Started renderer with " << command_line.GetCommandLineString(); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 if (run_security_tests) { | 156 if (run_security_tests) { |
151 int test_count = 0; | 157 int test_count = 0; |
152 DVLOG(1) << "Running renderer security tests"; | 158 DVLOG(1) << "Running renderer security tests"; |
153 BOOL result = run_security_tests(&test_count); | 159 BOOL result = run_security_tests(&test_count); |
154 CHECK(result) << "Test number " << test_count << " has failed."; | 160 CHECK(result) << "Test number " << test_count << " has failed."; |
155 } | 161 } |
156 } | 162 } |
157 } | 163 } |
158 | 164 |
159 } // namespace content | 165 } // namespace content |
OLD | NEW |