Commit b7c4f037 authored by vangelis@chromium.org's avatar vangelis@chromium.org

Cleaned up compositing mode field trial code by:

1. Move the code that checks whether FCM and/or ThreadedCompositing is enabled to a separate file (compositor_utils) that can be accessed from all the spots that need the info.
2. Cache results results for checks so that we don't have to check them every frame (string compares were actually showing up in profile results)
3. Some cosmetic changes to variable names to keep them consistent.
4. Re-arranged to code that decides what trials run in which channels.

This CL also enables FCM on beta/stable by default but keeps the previous 1/3 experiment running on the other channels.

BUG=


Review URL: https://chromiumcodereview.appspot.com/10824168

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@150359 0039d316-1c4b-4281-b951-d872f2087c98
parent 8677b19f
...@@ -120,7 +120,7 @@ void ChromeBrowserFieldTrials::SetupFieldTrials(bool proxy_policy_is_set) { ...@@ -120,7 +120,7 @@ void ChromeBrowserFieldTrials::SetupFieldTrials(bool proxy_policy_is_set) {
PredictorFieldTrial(); PredictorFieldTrial();
DefaultAppsFieldTrial(); DefaultAppsFieldTrial();
AutoLaunchChromeFieldTrial(); AutoLaunchChromeFieldTrial();
gpu_util::InitializeForceCompositingModeFieldTrial(); gpu_util::InitializeCompositingFieldTrial();
SetupUniformityFieldTrials(); SetupUniformityFieldTrials();
AutocompleteFieldTrial::Activate(); AutocompleteFieldTrial::Activate();
DisableNewTabFieldTrialIfNecesssary(); DisableNewTabFieldTrialIfNecesssary();
......
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
#include "chrome/browser/extensions/message_handler.h" #include "chrome/browser/extensions/message_handler.h"
#include "chrome/browser/geolocation/chrome_access_token_store.h" #include "chrome/browser/geolocation/chrome_access_token_store.h"
#include "chrome/browser/google/google_util.h" #include "chrome/browser/google/google_util.h"
#include "chrome/browser/gpu_util.h"
#include "chrome/browser/infobars/infobar_tab_helper.h" #include "chrome/browser/infobars/infobar_tab_helper.h"
#include "chrome/browser/media/media_internals.h" #include "chrome/browser/media/media_internals.h"
#include "chrome/browser/net/chrome_net_log.h" #include "chrome/browser/net/chrome_net_log.h"
...@@ -93,6 +92,7 @@ ...@@ -93,6 +92,7 @@
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_view.h" #include "content/public/browser/web_contents_view.h"
#include "content/public/common/child_process_host.h" #include "content/public/common/child_process_host.h"
#include "content/public/common/compositor_util.h"
#include "content/public/common/content_descriptors.h" #include "content/public/common/content_descriptors.h"
#include "grit/generated_resources.h" #include "grit/generated_resources.h"
#include "grit/ui_resources.h" #include "grit/ui_resources.h"
...@@ -1493,7 +1493,7 @@ void ChromeContentBrowserClient::OverrideWebkitPrefs( ...@@ -1493,7 +1493,7 @@ void ChromeContentBrowserClient::OverrideWebkitPrefs(
extension, view_type, web_prefs); extension, view_type, web_prefs);
} }
if (gpu_util::InForceCompositingModeOrThreadTrial()) if (content::IsForceCompositingModeEnabled())
web_prefs->force_compositing_mode = true; web_prefs->force_compositing_mode = true;
if (view_type == chrome::VIEW_TYPE_NOTIFICATION) { if (view_type == chrome::VIEW_TYPE_NOTIFICATION) {
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "chrome/browser/gpu_blacklist.h" #include "chrome/browser/gpu_blacklist.h"
#include "chrome/common/chrome_version_info.h" #include "chrome/common/chrome_version_info.h"
#include "content/public/browser/gpu_data_manager.h" #include "content/public/browser/gpu_data_manager.h"
#include "content/public/common/compositor_util.h"
#include "content/public/common/content_constants.h" #include "content/public/common/content_constants.h"
#include "content/public/common/content_switches.h" #include "content/public/common/content_switches.h"
#include "content/public/common/gpu_info.h" #include "content/public/common/gpu_info.h"
...@@ -169,27 +170,15 @@ int GetGpuBlacklistHistogramValueWin(GpuFeatureStatus status) { ...@@ -169,27 +170,15 @@ int GetGpuBlacklistHistogramValueWin(GpuFeatureStatus status) {
} }
#endif // OS_WIN #endif // OS_WIN
bool InForceThreadedCompositingModeTrial() {
base::FieldTrial* trial =
base::FieldTrialList::Find(content::kGpuCompositingFieldTrialName);
return trial && trial->group_name() ==
content::kGpuCompositingFieldTrialThreadEnabledName;
}
} // namespace } // namespace
namespace gpu_util { namespace gpu_util {
void InitializeForceCompositingModeFieldTrial() { void InitializeCompositingFieldTrial() {
// Enable the field trial only on desktop OS's. // Enable the field trial only on desktop OS's.
#if !(defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX)) #if !(defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX))
return; return;
#endif #endif
chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel();
// Only run the trial on the Canary and Dev channels.
if (channel != chrome::VersionInfo::CHANNEL_CANARY &&
channel != chrome::VersionInfo::CHANNEL_DEV)
return;
#if defined(OS_WIN) #if defined(OS_WIN)
// Don't run the trial on Windows XP. // Don't run the trial on Windows XP.
if (base::win::GetVersion() < base::win::VERSION_VISTA) if (base::win::GetVersion() < base::win::VERSION_VISTA)
...@@ -208,9 +197,7 @@ void InitializeForceCompositingModeFieldTrial() { ...@@ -208,9 +197,7 @@ void InitializeForceCompositingModeFieldTrial() {
// Don't activate the field trial if force-compositing-mode has been // Don't activate the field trial if force-compositing-mode has been
// explicitly disabled from the command line. // explicitly disabled from the command line.
if (CommandLine::ForCurrentProcess()->HasSwitch( if (CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableForceCompositingMode) || switches::kDisableForceCompositingMode))
CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableThreadedCompositing))
return; return;
const base::FieldTrial::Probability kDivisor = 3; const base::FieldTrial::Probability kDivisor = 3;
...@@ -221,29 +208,43 @@ void InitializeForceCompositingModeFieldTrial() { ...@@ -221,29 +208,43 @@ void InitializeForceCompositingModeFieldTrial() {
// Produce the same result on every run of this client. // Produce the same result on every run of this client.
trial->UseOneTimeRandomization(); trial->UseOneTimeRandomization();
// 1/3 probability of being in the enabled or thread group.
const base::FieldTrial::Probability kEnableProbability = 1; base::FieldTrial::Probability force_compositing_mode_probability = 0;
int enable_group = trial->AppendGroup( base::FieldTrial::Probability threaded_compositing_probability = 0;
content::kGpuCompositingFieldTrialEnabledName, kEnableProbability);
chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel();
if (channel == chrome::VersionInfo::CHANNEL_STABLE ||
channel == chrome::VersionInfo::CHANNEL_BETA) {
// Stable and Beta channels: Non-threaded force-compositing-mode on by
// default (mac and windows only).
#if defined(OS_WIN) || defined(OS_MACOSX)
force_compositing_mode_probability = 3;
#endif
} else if (channel == chrome::VersionInfo::CHANNEL_DEV ||
channel == chrome::VersionInfo::CHANNEL_CANARY) {
// Dev and Canary channels: force-compositing-mode and
// threaded-compositing on with 1/3 probability each.
force_compositing_mode_probability = 1;
if (!CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableThreadedCompositing))
threaded_compositing_probability = 1;
}
int force_compositing_group = trial->AppendGroup(
content::kGpuCompositingFieldTrialForceCompositingEnabledName,
force_compositing_mode_probability);
int thread_group = trial->AppendGroup( int thread_group = trial->AppendGroup(
content::kGpuCompositingFieldTrialThreadEnabledName, kEnableProbability); content::kGpuCompositingFieldTrialThreadEnabledName,
threaded_compositing_probability);
bool enabled = (trial->group() == enable_group); bool force_compositing = (trial->group() == force_compositing_group);
bool thread = (trial->group() == thread_group); bool thread = (trial->group() == thread_group);
UMA_HISTOGRAM_BOOLEAN("GPU.InForceCompositingModeFieldTrial", enabled); UMA_HISTOGRAM_BOOLEAN("GPU.InForceCompositingModeFieldTrial",
force_compositing);
UMA_HISTOGRAM_BOOLEAN("GPU.InCompositorThreadFieldTrial", thread); UMA_HISTOGRAM_BOOLEAN("GPU.InCompositorThreadFieldTrial", thread);
} }
bool InForceCompositingModeOrThreadTrial() {
base::FieldTrial* trial =
base::FieldTrialList::Find(content::kGpuCompositingFieldTrialName);
if (!trial)
return false;
return trial->group_name() == content::kGpuCompositingFieldTrialEnabledName ||
trial->group_name() ==
content::kGpuCompositingFieldTrialThreadEnabledName;
}
GpuFeatureType StringToGpuFeatureType(const std::string& feature_string) { GpuFeatureType StringToGpuFeatureType(const std::string& feature_string) {
if (feature_string == kGpuFeatureNameAccelerated2dCanvas) if (feature_string == kGpuFeatureNameAccelerated2dCanvas)
return content::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS; return content::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS;
...@@ -417,16 +418,10 @@ Value* GetFeatureStatus() { ...@@ -417,16 +418,10 @@ Value* GetFeatureStatus() {
(command_line.HasSwitch(switches::kDisableAcceleratedCompositing) || (command_line.HasSwitch(switches::kDisableAcceleratedCompositing) ||
(flags & content::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING))) (flags & content::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING)))
status += "_readback"; status += "_readback";
bool has_thread = bool has_thread = content::IsThreadedCompositingEnabled();
(command_line.HasSwitch(switches::kEnableThreadedCompositing) &&
!command_line.HasSwitch(switches::kDisableThreadedCompositing)) ||
InForceThreadedCompositingModeTrial();
if (kGpuFeatureInfo[i].name == "compositing") { if (kGpuFeatureInfo[i].name == "compositing") {
bool force_compositing = bool force_compositing =
(command_line.HasSwitch(switches::kForceCompositingMode) && content::IsForceCompositingModeEnabled();
!command_line.HasSwitch(
switches::kDisableForceCompositingMode)) ||
InForceCompositingModeOrThreadTrial();
if (force_compositing) if (force_compositing)
status += "_force"; status += "_force";
if (has_thread) if (has_thread)
......
...@@ -70,12 +70,8 @@ base::DictionaryValue* GpuInfoAsDictionaryValue(); ...@@ -70,12 +70,8 @@ base::DictionaryValue* GpuInfoAsDictionaryValue();
// Send UMA histograms about the enabled features. // Send UMA histograms about the enabled features.
void UpdateStats(); void UpdateStats();
// Returns whether this client has been selected for the force-compositing-mode // Sets up force-compositing-mode and threaded compositing field trials.
// or threaded-compositor trial. void InitializeCompositingFieldTrial();
bool InForceCompositingModeOrThreadTrial();
// Sets up the force-compositing-mode field trial.
void InitializeForceCompositingModeFieldTrial();
} // namespace gpu_util } // namespace gpu_util
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include "content/public/browser/notification_service.h" #include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_types.h" #include "content/public/browser/notification_types.h"
#include "content/public/browser/user_metrics.h" #include "content/public/browser/user_metrics.h"
#include "content/public/common/compositor_util.h"
#include "content/public/common/content_constants.h" #include "content/public/common/content_constants.h"
#include "content/public/common/content_switches.h" #include "content/public/common/content_switches.h"
#include "content/public/common/result_codes.h" #include "content/public/common/result_codes.h"
...@@ -172,6 +173,8 @@ RenderWidgetHostImpl::RenderWidgetHostImpl(RenderWidgetHostDelegate* delegate, ...@@ -172,6 +173,8 @@ RenderWidgetHostImpl::RenderWidgetHostImpl(RenderWidgetHostDelegate* delegate,
DCHECK(surface_id_); DCHECK(surface_id_);
} }
is_threaded_compositing_enabled_ = IsThreadedCompositingEnabled();
process_->Attach(this, routing_id_); process_->Attach(this, routing_id_);
// Because the widget initializes as is_hidden_ == false, // Because the widget initializes as is_hidden_ == false,
// tell the process host that we're alive. // tell the process host that we're alive.
...@@ -1991,18 +1994,7 @@ void RenderWidgetHostImpl::AcknowledgeBufferPresent( ...@@ -1991,18 +1994,7 @@ void RenderWidgetHostImpl::AcknowledgeBufferPresent(
} }
void RenderWidgetHostImpl::AcknowledgeSwapBuffersToRenderer() { void RenderWidgetHostImpl::AcknowledgeSwapBuffersToRenderer() {
base::FieldTrial* trial = if (!is_threaded_compositing_enabled_)
base::FieldTrialList::Find(content::kGpuCompositingFieldTrialName);
bool is_thread_trial = trial && trial->group_name() ==
content::kGpuCompositingFieldTrialThreadEnabledName;
bool has_enable = CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableThreadedCompositing);
bool has_disable = CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableThreadedCompositing);
DCHECK(!is_thread_trial || !has_disable);
bool enable_threaded_compositing =
is_thread_trial || (has_enable && !has_disable);
if (!enable_threaded_compositing)
Send(new ViewMsg_SwapBuffers_ACK(routing_id_)); Send(new ViewMsg_SwapBuffers_ACK(routing_id_));
} }
......
...@@ -631,6 +631,9 @@ class CONTENT_EXPORT RenderWidgetHostImpl : virtual public RenderWidgetHost, ...@@ -631,6 +631,9 @@ class CONTENT_EXPORT RenderWidgetHostImpl : virtual public RenderWidgetHost,
// True when a page is rendered directly via the GPU process. // True when a page is rendered directly via the GPU process.
bool is_accelerated_compositing_active_; bool is_accelerated_compositing_active_;
// True if threaded compositing is enabled on this view.
bool is_threaded_compositing_enabled_;
// Set if we are waiting for a repaint ack for the view. // Set if we are waiting for a repaint ack for the view.
bool repaint_ack_pending_; bool repaint_ack_pending_;
......
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/public/common/compositor_util.h"
#include "base/command_line.h"
#include "base/metrics/field_trial.h"
#include "content/public/common/content_constants.h"
#include "content/public/common/content_switches.h"
namespace content {
bool IsThreadedCompositingEnabled() {
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
if (command_line.HasSwitch(switches::kEnableThreadedCompositing) &&
!command_line.HasSwitch(switches::kDisableThreadedCompositing))
return true;
base::FieldTrial* trial =
base::FieldTrialList::Find(content::kGpuCompositingFieldTrialName);
return trial &&
trial->group_name() ==
content::kGpuCompositingFieldTrialThreadEnabledName;
}
bool IsForceCompositingModeEnabled() {
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
if (command_line.HasSwitch(switches::kForceCompositingMode) &&
!command_line.HasSwitch(switches::kDisableForceCompositingMode))
return true;
base::FieldTrial* trial =
base::FieldTrialList::Find(content::kGpuCompositingFieldTrialName);
// Force compositing is enabled in both the force compositing
// and threaded compositing mode field trials.
return trial &&
(trial->group_name() ==
content::kGpuCompositingFieldTrialForceCompositingEnabledName ||
trial->group_name() ==
content::kGpuCompositingFieldTrialThreadEnabledName);
}
} // compositor_util
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "content/common/gpu/gpu_memory_allocation.h" #include "content/common/gpu/gpu_memory_allocation.h"
#include "content/common/gpu/client/gpu_channel_host.h" #include "content/common/gpu/client/gpu_channel_host.h"
#include "content/common/gpu/gpu_process_launch_causes.h" #include "content/common/gpu/gpu_process_launch_causes.h"
#include "content/public/common/compositor_util.h"
#include "content/public/common/content_constants.h" #include "content/public/common/content_constants.h"
#include "content/public/common/content_switches.h" #include "content/public/common/content_switches.h"
#include "gpu/command_buffer/client/gles2_cmd_helper.h" #include "gpu/command_buffer/client/gles2_cmd_helper.h"
...@@ -151,7 +152,12 @@ WebGraphicsContext3DCommandBufferImpl::WebGraphicsContext3DCommandBufferImpl( ...@@ -151,7 +152,12 @@ WebGraphicsContext3DCommandBufferImpl::WebGraphicsContext3DCommandBufferImpl(
transfer_buffer_(NULL), transfer_buffer_(NULL),
gl_(NULL), gl_(NULL),
frame_number_(0), frame_number_(0),
bind_generates_resources_(false) { bind_generates_resources_(false),
use_echo_for_swap_ack_(true) {
#if defined(OS_MACOSX) || defined(OS_WIN)
// Get ViewMsg_SwapBuffers_ACK from browser for single-threaded path.
use_echo_for_swap_ack_ = content::IsThreadedCompositingEnabled();
#endif
} }
WebGraphicsContext3DCommandBufferImpl:: WebGraphicsContext3DCommandBufferImpl::
...@@ -521,20 +527,7 @@ void WebGraphicsContext3DCommandBufferImpl::prepareTexture() { ...@@ -521,20 +527,7 @@ void WebGraphicsContext3DCommandBufferImpl::prepareTexture() {
if (command_buffer_->GetLastState().error == gpu::error::kNoError) if (command_buffer_->GetLastState().error == gpu::error::kNoError)
gl_->SwapBuffers(); gl_->SwapBuffers();
bool use_echo_for_swap_ack = true; if (use_echo_for_swap_ack_) {
#if defined(OS_MACOSX) || defined(OS_WIN)
// Get ViewMsg_SwapBuffers_ACK from browser for single-threaded path.
base::FieldTrial* trial =
base::FieldTrialList::Find(content::kGpuCompositingFieldTrialName);
bool thread_trial = trial && trial->group_name() ==
content::kGpuCompositingFieldTrialThreadEnabledName;
use_echo_for_swap_ack = thread_trial ||
(CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableThreadedCompositing) &&
!CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableThreadedCompositing));
#endif
if (use_echo_for_swap_ack) {
command_buffer_->Echo(base::Bind( command_buffer_->Echo(base::Bind(
&WebGraphicsContext3DCommandBufferImpl::OnSwapBuffersComplete, &WebGraphicsContext3DCommandBufferImpl::OnSwapBuffersComplete,
weak_ptr_factory_.GetWeakPtr())); weak_ptr_factory_.GetWeakPtr()));
......
...@@ -713,6 +713,7 @@ class WebGraphicsContext3DCommandBufferImpl ...@@ -713,6 +713,7 @@ class WebGraphicsContext3DCommandBufferImpl
Error last_error_; Error last_error_;
int frame_number_; int frame_number_;
bool bind_generates_resources_; bool bind_generates_resources_;
bool use_echo_for_swap_ack_;
}; };
#endif // CONTENT_COMMON_GPU_CLIENT_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ #endif // CONTENT_COMMON_GPU_CLIENT_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
'public/common/child_process_host_delegate.cc', 'public/common/child_process_host_delegate.cc',
'public/common/child_process_host_delegate.h', 'public/common/child_process_host_delegate.h',
'public/common/child_process_sandbox_support_linux.h', 'public/common/child_process_sandbox_support_linux.h',
'public/common/compositor_util.h',
'public/common/content_constants.cc', 'public/common/content_constants.cc',
'public/common/content_constants.h', 'public/common/content_constants.h',
'public/common/content_descriptors.h', 'public/common/content_descriptors.h',
...@@ -138,6 +139,7 @@ ...@@ -138,6 +139,7 @@
'common/child_trace_message_filter.h', 'common/child_trace_message_filter.h',
'common/clipboard_messages.cc', 'common/clipboard_messages.cc',
'common/clipboard_messages.h', 'common/clipboard_messages.h',
'common/compositor_util.cc',
'common/content_message_generator.cc', 'common/content_message_generator.cc',
'common/content_message_generator.h', 'common/content_message_generator.h',
'common/content_export.h', 'common/content_export.h',
......
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_PUBLIC_COMMON_COMPOSITOR_UTIL_H_
#define CONTENT_PUBLIC_COMMON_COMPOSITOR_UTIL_H_
#include "content/common/content_export.h"
namespace content {
// Returns true if the threaded compositor is on (via flags or field trial).
CONTENT_EXPORT bool IsThreadedCompositingEnabled();
// Returns true if force-compositing-mode is on (via flags or field trial).
CONTENT_EXPORT bool IsForceCompositingModeEnabled();
} // namespace content
#endif // CONTENT_PUBLIC_COMMON_COMPOSITOR_UTIL_H_
...@@ -33,7 +33,7 @@ const int kStatsMaxCounters = 3000; ...@@ -33,7 +33,7 @@ const int kStatsMaxCounters = 3000;
const int kHistogramSynchronizerReservedSequenceNumber = 0; const int kHistogramSynchronizerReservedSequenceNumber = 0;
const char kGpuCompositingFieldTrialName[] = "ForceCompositingMode"; const char kGpuCompositingFieldTrialName[] = "ForceCompositingMode";
const char kGpuCompositingFieldTrialEnabledName[] = "enabled"; const char kGpuCompositingFieldTrialForceCompositingEnabledName[] = "enabled";
const char kGpuCompositingFieldTrialThreadEnabledName[] = "thread"; const char kGpuCompositingFieldTrialThreadEnabledName[] = "thread";
} // namespace content } // namespace content
...@@ -54,7 +54,8 @@ extern const int kStatsMaxCounters; ...@@ -54,7 +54,8 @@ extern const int kStatsMaxCounters;
CONTENT_EXPORT extern const int kHistogramSynchronizerReservedSequenceNumber; CONTENT_EXPORT extern const int kHistogramSynchronizerReservedSequenceNumber;
CONTENT_EXPORT extern const char kGpuCompositingFieldTrialName[]; CONTENT_EXPORT extern const char kGpuCompositingFieldTrialName[];
CONTENT_EXPORT extern const char kGpuCompositingFieldTrialEnabledName[]; CONTENT_EXPORT extern const char
kGpuCompositingFieldTrialForceCompositingEnabledName[];
CONTENT_EXPORT extern const char kGpuCompositingFieldTrialThreadEnabledName[]; CONTENT_EXPORT extern const char kGpuCompositingFieldTrialThreadEnabledName[];
} // namespace content } // namespace content
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include "content/common/resource_messages.h" #include "content/common/resource_messages.h"
#include "content/common/view_messages.h" #include "content/common/view_messages.h"
#include "content/common/web_database_observer_impl.h" #include "content/common/web_database_observer_impl.h"
#include "content/public/common/compositor_util.h"
#include "content/public/common/content_constants.h" #include "content/public/common/content_constants.h"
#include "content/public/common/content_paths.h" #include "content/public/common/content_paths.h"
#include "content/public/common/content_switches.h" #include "content/public/common/content_switches.h"
...@@ -492,21 +493,12 @@ void RenderThreadImpl::EnsureWebKitInitialized() { ...@@ -492,21 +493,12 @@ void RenderThreadImpl::EnsureWebKitInitialized() {
webkit_platform_support_.reset(new RendererWebKitPlatformSupportImpl); webkit_platform_support_.reset(new RendererWebKitPlatformSupportImpl);
WebKit::initialize(webkit_platform_support_.get()); WebKit::initialize(webkit_platform_support_.get());
base::FieldTrial* thread_trial =
base::FieldTrialList::Find(content::kGpuCompositingFieldTrialName);
bool is_thread_trial = thread_trial && thread_trial->group_name() ==
content::kGpuCompositingFieldTrialThreadEnabledName;
bool has_enable = CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableThreadedCompositing);
bool has_disable = CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableThreadedCompositing);
// TODO(fsamuel): Guests don't currently support threaded compositing. // TODO(fsamuel): Guests don't currently support threaded compositing.
// This should go away with the new design of the browser plugin. // This should go away with the new design of the browser plugin.
// The new design can be tracked at: http://crbug.com/134492. // The new design can be tracked at: http://crbug.com/134492.
bool is_guest = CommandLine::ForCurrentProcess()->HasSwitch( bool is_guest = CommandLine::ForCurrentProcess()->HasSwitch(
switches::kGuestRenderer); switches::kGuestRenderer);
DCHECK(!is_thread_trial || !has_disable); bool enable = content::IsThreadedCompositingEnabled() && !is_guest;
bool enable = (is_thread_trial || (has_enable && !has_disable)) && !is_guest;
if (enable) { if (enable) {
compositor_thread_.reset(new CompositorThread(this)); compositor_thread_.reset(new CompositorThread(this));
AddFilter(compositor_thread_->GetMessageFilter()); AddFilter(compositor_thread_->GetMessageFilter());
......
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