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

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: add todo 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
Index: content/common/sandbox_win.cc
diff --git a/content/common/sandbox_win.cc b/content/common/sandbox_win.cc
index aea586054e51329e97627abc203ac3cfdb7f2b06..9876571ebb2a3d6a1f87e75c3dbb77b851d9878e 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) {
@@ -642,6 +652,16 @@ base::ProcessHandle StartSandboxedProcess(
// this subprocess. See
// http://code.google.com/p/chromium/issues/detail?id=25580
cmd_line->AppendSwitchASCII("ignored", " --type=renderer ");
+ } else if (ShouldUseDirectWrite()) {
jam 2014/03/25 22:57:26 nit: it would be clearer to have if (type_str == r
scottmg 2014/03/25 23:38:18 Done.
+ 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);
}
sandbox::ResultCode result;

Powered by Google App Engine
This is Rietveld 408576698