Android Webview IPC-based sync compositing

Existing browser-renderer call path uses
SynchronousCompositorImpl to cross the logical process boundary:

[BrowserViewRenderer, RenderWidgetHostViewAndroid]
<-> SynchronousCompositorImpl <->
[SynchronousCompositorOutputSurface,
 SynchronousCompositorExternalBeginFrameSource]

New call path, added behind kIPCSyncCompositing switch essentially
replaces SynchronousCompositorImpl with actual IPC code. New call
path looks like this:

[BrowserViewRenderer, RenderWidgetHostViewAndroid]
<-> SynchronousCompositorHost <-> IPC
<-> SynchronousCompositorFilter
<-> SynchronousCompositorProxy <->
[SynchronousCompositorOutputSurface,
 SynchronousCompositorExternalBeginFrameSource]

Browser side:

Introduce SynchronousCompositorBase which adds methods used by RWHVA.

Add SynchronousCompositorHost which instead of calling to renderer
directly, uses sync IPCs instead.

Renderer side:

Add SynchronousCompositorFilter which is responsible for filtering sync
compositing messages and sending them to compositor thread. The filter
doubles as the SynchronousCompositorRegistry implementation. Filter is
owned by RenderThreadImpl so should outlive all other objects and the
compositor thread itself.

Add SynchronousCompositorProxy. This takes the place of
SynchronousCompositorImpl for the single-process path; the proxy is the
client for OutputSurface and BeginFrameSource. Proxy also receives sync
IPC from SynchronousCompositorHost and send replies and async IPCs back.
Proxy is used on the compositor thread only. Proxy lifetime is
controlled by the filter (registry) and is outlived by both
OutputSurface and BeginFrameSource so life time management is simple.

OutputSurface and BeginFrameSource are re-used.

IPCs:

There are common browser and renderer states that are sent on each
message from and to browser side. There is a versioning system for the
renderer state since messages may arrive out of order on the browser side.

BUG=526842

Review URL: https://codereview.chromium.org/1408123005

Cr-Commit-Position: refs/heads/master@{#357955}
diff --git a/content/renderer/render_thread_impl.h b/content/renderer/render_thread_impl.h
index f7eef237..0683487 100644
--- a/content/renderer/render_thread_impl.h
+++ b/content/renderer/render_thread_impl.h
@@ -115,6 +115,10 @@
 class WebGraphicsContext3DCommandBufferImpl;
 class WebRTCIdentityService;
 
+#if defined(OS_ANDROID)
+class SynchronousCompositorFilter;
+#endif
+
 #if defined(COMPILER_MSVC)
 // See explanation for other RenderViewHostImpl which is the same issue.
 #pragma warning(push)
@@ -280,6 +284,10 @@
   RendererDemuxerAndroid* renderer_demuxer() {
     return renderer_demuxer_.get();
   }
+
+  SynchronousCompositorFilter* sync_compositor_message_filter() {
+    return sync_compositor_message_filter_.get();
+  }
 #endif
 
   // Creates the embedder implementation of WebMediaStreamCenter.
@@ -602,6 +610,10 @@
   scoped_ptr<InputHandlerManager> input_handler_manager_;
   scoped_refptr<CompositorForwardingMessageFilter> compositor_message_filter_;
 
+#if defined(OS_ANDROID)
+  scoped_refptr<SynchronousCompositorFilter> sync_compositor_message_filter_;
+#endif
+
   scoped_refptr<BluetoothMessageFilter> bluetooth_message_filter_;
 
   scoped_refptr<cc_blink::ContextProviderWebContext>