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

Unified Diff: content/common/sandbox_win.cc

Issue 209163002: Support DirectWrite with sandbox on (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: roll out blink bits 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/common/sandbox_win.h ('k') | content/renderer/renderer_main_platform_delegate_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/sandbox_win.cc
diff --git a/content/common/sandbox_win.cc b/content/common/sandbox_win.cc
index aea586054e51329e97627abc203ac3cfdb7f2b06..f8ce64292ff28e1a9bbaa166b5433a9036b68ca4 100644
--- a/content/common/sandbox_win.cc
+++ b/content/common/sandbox_win.cc
@@ -571,6 +571,16 @@ bool InitTargetServices(sandbox::TargetServices* target_services) {
return sandbox::SBOX_ALL_OK == result;
}
+bool ShouldUseDirectWrite() {
+ // If the flag is currently on, and we're on Win7 or above, we enable
+ // DirectWrite. Skia does not require the additions to DirectWrite
+ // in QFE 2670838, so a Win7 check is sufficient. We don't not currently
+ // attempt to support Vista, where SP2 and the Platform Update are required.
+ const CommandLine& command_line = *CommandLine::ForCurrentProcess();
+ return command_line.HasSwitch(switches::kEnableDirectWrite) &&
+ base::win::GetVersion() >= base::win::VERSION_WIN7;
+}
+
base::ProcessHandle StartSandboxedProcess(
SandboxedProcessLauncherDelegate* delegate,
CommandLine* cmd_line) {
@@ -637,7 +647,19 @@ base::ProcessHandle StartSandboxedProcess(
if (!disable_default_policy && !AddPolicyForSandboxedProcess(policy))
return 0;
- if (type_str != switches::kRendererProcess) {
+ if (type_str == switches::kRendererProcess) {
+ if (ShouldUseDirectWrite()) {
+ AddDirectory(base::DIR_WINDOWS_FONTS,
+ NULL,
+ true,
+ sandbox::TargetPolicy::FILES_ALLOW_READONLY,
+ policy);
+ // We do not automatically propagate this from the browser command line,
+ // and instead only add it when we're actually setting up the sandbox to
+ // work with DirectWrite.
+ cmd_line->AppendSwitch(switches::kEnableDirectWrite);
+ }
+ } else {
// Hack for Google Desktop crash. Trick GD into not injecting its DLL into
// this subprocess. See
// http://code.google.com/p/chromium/issues/detail?id=25580
« no previous file with comments | « content/common/sandbox_win.h ('k') | content/renderer/renderer_main_platform_delegate_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698