Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Side by Side Diff: content/renderer/renderer_main_platform_delegate_win.cc

Issue 132113015: IPC interface for font management. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Match final interface and cleanup usage. Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/public/common/content_switches.h" 12 #include "content/public/common/content_switches.h"
13 #include "content/public/common/injection_test_win.h" 13 #include "content/public/common/injection_test_win.h"
14 #include "content/public/renderer/render_thread.h" 14 #include "content/public/renderer/render_thread.h"
15 #include "content/renderer/fontmgr_proxy.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_win.h"
19 #include "skia/ext/refptr.h"
17 #include "skia/ext/vector_platform_device_emf_win.h" 20 #include "skia/ext/vector_platform_device_emf_win.h"
18 #include "third_party/icu/source/i18n/unicode/timezone.h" 21 #include "third_party/icu/source/i18n/unicode/timezone.h"
22 #include "third_party/skia/include/ports/SkFontMgr_indirect.h"
23 #include "third_party/skia/include/ports/SkRemotableFontMgr.h"
19 #include "third_party/skia/include/ports/SkTypeface_win.h" 24 #include "third_party/skia/include/ports/SkTypeface_win.h"
20 25
26
21 #ifdef ENABLE_VTUNE_JIT_INTERFACE 27 #ifdef ENABLE_VTUNE_JIT_INTERFACE
22 #include "v8/src/third_party/vtune/v8-vtune.h" 28 #include "v8/src/third_party/vtune/v8-vtune.h"
23 #endif 29 #endif
24 30
25 namespace content { 31 namespace content {
26 namespace { 32 namespace {
27 33
28 // Windows-only skia sandbox support 34 // Windows-only skia sandbox support
29 void SkiaPreCacheFont(const LOGFONT& logfont) { 35 void SkiaPreCacheFont(const LOGFONT& logfont) {
30 RenderThread* render_thread = RenderThread::Get(); 36 RenderThread* render_thread = RenderThread::Get();
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 // ICU DateFormat class (used in base/time_format.cc) needs to get the 77 // ICU DateFormat class (used in base/time_format.cc) needs to get the
72 // Olson timezone ID by accessing the registry keys under 78 // Olson timezone ID by accessing the registry keys under
73 // HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones. 79 // HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones.
74 // After TimeZone::createDefault is called once here, the timezone ID is 80 // After TimeZone::createDefault is called once here, the timezone ID is
75 // cached and there's no more need to access the registry. If the sandbox 81 // cached and there's no more need to access the registry. If the sandbox
76 // is disabled, we don't have to make this dummy call. 82 // is disabled, we don't have to make this dummy call.
77 scoped_ptr<icu::TimeZone> zone(icu::TimeZone::createDefault()); 83 scoped_ptr<icu::TimeZone> zone(icu::TimeZone::createDefault());
78 SkTypeface_SetEnsureLOGFONTAccessibleProc(SkiaPreCacheFont); 84 SkTypeface_SetEnsureLOGFONTAccessibleProc(SkiaPreCacheFont);
79 skia::SetSkiaEnsureTypefaceCharactersAccessible( 85 skia::SetSkiaEnsureTypefaceCharactersAccessible(
80 SkiaPreCacheFontCharacters); 86 SkiaPreCacheFontCharacters);
87
88 skia::RefPtr<FontMgrProxy> proxy = skia::AdoptRef(new FontMgrProxy());
89 skia::RefPtr<SkFontMgr> dw_fontmgr =
90 skia::AdoptRef(SkFontMgr_New_DirectWriteRenderer(proxy.get()));
91 if (dw_fontmgr) {
92 SkSetFontMgr(dw_fontmgr.get());
93 }
81 } 94 }
82 } 95 }
83 96
84 void RendererMainPlatformDelegate::PlatformUninitialize() { 97 void RendererMainPlatformDelegate::PlatformUninitialize() {
85 } 98 }
86 99
87 bool RendererMainPlatformDelegate::InitSandboxTests(bool no_sandbox) { 100 bool RendererMainPlatformDelegate::InitSandboxTests(bool no_sandbox) {
88 const CommandLine& command_line = parameters_.command_line; 101 const CommandLine& command_line = parameters_.command_line;
89 102
90 DVLOG(1) << "Started renderer with " << command_line.GetCommandLineString(); 103 DVLOG(1) << "Started renderer with " << command_line.GetCommandLineString();
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 if (run_security_tests) { 146 if (run_security_tests) {
134 int test_count = 0; 147 int test_count = 0;
135 DVLOG(1) << "Running renderer security tests"; 148 DVLOG(1) << "Running renderer security tests";
136 BOOL result = run_security_tests(&test_count); 149 BOOL result = run_security_tests(&test_count);
137 CHECK(result) << "Test number " << test_count << " has failed."; 150 CHECK(result) << "Test number " << test_count << " has failed.";
138 } 151 }
139 } 152 }
140 } 153 }
141 154
142 } // namespace content 155 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698