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

Unified Diff: content/common/sandbox_win.cc

Issue 335223003: Add trial for DirectWrite, and reorder some initialization so it can take effect (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: invert sense Created 6 years, 6 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 18b30e2963cd5afc568bc839868238037fd4146b..dd79cdcd12a02da4fb67b6c69cacf07bf31135d3 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,22 @@ 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))
Alexei Svitkine (slow) 2014/06/17 21:30:29 Do you want to see data from users who've manually
scottmg 2014/06/17 22:07:00 Thanks, I think we don't care too much as there's
+ return false;
+
+ // Can't use GDI on HiDPI.
+ if (gfx::GetDPIScale() > 1.0f)
+ return true;
+
+ // Otherwise, Finch.
+ const std::string group_name =
+ base::FieldTrialList::FindFullName("DirectWrite");
+ return group_name != "Disabled";
Alexei Svitkine (slow) 2014/06/17 21:30:29 Instead of checking for != "Disabled", check for "
Alexei Svitkine (slow) 2014/06/17 22:02:15 Sorry, I just read your experiment description and
scottmg 2014/06/17 22:07:00 Done.
scottmg 2014/06/17 22:07:00 Yeah, ok thanks. Seems like it'd work either way,
}
base::ProcessHandle StartSandboxedProcess(

Powered by Google App Engine
This is Rietveld 408576698