Index: content/common/sandbox_win.cc |
diff --git a/content/common/sandbox_win.cc b/content/common/sandbox_win.cc |
index 18b30e2963cd5afc568bc839868238037fd4146b..0a37f6112bfebd8f99618f9ca1146878d04889db 100644 |
--- a/content/common/sandbox_win.cc |
+++ b/content/common/sandbox_win.cc |
@@ -12,6 +12,7 @@ |
#include "base/debug/trace_event.h" |
#include "base/file_util.h" |
#include "base/hash.h" |
+#include "base/metrics/field_trial.h" |
#include "base/path_service.h" |
#include "base/process/launch.h" |
#include "base/strings/string_util.h" |
@@ -28,6 +29,7 @@ |
#include "sandbox/win/src/sandbox.h" |
#include "sandbox/win/src/sandbox_nt_util.h" |
#include "sandbox/win/src/win_utils.h" |
+#include "ui/gfx/win/dpi.h" |
static sandbox::BrokerServices* g_broker_services = NULL; |
static sandbox::TargetServices* g_target_services = NULL; |
@@ -566,9 +568,24 @@ bool ShouldUseDirectWrite() { |
// DirectWrite. Skia does not require the additions to DirectWrite in QFE |
// 2670838, so a Win7 check is sufficient. We do not currently attempt to |
// support Vista, where SP2 and the Platform Update are required. |
+ if (base::win::GetVersion() < base::win::VERSION_WIN7) |
+ return false; |
+ |
+ // If forced off, don't use it. |
const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
- return !command_line.HasSwitch(switches::kDisableDirectWrite) && |
- base::win::GetVersion() >= base::win::VERSION_WIN7; |
+ if (command_line.HasSwitch(switches::kDisableDirectWrite)) |
+ return false; |
+ |
+#if !defined(NACL_WIN64) |
+ // Can't use GDI on HiDPI. |
+ if (gfx::GetDPIScale() > 1.0f) |
+ return true; |
+#endif |
+ |
+ // Otherwise, check the field trial. |
+ const std::string group_name = |
+ base::FieldTrialList::FindFullName("DirectWrite"); |
+ return group_name != "Disabled"; |
} |
base::ProcessHandle StartSandboxedProcess( |