Commit 0ccc59f7 authored by jbauman's avatar jbauman Committed by Commit bot

Unify checking of --use-surfaces flag.

BUG=

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

Cr-Commit-Position: refs/heads/master@{#294973}
parent 6e3f35be
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "cc/resources/texture_mailbox.h" #include "cc/resources/texture_mailbox.h"
#include "cc/surfaces/surface_factory.h" #include "cc/surfaces/surface_factory.h"
#include "content/browser/compositor/resize_lock.h" #include "content/browser/compositor/resize_lock.h"
#include "content/browser/gpu/compositor_util.h"
#include "content/common/gpu/client/gl_helper.h" #include "content/common/gpu/client/gl_helper.h"
#include "content/public/browser/render_widget_host_view_frame_subscriber.h" #include "content/public/browser/render_widget_host_view_frame_subscriber.h"
#include "content/public/common/content_switches.h" #include "content/public/common/content_switches.h"
...@@ -53,8 +54,7 @@ void DelegatedFrameHostClient::RequestCopyOfOutput( ...@@ -53,8 +54,7 @@ void DelegatedFrameHostClient::RequestCopyOfOutput(
DelegatedFrameHost::DelegatedFrameHost(DelegatedFrameHostClient* client) DelegatedFrameHost::DelegatedFrameHost(DelegatedFrameHostClient* client)
: client_(client), : client_(client),
use_surfaces_(base::CommandLine::ForCurrentProcess()->HasSwitch( use_surfaces_(UseSurfacesEnabled()),
switches::kUseSurfaces)),
last_output_surface_id_(0), last_output_surface_id_(0),
pending_delegated_ack_count_(0), pending_delegated_ack_count_(0),
skipped_frames_(false), skipped_frames_(false),
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "content/browser/compositor/software_browser_compositor_output_surface.h" #include "content/browser/compositor/software_browser_compositor_output_surface.h"
#include "content/browser/compositor/surface_display_output_surface.h" #include "content/browser/compositor/surface_display_output_surface.h"
#include "content/browser/gpu/browser_gpu_channel_host_factory.h" #include "content/browser/gpu/browser_gpu_channel_host_factory.h"
#include "content/browser/gpu/compositor_util.h"
#include "content/browser/gpu/gpu_data_manager_impl.h" #include "content/browser/gpu/gpu_data_manager_impl.h"
#include "content/browser/gpu/gpu_surface_tracker.h" #include "content/browser/gpu/gpu_surface_tracker.h"
#include "content/browser/renderer_host/render_widget_host_impl.h" #include "content/browser/renderer_host/render_widget_host_impl.h"
...@@ -81,10 +82,8 @@ GpuProcessTransportFactory::GpuProcessTransportFactory() ...@@ -81,10 +82,8 @@ GpuProcessTransportFactory::GpuProcessTransportFactory()
compositor_thread_.reset(new base::Thread("Browser Compositor")); compositor_thread_.reset(new base::Thread("Browser Compositor"));
compositor_thread_->Start(); compositor_thread_->Start();
} }
if (base::CommandLine::ForCurrentProcess()->HasSwitch( if (UseSurfacesEnabled())
switches::kUseSurfaces)) {
surface_manager_ = make_scoped_ptr(new cc::SurfaceManager); surface_manager_ = make_scoped_ptr(new cc::SurfaceManager);
}
} }
GpuProcessTransportFactory::~GpuProcessTransportFactory() { GpuProcessTransportFactory::~GpuProcessTransportFactory() {
...@@ -174,8 +173,7 @@ scoped_ptr<cc::OutputSurface> GpuProcessTransportFactory::CreateOutputSurface( ...@@ -174,8 +173,7 @@ scoped_ptr<cc::OutputSurface> GpuProcessTransportFactory::CreateOutputSurface(
compositor_thread_task_runner.get()); compositor_thread_task_runner.get());
} }
if (base::CommandLine::ForCurrentProcess()->HasSwitch( if (UseSurfacesEnabled()) {
switches::kUseSurfaces)) {
// This gets a bit confusing. Here we have a ContextProvider configured to // This gets a bit confusing. Here we have a ContextProvider configured to
// render directly to this widget. We need to make an OnscreenDisplayClient // render directly to this widget. We need to make an OnscreenDisplayClient
// associated with this context, then return a SurfaceDisplayOutputSurface // associated with this context, then return a SurfaceDisplayOutputSurface
......
...@@ -270,6 +270,13 @@ bool IsForceGpuRasterizationEnabled() { ...@@ -270,6 +270,13 @@ bool IsForceGpuRasterizationEnabled() {
return command_line.HasSwitch(switches::kForceGpuRasterization); return command_line.HasSwitch(switches::kForceGpuRasterization);
} }
bool UseSurfacesEnabled() {
const base::CommandLine& command_line =
*base::CommandLine::ForCurrentProcess();
return command_line.HasSwitch(switches::kUseSurfaces);
}
base::Value* GetFeatureStatus() { base::Value* GetFeatureStatus() {
GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance(); GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance();
std::string gpu_access_blocked_reason; std::string gpu_access_blocked_reason;
......
...@@ -37,6 +37,9 @@ CONTENT_EXPORT int NumberOfRendererRasterThreads(); ...@@ -37,6 +37,9 @@ CONTENT_EXPORT int NumberOfRendererRasterThreads();
// by the command line. // by the command line.
CONTENT_EXPORT int ForceNumberOfRendererRasterThreads(); CONTENT_EXPORT int ForceNumberOfRendererRasterThreads();
// Returns true if using cc Surfaces is allowed.
CONTENT_EXPORT bool UseSurfacesEnabled();
CONTENT_EXPORT base::Value* GetFeatureStatus(); CONTENT_EXPORT base::Value* GetFeatureStatus();
CONTENT_EXPORT base::Value* GetProblems(); CONTENT_EXPORT base::Value* GetProblems();
CONTENT_EXPORT base::Value* GetDriverBugWorkarounds(); CONTENT_EXPORT base::Value* GetDriverBugWorkarounds();
......
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