Index: content/renderer/render_widget.cc |
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc |
index 521b3306ae5de6507c109096674df0c8ef2e8209..acffff9baee43513ed45d655e595cca3a191432b 100644 |
--- a/content/renderer/render_widget.cc |
+++ b/content/renderer/render_widget.cc |
@@ -57,8 +57,10 @@ |
#include "webkit/plugins/npapi/webplugin.h" |
#include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
#include "webkit/renderer/compositor_bindings/web_rendering_stats_impl.h" |
+#include "webkit/renderer/compositor_bindings/web_to_ccinput_handler_adapter.h" |
#if defined(OS_ANDROID) |
+#include "content/renderer/android/synchronous_compositor_impl.h" |
#include "content/renderer/android/synchronous_compositor_output_surface.h" |
#endif |
@@ -582,12 +584,9 @@ bool RenderWidget::ForceCompositingModeEnabled() { |
scoped_ptr<cc::OutputSurface> RenderWidget::CreateOutputSurface() { |
const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
-#if defined(OS_ANDROID) |
- if (command_line.HasSwitch(switches::kEnableSynchronousRendererCompositor)) { |
- return scoped_ptr<cc::OutputSurface>( |
- new SynchronousCompositorOutputSurface(routing_id())); |
+ if (GetSynchronousCompositor()) { |
+ return GetSynchronousCompositor()->CreateOutputSurface(); |
} |
-#endif |
if (command_line.HasSwitch(switches::kEnableSoftwareCompositingGLAdapter)) { |
return scoped_ptr<cc::OutputSurface>( |
@@ -626,6 +625,18 @@ scoped_ptr<cc::OutputSurface> RenderWidget::CreateOutputSurface() { |
new CompositorOutputSurface(routing_id(), context, NULL)); |
} |
+SynchronousCompositorImpl* RenderWidget::GetSynchronousCompositor() { |
+#if defined(OS_ANDROID) |
+ const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
+ if (command_line.HasSwitch(switches::kEnableSynchronousRendererCompositor)) { |
+ synchronous_compositor_.reset(new SynchronousCompositorImpl(routing_id())); |
+ } |
+ return synchronous_compositor_.get(); |
+#else |
+ return NULL; |
+#endif |
+} |
+ |
void RenderWidget::OnViewContextSwapBuffersAborted() { |
TRACE_EVENT0("renderer", "RenderWidget::OnSwapBuffersAborted"); |
while (!updates_pending_swap_.empty()) { |
@@ -1448,6 +1459,13 @@ void RenderWidget::didActivateCompositor(int input_handler_identifier) { |
} |
#endif |
+#if defined(OS_ANDROID) |
+ if (GetSynchronousCompositor()) { |
+ GetSynchronousCompositor()->didCreateInputHandler( |
+ compositor_->GetInputHandler()); |
+ } |
+#endif |
+ |
is_accelerated_compositing_active_ = true; |
Send(new ViewHostMsg_DidActivateAcceleratedCompositing( |
routing_id_, is_accelerated_compositing_active_)); |