Commit fbe382a2 authored by piman@chromium.org's avatar piman@chromium.org

Don't test kEnableThreadedCompositing in WebGraphicsContext3DCommandBufferImpl

It's a layering violation (and has crazy side effects when instantiating those
in the browser).

BUG=None

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@233405 0039d316-1c4b-4281-b951-d872f2087c98
parent 9c194eb9
......@@ -509,12 +509,14 @@ GpuProcessTransportFactory::CreateContextCommon(
if (!gpu_channel_host)
return scoped_ptr<WebGraphicsContext3DCommandBufferImpl>();
GURL url("chrome://gpu/GpuProcessTransportFactory::CreateContextCommon");
bool use_echo_for_swap_ack = true;
scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context(
new WebGraphicsContext3DCommandBufferImpl(
surface_id,
url,
gpu_channel_host.get(),
swap_client,
use_echo_for_swap_ack,
attrs,
false,
WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits()));
......
......@@ -381,11 +381,13 @@ CreateGpuProcessViewContext(
limits.max_transfer_buffer_size = std::min(
3 * full_screen_texture_size_in_bytes, kDefaultMaxTransferBufferSize);
limits.mapped_memory_reclaim_limit = 2 * 1024 * 1024;
bool use_echo_for_swap_ack = true;
return make_scoped_ptr(
new WebGraphicsContext3DCommandBufferImpl(surface_id,
url,
gpu_channel_host.get(),
compositor_impl,
use_echo_for_swap_ack,
attributes,
false,
limits));
......
......@@ -79,11 +79,13 @@ CmdBufferImageTransportFactory::CmdBufferImageTransportFactory() {
3 * full_screen_texture_size_in_bytes, kDefaultMaxTransferBufferSize);
limits.mapped_memory_reclaim_limit =
WebGraphicsContext3DCommandBufferImpl::kNoLimit;
bool use_echo_for_swap_ack = true;
context_.reset(
new WebGraphicsContext3DCommandBufferImpl(0, // offscreen
url,
gpu_channel_host.get(),
swap_client,
use_echo_for_swap_ack,
attrs,
false,
limits));
......
......@@ -213,6 +213,7 @@ WebGraphicsContext3DCommandBufferImpl::WebGraphicsContext3DCommandBufferImpl(
const GURL& active_url,
GpuChannelHost* host,
const base::WeakPtr<WebGraphicsContext3DSwapBuffersClient>& swap_client,
bool use_echo_for_swap_ack,
const Attributes& attributes,
bool bind_generates_resources,
const SharedMemoryLimits& limits)
......@@ -235,15 +236,9 @@ WebGraphicsContext3DCommandBufferImpl::WebGraphicsContext3DCommandBufferImpl(
gl_(NULL),
frame_number_(0),
bind_generates_resources_(bind_generates_resources),
use_echo_for_swap_ack_(true),
use_echo_for_swap_ack_(use_echo_for_swap_ack),
mem_limits_(limits),
flush_id_(0) {
#if (defined(OS_MACOSX) || defined(OS_WIN)) && !defined(USE_AURA)
// Get ViewMsg_SwapBuffers_ACK from browser for single-threaded path.
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
use_echo_for_swap_ack_ =
command_line.HasSwitch(switches::kEnableThreadedCompositing);
#endif
}
WebGraphicsContext3DCommandBufferImpl::
......@@ -1272,10 +1267,12 @@ WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext(
if (!host)
return NULL;
base::WeakPtr<WebGraphicsContext3DSwapBuffersClient> null_client;
bool use_echo_for_swap_ack = true;
return new WebGraphicsContext3DCommandBufferImpl(0,
active_url,
host,
null_client,
use_echo_for_swap_ack,
attributes,
false,
SharedMemoryLimits());
......
......@@ -90,6 +90,7 @@ class WebGraphicsContext3DCommandBufferImpl
const GURL& active_url,
GpuChannelHost* host,
const base::WeakPtr<WebGraphicsContext3DSwapBuffersClient>& swap_client,
bool use_echo_for_swap_ack,
const Attributes& attributes,
bool bind_generates_resources,
const SharedMemoryLimits& limits);
......
......@@ -2826,8 +2826,14 @@ RenderWidget::CreateGraphicsContext3D(
base::WeakPtr<WebGraphicsContext3DSwapBuffersClient> swap_client;
if (!is_threaded_compositing_enabled_)
bool use_echo_for_swap_ack = true;
if (!is_threaded_compositing_enabled_) {
swap_client = weak_ptr_factory_.GetWeakPtr();
#if (defined(OS_MACOSX) || defined(OS_WIN)) && !defined(USE_AURA)
// ViewMsg_SwapBuffers_ACK is used instead for single-threaded path.
use_echo_for_swap_ack = false;
#endif
}
scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context(
new WebGraphicsContext3DCommandBufferImpl(
......@@ -2835,6 +2841,7 @@ RenderWidget::CreateGraphicsContext3D(
GetURLForGraphicsContext3D(),
gpu_channel_host.get(),
swap_client,
use_echo_for_swap_ack,
attributes,
false /* bind generates resources */,
limits));
......
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