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

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

Issue 212953007: Control DirectWrite from browser side, no RuntimeEnabledFeature any more. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix no-sandbox 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
« no previous file with comments | « content/common/sandbox_win.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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/sandbox_win.h" 14 #include "content/common/sandbox_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/vector_platform_device_emf_win.h" 20 #include "skia/ext/vector_platform_device_emf_win.h"
21 #include "third_party/WebKit/public/web/win/WebFontRendering.h"
21 #include "third_party/icu/source/i18n/unicode/timezone.h" 22 #include "third_party/icu/source/i18n/unicode/timezone.h"
22 #include "third_party/skia/include/ports/SkTypeface_win.h" 23 #include "third_party/skia/include/ports/SkTypeface_win.h"
23 24
24 #ifdef ENABLE_VTUNE_JIT_INTERFACE 25 #ifdef ENABLE_VTUNE_JIT_INTERFACE
25 #include "v8/src/third_party/vtune/v8-vtune.h" 26 #include "v8/src/third_party/vtune/v8-vtune.h"
26 #endif 27 #endif
27 28
28 #include <dwrite.h> 29 #include <dwrite.h>
29 30
30 namespace content { 31 namespace content {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 112
112 #ifdef ENABLE_VTUNE_JIT_INTERFACE 113 #ifdef ENABLE_VTUNE_JIT_INTERFACE
113 if (command_line.HasSwitch(switches::kEnableVtune)) 114 if (command_line.HasSwitch(switches::kEnableVtune))
114 vTune::InitializeVtuneForV8(); 115 vTune::InitializeVtuneForV8();
115 #endif 116 #endif
116 117
117 // Be mindful of what resources you acquire here. They can be used by 118 // Be mindful of what resources you acquire here. They can be used by
118 // malicious code if the renderer gets compromised. 119 // malicious code if the renderer gets compromised.
119 bool no_sandbox = command_line.HasSwitch(switches::kNoSandbox); 120 bool no_sandbox = command_line.HasSwitch(switches::kNoSandbox);
120 121
122 bool use_direct_write = ShouldUseDirectWrite();
121 if (!no_sandbox) { 123 if (!no_sandbox) {
122 // ICU DateFormat class (used in base/time_format.cc) needs to get the 124 // ICU DateFormat class (used in base/time_format.cc) needs to get the
123 // Olson timezone ID by accessing the registry keys under 125 // Olson timezone ID by accessing the registry keys under
124 // HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones. 126 // HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones.
125 // After TimeZone::createDefault is called once here, the timezone ID is 127 // After TimeZone::createDefault is called once here, the timezone ID is
126 // cached and there's no more need to access the registry. If the sandbox 128 // cached and there's no more need to access the registry. If the sandbox
127 // is disabled, we don't have to make this dummy call. 129 // is disabled, we don't have to make this dummy call.
128 scoped_ptr<icu::TimeZone> zone(icu::TimeZone::createDefault()); 130 scoped_ptr<icu::TimeZone> zone(icu::TimeZone::createDefault());
129 131
130 if (ShouldUseDirectWrite()) { 132 if (use_direct_write) {
131 WarmupDirectWrite(); 133 WarmupDirectWrite();
132 } else { 134 } else {
133 SkTypeface_SetEnsureLOGFONTAccessibleProc(SkiaPreCacheFont); 135 SkTypeface_SetEnsureLOGFONTAccessibleProc(SkiaPreCacheFont);
134 skia::SetSkiaEnsureTypefaceCharactersAccessible( 136 skia::SetSkiaEnsureTypefaceCharactersAccessible(
135 SkiaPreCacheFontCharacters); 137 SkiaPreCacheFontCharacters);
136 } 138 }
137 } 139 }
140 blink::WebFontRendering::setUseDirectWrite(use_direct_write);
141 blink::WebFontRendering::setUseSubpixelPositioning(use_direct_write);
138 } 142 }
139 143
140 void RendererMainPlatformDelegate::PlatformUninitialize() { 144 void RendererMainPlatformDelegate::PlatformUninitialize() {
141 } 145 }
142 146
143 bool RendererMainPlatformDelegate::InitSandboxTests(bool no_sandbox) { 147 bool RendererMainPlatformDelegate::InitSandboxTests(bool no_sandbox) {
144 const CommandLine& command_line = parameters_.command_line; 148 const CommandLine& command_line = parameters_.command_line;
145 149
146 DVLOG(1) << "Started renderer with " << command_line.GetCommandLineString(); 150 DVLOG(1) << "Started renderer with " << command_line.GetCommandLineString();
147 151
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 if (run_security_tests) { 193 if (run_security_tests) {
190 int test_count = 0; 194 int test_count = 0;
191 DVLOG(1) << "Running renderer security tests"; 195 DVLOG(1) << "Running renderer security tests";
192 BOOL result = run_security_tests(&test_count); 196 BOOL result = run_security_tests(&test_count);
193 CHECK(result) << "Test number " << test_count << " has failed."; 197 CHECK(result) << "Test number " << test_count << " has failed.";
194 } 198 }
195 } 199 }
196 } 200 }
197 201
198 } // namespace content 202 } // namespace content
OLDNEW
« no previous file with comments | « content/common/sandbox_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698