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

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: comment 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
« no previous file with comments | « no previous file | content/renderer/renderer_main.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 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(
« no previous file with comments | « no previous file | content/renderer/renderer_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698