Commit c0a46334 authored by scottmg@chromium.org's avatar scottmg@chromium.org

Add trial for DirectWrite, and reorder some initialization so it can take effect

You can set --force-fieldtrials="DirectWrite/Disabled/" to turn DirectWrite off.

R=cpu@chromium.org, jamesr@chromium.org, asvitkine@chromium.org
BUG=385778

Review URL: https://codereview.chromium.org/335223003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@278238 0039d316-1c4b-4281-b951-d872f2087c98
parent e784fd32
......@@ -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(
......
......@@ -178,8 +178,6 @@ int RendererMain(const MainFunctionParams& parameters) {
base::PlatformThread::SetName("CrRendererMain");
platform.PlatformInitialize();
bool no_sandbox = parsed_command_line.HasSwitch(switches::kNoSandbox);
// Initialize histogram statistics gathering system.
......@@ -200,6 +198,9 @@ int RendererMain(const MainFunctionParams& parameters) {
DCHECK(result);
}
// PlatformInitialize uses FieldTrials, so this must happen later.
platform.PlatformInitialize();
#if defined(ENABLE_PLUGINS)
// Load pepper plugins before engaging the sandbox.
PepperPluginRegistry::GetInstance();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment