summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authoraelias@chromium.org <aelias@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-11 12:19:29 +0000
committeraelias@chromium.org <aelias@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-11 12:19:29 +0000
commit36e5ff130092eb95bf734c39d15e1ae48fad1581 (patch)
tree63c4142ae12770156248e2c1c61fd4c93dd089a4 /content
parentf74356578beb2e385a1bd5a1a26677ce058bc4bf (diff)
downloadchromium_src-36e5ff130092eb95bf734c39d15e1ae48fad1581.zip
chromium_src-36e5ff130092eb95bf734c39d15e1ae48fad1581.tar.gz
chromium_src-36e5ff130092eb95bf734c39d15e1ae48fad1581.tar.bz2
Unified OutputSurface::SwapBuffers.
This patch introduces a hard contract that CC will always call OutputSurface::SwapBuffers(), and OutputSurface will always respond with OutputSurfaceClient::OnSwapBuffersComplete(), in all rendering modes. I deleted the methods SendFrameToParentCompositor, PostSubBuffer, and OnSendFrameToParentCompositorAck, subsuming them into SwapBuffers. I also deleted all the settings and capabilities specifying which variant needed to be called. This should be a no-op for all graphics modes except for Android WebView, where it has the benefits of ensuring OnSwapBuffersComplete is called and that CompositorFrameMetadata is available even though no parent compositor exists. NOTRY=true BUG=237006 Review URL: https://chromiumcodereview.appspot.com/16304003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@205501 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/browser/android/in_process/synchronous_compositor_output_surface.cc35
-rw-r--r--content/browser/android/in_process/synchronous_compositor_output_surface.h3
-rw-r--r--content/browser/renderer_host/compositor_impl_android.cc7
-rw-r--r--content/browser/renderer_host/image_transport_factory.cc31
-rw-r--r--content/content_renderer.gypi2
-rw-r--r--content/renderer/gpu/compositor_output_surface.cc50
-rw-r--r--content/renderer/gpu/compositor_output_surface.h9
-rw-r--r--content/renderer/gpu/delegated_compositor_output_surface.cc18
-rw-r--r--content/renderer/gpu/delegated_compositor_output_surface.h23
-rw-r--r--content/renderer/gpu/mailbox_output_surface.cc44
-rw-r--r--content/renderer/gpu/mailbox_output_surface.h4
-rw-r--r--content/renderer/gpu/render_widget_compositor.cc12
-rw-r--r--content/renderer/render_widget.cc23
13 files changed, 136 insertions, 125 deletions
diff --git a/content/browser/android/in_process/synchronous_compositor_output_surface.cc b/content/browser/android/in_process/synchronous_compositor_output_surface.cc
index 8d25082..7613168 100644
--- a/content/browser/android/in_process/synchronous_compositor_output_surface.cc
+++ b/content/browser/android/in_process/synchronous_compositor_output_surface.cc
@@ -59,13 +59,15 @@ class SynchronousCompositorOutputSurface::SoftwareDevice
// Intentional no-op: canvas size is controlled by the embedder.
}
virtual SkCanvas* BeginPaint(gfx::Rect damage_rect) OVERRIDE {
- DCHECK(surface_->current_sw_canvas_);
- if (surface_->current_sw_canvas_)
- return surface_->current_sw_canvas_;
- return &null_canvas_;
+ if (!surface_->current_sw_canvas_) {
+ NOTREACHED() << "BeginPaint with no canvas set";
+ return &null_canvas_;
+ }
+ LOG_IF(WARNING, surface_->did_swap_buffer_)
+ << "Mutliple calls to BeginPaint per frame";
+ return surface_->current_sw_canvas_;
}
virtual void EndPaint(cc::SoftwareFrameData* frame_data) OVERRIDE {
- surface_->current_sw_canvas_ = NULL;
}
virtual void CopyToBitmap(gfx::Rect rect, SkBitmap* output) OVERRIDE {
NOTIMPLEMENTED();
@@ -119,12 +121,6 @@ void SynchronousCompositorOutputSurface::Reshape(
// Intentional no-op: surface size is controlled by the embedder.
}
-void SynchronousCompositorOutputSurface::SendFrameToParentCompositor(
- cc::CompositorFrame* frame) {
- NOTREACHED();
- // TODO(joth): Route page scale to the client, see http://crbug.com/237006
-}
-
void SynchronousCompositorOutputSurface::SetNeedsBeginFrame(
bool enable) {
DCHECK(CalledOnValidThread());
@@ -135,8 +131,12 @@ void SynchronousCompositorOutputSurface::SetNeedsBeginFrame(
}
void SynchronousCompositorOutputSurface::SwapBuffers(
- const ui::LatencyInfo& info) {
- context3d()->shallowFlushCHROMIUM();
+ cc::CompositorFrame* frame) {
+ if (!ForcedDrawToSoftwareDevice()) {
+ DCHECK(context3d());
+ context3d()->shallowFlushCHROMIUM();
+ }
+ // TODO(joth): Route page scale to the client, see http://crbug.com/237006
did_swap_buffer_ = true;
}
@@ -174,8 +174,6 @@ bool SynchronousCompositorOutputSurface::DemandDrawHw(
if (current_context)
current_context->ReleaseCurrent(NULL);
- did_swap_buffer_ = false;
-
gfx::Transform adjusted_transform = transform;
AdjustTransformForClip(&adjusted_transform, clip);
surface_size_ = surface_size;
@@ -207,16 +205,19 @@ bool SynchronousCompositorOutputSurface::DemandDrawSw(SkCanvas* canvas) {
InvokeComposite(clip.size());
- bool finished_draw = current_sw_canvas_ == NULL;
current_sw_canvas_ = NULL;
- return finished_draw;
+ return did_swap_buffer_;
}
void SynchronousCompositorOutputSurface::InvokeComposite(
gfx::Size damage_size) {
+ did_swap_buffer_ = false;
client_->SetNeedsRedrawRect(gfx::Rect(damage_size));
if (needs_begin_frame_)
client_->BeginFrame(base::TimeTicks::Now());
+
+ if (did_swap_buffer_)
+ client_->OnSwapBuffersComplete(NULL);
}
// Not using base::NonThreadSafe as we want to enforce a more exacting threading
diff --git a/content/browser/android/in_process/synchronous_compositor_output_surface.h b/content/browser/android/in_process/synchronous_compositor_output_surface.h
index a2434df..dabed4b 100644
--- a/content/browser/android/in_process/synchronous_compositor_output_surface.h
+++ b/content/browser/android/in_process/synchronous_compositor_output_surface.h
@@ -54,9 +54,8 @@ class SynchronousCompositorOutputSurface
virtual bool ForcedDrawToSoftwareDevice() const OVERRIDE;
virtual bool BindToClient(cc::OutputSurfaceClient* surface_client) OVERRIDE;
virtual void Reshape(gfx::Size size, float scale_factor) OVERRIDE;
- virtual void SendFrameToParentCompositor(cc::CompositorFrame* frame) OVERRIDE;
virtual void SetNeedsBeginFrame(bool enable) OVERRIDE;
- virtual void SwapBuffers(const ui::LatencyInfo& info) OVERRIDE;
+ virtual void SwapBuffers(cc::CompositorFrame* frame) OVERRIDE;
// Partial SynchronousCompositor API implementation.
bool InitializeHwDraw();
diff --git a/content/browser/renderer_host/compositor_impl_android.cc b/content/browser/renderer_host/compositor_impl_android.cc
index ec1ae64..c80d73b9 100644
--- a/content/browser/renderer_host/compositor_impl_android.cc
+++ b/content/browser/renderer_host/compositor_impl_android.cc
@@ -48,9 +48,10 @@ class DirectOutputSurface : public cc::OutputSurface {
DirectOutputSurface(scoped_ptr<WebKit::WebGraphicsContext3D> context3d)
: cc::OutputSurface(context3d.Pass()) {}
- virtual void Reshape(gfx::Size size, float scale_factor) OVERRIDE {}
- virtual void PostSubBuffer(gfx::Rect rect, const ui::LatencyInfo&) OVERRIDE {}
- virtual void SwapBuffers(const ui::LatencyInfo&) OVERRIDE {
+ virtual void Reshape(gfx::Size size, float scale_factor) OVERRIDE {
+ surface_size_ = size;
+ }
+ virtual void SwapBuffers(cc::CompositorFrame*) OVERRIDE {
context3d()->shallowFlushCHROMIUM();
}
};
diff --git a/content/browser/renderer_host/image_transport_factory.cc b/content/browser/renderer_host/image_transport_factory.cc
index 412d7c5..627d8cd 100644
--- a/content/browser/renderer_host/image_transport_factory.cc
+++ b/content/browser/renderer_host/image_transport_factory.cc
@@ -14,6 +14,7 @@
#include "base/observer_list.h"
#include "base/strings/string_number_conversions.h"
#include "base/threading/non_thread_safe.h"
+#include "cc/output/compositor_frame.h"
#include "cc/output/output_surface.h"
#include "cc/output/output_surface_client.h"
#include "content/browser/gpu/browser_gpu_channel_host_factory.h"
@@ -539,35 +540,25 @@ class BrowserCompositorOutputSurface
reflector_->OnReshape(size);
}
- virtual void SwapBuffers(const ui::LatencyInfo& latency_info) OVERRIDE {
- WebGraphicsContext3DCommandBufferImpl* command_buffer =
- static_cast<WebGraphicsContext3DCommandBufferImpl*>(context3d());
- CommandBufferProxyImpl* command_buffer_proxy =
- command_buffer->GetCommandBufferProxy();
- DCHECK(command_buffer_proxy);
- context3d()->shallowFlushCHROMIUM();
- command_buffer_proxy->SetLatencyInfo(latency_info);
+ virtual void SwapBuffers(cc::CompositorFrame* frame) OVERRIDE {
+ DCHECK(frame->gl_frame_data);
- if (reflector_.get())
- reflector_->OnSwapBuffers();
-
- OutputSurface::SwapBuffers(latency_info);
- }
-
- virtual void PostSubBuffer(gfx::Rect rect,
- const ui::LatencyInfo& latency_info) OVERRIDE {
WebGraphicsContext3DCommandBufferImpl* command_buffer =
static_cast<WebGraphicsContext3DCommandBufferImpl*>(context3d());
CommandBufferProxyImpl* command_buffer_proxy =
command_buffer->GetCommandBufferProxy();
DCHECK(command_buffer_proxy);
context3d()->shallowFlushCHROMIUM();
- command_buffer_proxy->SetLatencyInfo(latency_info);
+ command_buffer_proxy->SetLatencyInfo(frame->metadata.latency_info);
- if (reflector_.get())
- reflector_->OnPostSubBuffer(rect);
+ if (reflector_.get()) {
+ if (frame->gl_frame_data->partial_swap_allowed)
+ reflector_->OnPostSubBuffer(frame->gl_frame_data->sub_buffer_rect);
+ else
+ reflector_->OnSwapBuffers();
+ }
- OutputSurface::PostSubBuffer(rect, latency_info);
+ OutputSurface::SwapBuffers(frame);
}
void SetReflector(ReflectorImpl* reflector) {
diff --git a/content/content_renderer.gypi b/content/content_renderer.gypi
index 1f1a0d7..8c95171 100644
--- a/content/content_renderer.gypi
+++ b/content/content_renderer.gypi
@@ -107,6 +107,8 @@
'renderer/gpu/compositor_output_surface.h',
'renderer/gpu/compositor_software_output_device.cc',
'renderer/gpu/compositor_software_output_device.h',
+ 'renderer/gpu/delegated_compositor_output_surface.cc',
+ 'renderer/gpu/delegated_compositor_output_surface.h',
'renderer/gpu/input_event_filter.cc',
'renderer/gpu/input_event_filter.h',
'renderer/gpu/input_handler_proxy.cc',
diff --git a/content/renderer/gpu/compositor_output_surface.cc b/content/renderer/gpu/compositor_output_surface.cc
index d49c7b8..c570f51 100644
--- a/content/renderer/gpu/compositor_output_surface.cc
+++ b/content/renderer/gpu/compositor_output_surface.cc
@@ -50,18 +50,17 @@ IPC::ForwardingMessageFilter* CompositorOutputSurface::CreateFilter(
CompositorOutputSurface::CompositorOutputSurface(
int32 routing_id,
WebGraphicsContext3DCommandBufferImpl* context3D,
- cc::SoftwareOutputDevice* software_device)
+ cc::SoftwareOutputDevice* software_device,
+ bool use_swap_compositor_frame_message)
: OutputSurface(scoped_ptr<WebKit::WebGraphicsContext3D>(context3D),
make_scoped_ptr(software_device)),
+ use_swap_compositor_frame_message_(use_swap_compositor_frame_message),
output_surface_filter_(
RenderThreadImpl::current()->compositor_output_surface_filter()),
routing_id_(routing_id),
prefers_smoothness_(false),
main_thread_handle_(base::PlatformThread::CurrentHandle()) {
DCHECK(output_surface_filter_.get());
- CommandLine* command_line = CommandLine::ForCurrentProcess();
- capabilities_.has_parent_compositor = command_line->HasSwitch(
- switches::kEnableDelegatedRenderer);
DetachFromThread();
message_sender_ = RenderThreadImpl::current()->sync_message_filter();
DCHECK(message_sender_.get());
@@ -93,34 +92,23 @@ bool CompositorOutputSurface::BindToClient(
return true;
}
-void CompositorOutputSurface::SendFrameToParentCompositor(
- cc::CompositorFrame* frame) {
- DCHECK(CalledOnValidThread());
- Send(new ViewHostMsg_SwapCompositorFrame(routing_id_, *frame));
-}
+void CompositorOutputSurface::SwapBuffers(cc::CompositorFrame* frame) {
+ if (use_swap_compositor_frame_message_) {
+ Send(new ViewHostMsg_SwapCompositorFrame(routing_id_, *frame));
+ return;
+ }
-void CompositorOutputSurface::SwapBuffers(
- const ui::LatencyInfo& latency_info) {
- WebGraphicsContext3DCommandBufferImpl* command_buffer =
- static_cast<WebGraphicsContext3DCommandBufferImpl*>(context3d());
- CommandBufferProxyImpl* command_buffer_proxy =
- command_buffer->GetCommandBufferProxy();
- DCHECK(command_buffer_proxy);
- context3d()->shallowFlushCHROMIUM();
- command_buffer_proxy->SetLatencyInfo(latency_info);
- OutputSurface::SwapBuffers(latency_info);
-}
+ if (frame->gl_frame_data) {
+ WebGraphicsContext3DCommandBufferImpl* command_buffer =
+ static_cast<WebGraphicsContext3DCommandBufferImpl*>(context3d());
+ CommandBufferProxyImpl* command_buffer_proxy =
+ command_buffer->GetCommandBufferProxy();
+ DCHECK(command_buffer_proxy);
+ context3d()->shallowFlushCHROMIUM();
+ command_buffer_proxy->SetLatencyInfo(frame->metadata.latency_info);
+ }
-void CompositorOutputSurface::PostSubBuffer(
- gfx::Rect rect, const ui::LatencyInfo& latency_info) {
- WebGraphicsContext3DCommandBufferImpl* command_buffer =
- static_cast<WebGraphicsContext3DCommandBufferImpl*>(context3d());
- CommandBufferProxyImpl* command_buffer_proxy =
- command_buffer->GetCommandBufferProxy();
- DCHECK(command_buffer_proxy);
- context3d()->shallowFlushCHROMIUM();
- command_buffer_proxy->SetLatencyInfo(latency_info);
- OutputSurface::PostSubBuffer(rect, latency_info);
+ OutputSurface::SwapBuffers(frame);
}
void CompositorOutputSurface::OnMessageReceived(const IPC::Message& message) {
@@ -155,7 +143,7 @@ void CompositorOutputSurface::OnBeginFrame(base::TimeTicks frame_time) {
#endif // defined(OS_ANDROID)
void CompositorOutputSurface::OnSwapAck(const cc::CompositorFrameAck& ack) {
- client_->OnSendFrameToParentCompositorAck(ack);
+ client_->OnSwapBuffersComplete(&ack);
}
bool CompositorOutputSurface::Send(IPC::Message* message) {
diff --git a/content/renderer/gpu/compositor_output_surface.h b/content/renderer/gpu/compositor_output_surface.h
index 7f13852..c1f9077 100644
--- a/content/renderer/gpu/compositor_output_surface.h
+++ b/content/renderer/gpu/compositor_output_surface.h
@@ -44,14 +44,13 @@ class CompositorOutputSurface
CompositorOutputSurface(int32 routing_id,
WebGraphicsContext3DCommandBufferImpl* context3d,
- cc::SoftwareOutputDevice* software);
+ cc::SoftwareOutputDevice* software,
+ bool use_swap_compositor_frame_message);
virtual ~CompositorOutputSurface();
// cc::OutputSurface implementation.
virtual bool BindToClient(cc::OutputSurfaceClient* client) OVERRIDE;
- virtual void SendFrameToParentCompositor(cc::CompositorFrame*) OVERRIDE;
- virtual void PostSubBuffer(gfx::Rect rect, const ui::LatencyInfo&) OVERRIDE;
- virtual void SwapBuffers(const ui::LatencyInfo&) OVERRIDE;
+ virtual void SwapBuffers(cc::CompositorFrame* frame) OVERRIDE;
#if defined(OS_ANDROID)
virtual void SetNeedsBeginFrame(bool enable) OVERRIDE;
#endif
@@ -92,6 +91,8 @@ class CompositorOutputSurface
#endif
bool Send(IPC::Message* message);
+ bool use_swap_compositor_frame_message_;
+
scoped_refptr<IPC::ForwardingMessageFilter> output_surface_filter_;
scoped_refptr<CompositorOutputSurfaceProxy> output_surface_proxy_;
scoped_refptr<IPC::SyncMessageFilter> message_sender_;
diff --git a/content/renderer/gpu/delegated_compositor_output_surface.cc b/content/renderer/gpu/delegated_compositor_output_surface.cc
new file mode 100644
index 0000000..f6949eb
--- /dev/null
+++ b/content/renderer/gpu/delegated_compositor_output_surface.cc
@@ -0,0 +1,18 @@
+// Copyright 2013 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/renderer/gpu/delegated_compositor_output_surface.h"
+
+namespace content {
+
+DelegatedCompositorOutputSurface::DelegatedCompositorOutputSurface(
+ int32 routing_id,
+ WebGraphicsContext3DCommandBufferImpl* context3d,
+ cc::SoftwareOutputDevice* software)
+ : CompositorOutputSurface(routing_id, context3d, software, true) {
+ capabilities_.delegated_rendering = true;
+ capabilities_.max_frames_pending = 1;
+}
+
+} // namespace content
diff --git a/content/renderer/gpu/delegated_compositor_output_surface.h b/content/renderer/gpu/delegated_compositor_output_surface.h
new file mode 100644
index 0000000..774c4c9
--- /dev/null
+++ b/content/renderer/gpu/delegated_compositor_output_surface.h
@@ -0,0 +1,23 @@
+// Copyright 2013 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_RENDERER_GPU_DELEGATED_COMPOSITOR_OUTPUT_SURFACE_H_
+#define CONTENT_RENDERER_GPU_DELEGATED_COMPOSITOR_OUTPUT_SURFACE_H_
+
+#include "content/renderer/gpu/compositor_output_surface.h"
+
+namespace content {
+
+class DelegatedCompositorOutputSurface : public CompositorOutputSurface {
+ public:
+ DelegatedCompositorOutputSurface(
+ int32 routing_id,
+ WebGraphicsContext3DCommandBufferImpl* context3d,
+ cc::SoftwareOutputDevice* software);
+ virtual ~DelegatedCompositorOutputSurface() {}
+};
+
+} // namespace content
+
+#endif // CONTENT_RENDERER_GPU_DELEGATED_COMPOSITOR_OUTPUT_SURFACE_H_
diff --git a/content/renderer/gpu/mailbox_output_surface.cc b/content/renderer/gpu/mailbox_output_surface.cc
index d7b13ce..80e7ed2 100644
--- a/content/renderer/gpu/mailbox_output_surface.cc
+++ b/content/renderer/gpu/mailbox_output_surface.cc
@@ -22,7 +22,7 @@ MailboxOutputSurface::MailboxOutputSurface(
int32 routing_id,
WebGraphicsContext3DCommandBufferImpl* context3D,
cc::SoftwareOutputDevice* software_device)
- : CompositorOutputSurface(routing_id, context3D, software_device),
+ : CompositorOutputSurface(routing_id, context3D, software_device, true),
fbo_(0),
is_backbuffer_discarded_(false) {
pending_textures_.push_back(TransferableFrame());
@@ -123,24 +123,6 @@ void MailboxOutputSurface::BindFramebuffer() {
current_backing_.texture_id, 0);
}
-void MailboxOutputSurface::SendFrameToParentCompositor(
- cc::CompositorFrame* frame) {
- frame->gl_frame_data.reset(new GLFrameData());
-
- DCHECK(!surface_size_.IsEmpty());
- DCHECK(surface_size_ == current_backing_.size);
- DCHECK(!current_backing_.mailbox.IsZero());
-
- frame->gl_frame_data->mailbox = current_backing_.mailbox;
- frame->gl_frame_data->size = current_backing_.size;
- context3d_->flush();
- frame->gl_frame_data->sync_point = context3d_->insertSyncPoint();
- CompositorOutputSurface::SendFrameToParentCompositor(frame);
-
- pending_textures_.push_back(current_backing_);
- current_backing_ = TransferableFrame();
-}
-
void MailboxOutputSurface::OnSwapAck(const cc::CompositorFrameAck& ack) {
if (!ack.gl_frame_data->mailbox.IsZero()) {
DCHECK(!ack.gl_frame_data->size.IsEmpty());
@@ -179,16 +161,24 @@ void MailboxOutputSurface::OnSwapAck(const cc::CompositorFrameAck& ack) {
CompositorOutputSurface::OnSwapAck(ack);
}
-void MailboxOutputSurface::SwapBuffers(const ui::LatencyInfo&) {
-}
-
-void MailboxOutputSurface::PostSubBuffer(gfx::Rect rect,
- const ui::LatencyInfo&) {
- NOTIMPLEMENTED()
+void MailboxOutputSurface::SwapBuffers(cc::CompositorFrame* frame) {
+ DCHECK(frame->gl_frame_data);
+ DCHECK(frame->gl_frame_data->sub_buffer_rect.size() ==
+ frame->gl_frame_data->size)
<< "Partial swap not supported with composite-to-mailbox yet.";
- // The browser only copies damage correctly for two buffers in use.
- DCHECK(GetNumAcksPending() < 2);
+ DCHECK(!surface_size_.IsEmpty());
+ DCHECK(surface_size_ == current_backing_.size);
+ DCHECK(frame->gl_frame_data->size == current_backing_.size);
+ DCHECK(!current_backing_.mailbox.IsZero());
+
+ frame->gl_frame_data->mailbox = current_backing_.mailbox;
+ context3d_->flush();
+ frame->gl_frame_data->sync_point = context3d_->insertSyncPoint();
+ CompositorOutputSurface::SwapBuffers(frame);
+
+ pending_textures_.push_back(current_backing_);
+ current_backing_ = TransferableFrame();
}
size_t MailboxOutputSurface::GetNumAcksPending() {
diff --git a/content/renderer/gpu/mailbox_output_surface.h b/content/renderer/gpu/mailbox_output_surface.h
index 9133c9a..0be4712 100644
--- a/content/renderer/gpu/mailbox_output_surface.h
+++ b/content/renderer/gpu/mailbox_output_surface.h
@@ -29,13 +29,11 @@ class MailboxOutputSurface : public CompositorOutputSurface {
virtual ~MailboxOutputSurface();
// cc::OutputSurface implementation.
- virtual void SendFrameToParentCompositor(cc::CompositorFrame* frame) OVERRIDE;
virtual void EnsureBackbuffer() OVERRIDE;
virtual void DiscardBackbuffer() OVERRIDE;
virtual void Reshape(gfx::Size size, float scale_factor) OVERRIDE;
virtual void BindFramebuffer() OVERRIDE;
- virtual void PostSubBuffer(gfx::Rect rect, const ui::LatencyInfo&) OVERRIDE;
- virtual void SwapBuffers(const ui::LatencyInfo&) OVERRIDE;
+ virtual void SwapBuffers(cc::CompositorFrame* frame) OVERRIDE;
private:
// CompositorOutputSurface overrides.
diff --git a/content/renderer/gpu/render_widget_compositor.cc b/content/renderer/gpu/render_widget_compositor.cc
index cda27ae..69e3778 100644
--- a/content/renderer/gpu/render_widget_compositor.cc
+++ b/content/renderer/gpu/render_widget_compositor.cc
@@ -149,16 +149,10 @@ scoped_ptr<RenderWidgetCompositor> RenderWidgetCompositor::Create(
settings.top_controls_height = controls_height;
}
- settings.compositor_frame_message =
- cmd->HasSwitch(cc::switches::kEnableCompositorFrameMessage) ||
- cmd->HasSwitch(cc::switches::kCompositeToMailbox) ||
- cmd->HasSwitch(switches::kEnableSoftwareCompositingGLAdapter);
-
if (settings.calculate_top_controls_position &&
- (settings.top_controls_height <= 0 ||
- !settings.compositor_frame_message)) {
- DCHECK(false) << "Top controls repositioning enabled without valid height "
- "or compositor_frame_message set.";
+ settings.top_controls_height <= 0) {
+ DCHECK(false)
+ << "Top controls repositioning enabled without valid height set.";
settings.calculate_top_controls_position = false;
}
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index 724b367..8b3e621 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -26,6 +26,7 @@
#include "content/public/common/content_switches.h"
#include "content/renderer/gpu/compositor_output_surface.h"
#include "content/renderer/gpu/compositor_software_output_device.h"
+#include "content/renderer/gpu/delegated_compositor_output_surface.h"
#include "content/renderer/gpu/input_handler_manager.h"
#include "content/renderer/gpu/mailbox_output_surface.h"
#include "content/renderer/gpu/render_widget_compositor.h"
@@ -600,7 +601,7 @@ scoped_ptr<cc::OutputSurface> RenderWidget::CreateOutputSurface() {
if (command_line.HasSwitch(switches::kEnableSoftwareCompositingGLAdapter)) {
return scoped_ptr<cc::OutputSurface>(
new CompositorOutputSurface(routing_id(), NULL,
- new CompositorSoftwareOutputDevice()));
+ new CompositorSoftwareOutputDevice(), true));
}
// Explicitly disable antialiasing for the compositor. As of the time of
@@ -626,14 +627,18 @@ scoped_ptr<cc::OutputSurface> RenderWidget::CreateOutputSurface() {
if (!context)
return scoped_ptr<cc::OutputSurface>();
- bool composite_to_mailbox =
- command_line.HasSwitch(cc::switches::kCompositeToMailbox) &&
- !command_line.HasSwitch(switches::kEnableDelegatedRenderer);
- // No swap throttling yet when compositing on the main thread.
- DCHECK(!composite_to_mailbox || is_threaded_compositing_enabled_);
- return scoped_ptr<cc::OutputSurface>(composite_to_mailbox ?
- new MailboxOutputSurface(routing_id(), context, NULL) :
- new CompositorOutputSurface(routing_id(), context, NULL));
+ if (command_line.HasSwitch(switches::kEnableDelegatedRenderer)) {
+ DCHECK(is_threaded_compositing_enabled_);
+ return scoped_ptr<cc::OutputSurface>(
+ new DelegatedCompositorOutputSurface(routing_id(), context, NULL));
+ }
+ if (command_line.HasSwitch(cc::switches::kCompositeToMailbox)) {
+ DCHECK(is_threaded_compositing_enabled_);
+ return scoped_ptr<cc::OutputSurface>(
+ new MailboxOutputSurface(routing_id(), context, NULL));
+ }
+ return scoped_ptr<cc::OutputSurface>(
+ new CompositorOutputSurface(routing_id(), context, NULL, false));
}
void RenderWidget::OnViewContextSwapBuffersAborted() {