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 1f1257ebd612ddc75dc02560bf43563d461d3f62..36e11aae3e78f8455d722f8ffeebfa0602958d3a 100644 |
--- a/content/renderer/gpu/compositor_output_surface.cc |
+++ b/content/renderer/gpu/compositor_output_surface.cc |
@@ -4,11 +4,14 @@ |
#include "content/renderer/gpu/compositor_output_surface.h" |
+#include "base/command_line.h" |
#include "base/message_loop_proxy.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" |
@@ -20,7 +23,10 @@ using WebKit::WebGraphicsContext3D; |
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); |
@@ -35,7 +41,9 @@ CompositorOutputSurface::CompositorOutputSurface( |
, routing_id_(routing_id) |
, context3D_(context3D) { |
DCHECK(output_surface_filter_); |
- capabilities_.hasParentCompositor = false; |
+ CommandLine* command_line = CommandLine::ForCurrentProcess(); |
+ capabilities_.hasParentCompositor = command_line->HasSwitch( |
+ switches::kEnableDelegatedRenderer); |
DetachFromThread(); |
} |
@@ -75,9 +83,9 @@ WebGraphicsContext3D* CompositorOutputSurface::context3D() const { |
} |
void CompositorOutputSurface::sendFrameToParentCompositor( |
- const WebKit::WebCompositorFrame&) { |
+ const WebKit::WebCompositorFrame& frame) { |
DCHECK(CalledOnValidThread()); |
- NOTREACHED(); |
+ Send(new ViewHostMsg_SwapCompositorFrame(routing_id_, frame)); |
} |
void CompositorOutputSurface::OnMessageReceived(const IPC::Message& message) { |
@@ -86,6 +94,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() |
} |
@@ -100,3 +109,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); |
+} |