Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(358)

Unified Diff: content/renderer/gpu/compositor_output_surface.cc

Issue 16304003: Unified OutputSurface::SwapBuffers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Clean up Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/renderer/gpu/compositor_output_surface.cc
diff --git a/content/renderer/gpu/compositor_output_surface.cc b/content/renderer/gpu/compositor_output_surface.cc
index 55af86511874200491b0fe4375394b73aa1c2948..218e8949de290ec38bf618bbc86265780daedef1 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 swap_with_ipc)
: OutputSurface(scoped_ptr<WebKit::WebGraphicsContext3D>(context3D),
make_scoped_ptr(software_device)),
+ swap_with_ipc_(swap_with_ipc),
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,26 @@ 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 (swap_with_ipc_) {
joth 2013/06/10 18:43:32 nit: swap_buffers_via_ipc_ maybe clearer?
aelias_OOO_until_Jul13 2013/06/10 18:57:57 Done.
+ 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->software_frame_data)
joth 2013/06/10 18:43:32 do you need include the base-call here, to get the
aelias_OOO_until_Jul13 2013/06/10 18:57:57 Good catch, changed to call directly from here.
+ return;
+
+ DCHECK(frame->gl_frame_data);
-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);
+ command_buffer_proxy->SetLatencyInfo(frame->metadata.latency_info);
+
+ OutputSurface::SwapBuffers(frame);
}
void CompositorOutputSurface::OnMessageReceived(const IPC::Message& message) {
@@ -155,7 +146,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) {

Powered by Google App Engine
This is Rietveld 408576698