Chromium Code Reviews| Index: content/browser/android/in_process/synchronous_compositor_output_surface.cc |
| diff --git a/content/browser/android/in_process/synchronous_compositor_output_surface.cc b/content/browser/android/in_process/synchronous_compositor_output_surface.cc |
| index de609c3c7eb1a80fef535c4a6482c75afd5eae46..8428a80d958986149e615a984707ed51cdcff781 100644 |
| --- a/content/browser/android/in_process/synchronous_compositor_output_surface.cc |
| +++ b/content/browser/android/in_process/synchronous_compositor_output_surface.cc |
| @@ -13,6 +13,8 @@ |
| #include "cc/output/software_output_device.h" |
| #include "content/browser/android/in_process/synchronous_compositor_impl.h" |
| #include "content/public/browser/browser_thread.h" |
| +#include "content/public/browser/render_process_host.h" |
| +#include "content/renderer/gpu/frame_swap_message_queue.h" |
| #include "gpu/command_buffer/client/gles2_interface.h" |
| #include "gpu/command_buffer/common/gpu_memory_allocation.h" |
| #include "third_party/skia/include/core/SkCanvas.h" |
| @@ -24,6 +26,21 @@ namespace content { |
| namespace { |
| +content::RenderProcessHost* GetInProcessRenderer() { |
| + content::RenderProcessHost::iterator it = |
| + content::RenderProcessHost::AllHostsIterator(); |
| + if (it.IsAtEnd()) { |
| + // There should always be one RPH in single process mode. |
| + NOTREACHED(); |
| + return NULL; |
| + } |
| + |
| + content::RenderProcessHost* rph = it.GetCurrentValue(); |
| + it.Advance(); |
| + DCHECK(it.IsAtEnd()); // Not multiprocess compatible. |
| + return rph; |
| +} |
|
piman
2014/05/20 19:54:05
You may want to check with boliu@ if this is the r
mkosiba (inactive)
2014/05/22 17:40:24
Bo's already on the review. I moved this to Synchr
|
| + |
| void DidActivatePendingTree(int routing_id) { |
| SynchronousCompositorOutputSurfaceDelegate* delegate = |
| SynchronousCompositorImpl::FromRoutingID(routing_id); |
| @@ -65,7 +82,8 @@ class SynchronousCompositorOutputSurface::SoftwareDevice |
| }; |
| SynchronousCompositorOutputSurface::SynchronousCompositorOutputSurface( |
| - int routing_id) |
| + int routing_id, |
| + scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue) |
| : cc::OutputSurface( |
| scoped_ptr<cc::SoftwareOutputDevice>(new SoftwareDevice(this))), |
| routing_id_(routing_id), |
| @@ -75,6 +93,7 @@ SynchronousCompositorOutputSurface::SynchronousCompositorOutputSurface( |
| current_sw_canvas_(NULL), |
| memory_policy_(0), |
| output_surface_client_(NULL), |
| + frame_swap_message_queue_(frame_swap_message_queue), |
| weak_ptr_factory_(this) { |
| capabilities_.deferred_gl_initialization = true; |
| capabilities_.draw_and_swap_full_viewport_every_frame = true; |
| @@ -139,6 +158,20 @@ void SynchronousCompositorOutputSurface::SwapBuffers( |
| DCHECK(context_provider_); |
| context_provider_->ContextGL()->ShallowFlushCHROMIUM(); |
| } |
| + { |
| + // We don't care about the SendMessageScope since we're already on the UI |
| + // thread. |
| + std::vector<IPC::Message> messages_to_deliver_with_frame; |
|
piman
2014/05/20 19:54:05
nit: indent
mkosiba (inactive)
2014/05/22 17:40:24
Done.
|
| + frame_swap_message_queue_->DrainMessages(frame->metadata.source_frame_number, |
| + &messages_to_deliver_with_frame); |
| + RenderProcessHost* rph = GetInProcessRenderer(); |
| + for (std::vector<IPC::Message>::iterator i = |
| + messages_to_deliver_with_frame.begin(); |
| + i != messages_to_deliver_with_frame.end(); |
| + ++i) { |
| + rph->OnMessageReceived(*i); |
| + } |
| + } |
| UpdateFrameMetaData(frame->metadata); |
| did_swap_buffer_ = true; |