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 e50a1e93aa420458328ac9fa3628bb0006a3db65..8671509907758cce8d4d74187a94af9676261bb3 100644 |
--- a/content/renderer/gpu/compositor_output_surface.cc |
+++ b/content/renderer/gpu/compositor_output_surface.cc |
@@ -4,11 +4,15 @@ |
#include "content/renderer/gpu/compositor_output_surface.h" |
+#include "base/command_line.h" |
#include "base/message_loop_proxy.h" |
+#include "cc/compositor_frame.h" |
#include "content/common/view_messages.h" |
+#include "content/public/common/content_switches.h" |
#include "content/renderer/render_thread_impl.h" |
#include "ipc/ipc_forwarding_message_filter.h" |
#include "ipc/ipc_sync_channel.h" |
+#include "ipc/ipc_sync_message_filter.h" |
#include "third_party/WebKit/Source/Platform/chromium/public/WebCompositorOutputSurfaceClient.h" |
#include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3D.h" |
@@ -21,7 +25,10 @@ using WebKit::WebCompositorSoftwareOutputDevice; |
IPC::ForwardingMessageFilter* CompositorOutputSurface::CreateFilter( |
base::TaskRunner* target_task_runner) |
{ |
- uint32 messages_to_filter[] = {ViewMsg_UpdateVSyncParameters::ID}; |
+ uint32 messages_to_filter[] = { |
+ ViewMsg_UpdateVSyncParameters::ID, |
+ ViewMsg_SwapCompositorFrameACK::ID, |
+ }; |
return new IPC::ForwardingMessageFilter( |
messages_to_filter, arraysize(messages_to_filter), |
target_task_runner); |
@@ -38,7 +45,9 @@ CompositorOutputSurface::CompositorOutputSurface( |
context3D_(context3D), |
software_device_(software_device) { |
DCHECK(output_surface_filter_); |
- capabilities_.hasParentCompositor = false; |
+ CommandLine* command_line = CommandLine::ForCurrentProcess(); |
+ capabilities_.hasParentCompositor = command_line->HasSwitch( |
+ switches::kEnableDelegatedRenderer); |
DetachFromThread(); |
} |
@@ -87,9 +96,11 @@ WebCompositorSoftwareOutputDevice* CompositorOutputSurface::softwareDevice() |
} |
void CompositorOutputSurface::sendFrameToParentCompositor( |
- const WebKit::WebCompositorFrame&) { |
+ const WebKit::WebCompositorFrame& webFrame) { |
DCHECK(CalledOnValidThread()); |
- NOTREACHED(); |
+ const cc::CompositorFrame& frame = |
+ static_cast<const cc::CompositorFrame&>(webFrame); |
+ Send(new ViewHostMsg_SwapCompositorFrame(routing_id_, frame)); |
} |
void CompositorOutputSurface::OnMessageReceived(const IPC::Message& message) { |
@@ -98,6 +109,7 @@ void CompositorOutputSurface::OnMessageReceived(const IPC::Message& message) { |
return; |
IPC_BEGIN_MESSAGE_MAP(CompositorOutputSurface, message) |
IPC_MESSAGE_HANDLER(ViewMsg_UpdateVSyncParameters, OnUpdateVSyncParameters); |
+ IPC_MESSAGE_HANDLER(ViewMsg_SwapCompositorFrameACK, OnSwapCompositorFrameACK); |
IPC_END_MESSAGE_MAP() |
} |
@@ -112,3 +124,12 @@ void CompositorOutputSurface::OnUpdateVSyncParameters( |
static_cast<double>(base::Time::kMicrosecondsPerSecond); |
client_->onVSyncParametersChanged(monotonicTimebase, intervalInSeconds); |
} |
+ |
+void CompositorOutputSurface::OnSwapCompositorFrameACK( |
+ const WebKit::WebCompositorFrameAck& ack) { |
+ client_->onSendFrameToParentCompositorAck(ack); |
+} |
+ |
+bool CompositorOutputSurface::Send(IPC::Message* message) { |
+ return ChildThread::current()->sync_message_filter()->Send(message); |
+} |