Index: content/browser/renderer_host/render_widget_host_view_aura.cc |
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc |
index 5c2bc7bcb4f6c6a79be3fa1a69b5a9ef0d0d519a..2d55308104ca3d4e26bb2e88f295e2115e8f26e6 100644 |
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc |
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc |
@@ -11,6 +11,8 @@ |
#include "base/logging.h" |
#include "base/message_loop.h" |
#include "base/string_number_conversions.h" |
+#include "cc/compositor_frame.h" |
+#include "cc/switches.h" |
#include "content/browser/renderer_host/backing_store_aura.h" |
#include "content/browser/renderer_host/dip_util.h" |
#include "content/browser/renderer_host/overscroll_controller.h" |
@@ -878,10 +880,44 @@ void RenderWidgetHostViewAura::SwapBuffersCompleted( |
void RenderWidgetHostViewAura::AcceleratedSurfaceBuffersSwapped( |
const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params_in_pixel, |
int gpu_host_id) { |
- const gfx::Rect surface_rect = gfx::Rect(gfx::Point(), params_in_pixel.size); |
- BufferPresentedParams ack_params(params_in_pixel.route_id, gpu_host_id); |
+ BuffersSwapped(params_in_pixel.size, params_in_pixel.mailbox_name, |
+ params_in_pixel.route_id, gpu_host_id); |
+} |
+ |
+void RenderWidgetHostViewAura::OnSwapCompositorFrame( |
+ const cc::CompositorFrame& frame, int render_host_id, int route_id) { |
+ static bool composite_to_mailbox = |
+ CommandLine::ForCurrentProcess()->HasSwitch( |
+ cc::switches::kCompositeToMailbox); |
piman
2013/01/18 02:14:11
Do we need to test the command line here? Should w
no sievers
2013/02/06 23:36:00
Done.
|
+ if (!composite_to_mailbox) |
+ return; |
+ |
+ DCHECK(!frame.gl_frame_data->size.IsEmpty()); |
+ DCHECK(!frame.gl_frame_data->mailbox.isZero()); |
+ DCHECK(frame.gl_frame_data->sync_point); |
+ |
+ ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); |
+ factory->WaitSyncPoint(frame.gl_frame_data->sync_point); |
+ |
+ std::string mailbox_name; |
+ mailbox_name.assign( |
piman
2013/01/18 02:14:11
nit: you can just use the constructor with the sam
no sievers
2013/02/06 23:36:00
Done.
|
+ reinterpret_cast<const char*>(frame.gl_frame_data->mailbox.name), |
+ sizeof(frame.gl_frame_data->mailbox.name)); |
+ BuffersSwapped(frame.gl_frame_data->size, |
+ mailbox_name, |
+ route_id, |
+ render_host_id); |
+} |
+ |
+void RenderWidgetHostViewAura::BuffersSwapped( |
+ const gfx::Size& size, |
+ const std::string& mailbox_name, |
+ int route_id, |
+ int host_id) { |
+ const gfx::Rect surface_rect = gfx::Rect(gfx::Point(), size); |
+ BufferPresentedParams ack_params(route_id, host_id); |
if (!SwapBuffersPrepare( |
- surface_rect, surface_rect, params_in_pixel.mailbox_name, &ack_params)) |
+ surface_rect, surface_rect, mailbox_name, &ack_params)) |
return; |
previous_damage_.setRect(RectToSkIRect(surface_rect)); |
@@ -889,7 +925,7 @@ void RenderWidgetHostViewAura::AcceleratedSurfaceBuffersSwapped( |
ui::Compositor* compositor = GetCompositor(); |
if (compositor) { |
- gfx::Size surface_size = ConvertSizeToDIP(this, params_in_pixel.size); |
+ gfx::Size surface_size = ConvertSizeToDIP(this, size); |
window_->SchedulePaintInRect(gfx::Rect(surface_size)); |
} |