Chromium Code Reviews| Index: content/browser/compositor/gpu_output_surface_mac.mm |
| diff --git a/content/browser/compositor/gpu_output_surface_mac.mm b/content/browser/compositor/gpu_output_surface_mac.mm |
| index c8be0c5fc233cb9fef21616a42864531139b1593..4b8ad2054ca3594c75e5717149c92adc10cafe1b 100644 |
| --- a/content/browser/compositor/gpu_output_surface_mac.mm |
| +++ b/content/browser/compositor/gpu_output_surface_mac.mm |
| @@ -15,6 +15,36 @@ |
| namespace content { |
| +class GpuOutputSurfaceMac::GpuOutputSurfaceMac::RemoteLayers { |
|
tapted
2016/05/27 00:33:19
I think one of the GpuOutputSurfaceMac:: isn't nee
ccameron
2016/06/03 02:43:01
I'm amazed that compiles. Fixed.
|
| + public: |
| + void UpdateLayers(CAContextID content_ca_context_id, |
| + CAContextID fullscreen_low_power_ca_context_id) { |
| + if (content_ca_context_id) { |
| + if ([content_layer contextId] != content_ca_context_id) { |
| + content_layer.reset([[CALayerHost alloc] init]); |
| + [content_layer setContextId:content_ca_context_id]; |
| + [content_layer |
| + setAutoresizingMask:kCALayerMaxXMargin | kCALayerMaxYMargin]; |
| + } |
| + } else { |
| + content_layer.reset(); |
| + } |
| + |
| + if (fullscreen_low_power_ca_context_id) { |
| + if ([fullscreen_low_power_layer contextId] != |
| + fullscreen_low_power_ca_context_id) { |
| + fullscreen_low_power_layer.reset([[CALayerHost alloc] init]); |
| + [fullscreen_low_power_layer |
| + setContextId:fullscreen_low_power_ca_context_id]; |
| + } |
| + } else { |
| + fullscreen_low_power_layer.reset(); |
| + } |
| + } |
| + base::scoped_nsobject<CALayerHost> content_layer; |
|
tapted
2016/05/27 00:33:19
nit: blank line before
ccameron
2016/06/03 02:43:01
Done.
|
| + base::scoped_nsobject<CALayerHost> fullscreen_low_power_layer; |
| +}; |
| + |
| GpuOutputSurfaceMac::GpuOutputSurfaceMac( |
| scoped_refptr<ContextProviderCommandBuffer> context, |
| gpu::SurfaceHandle surface_handle, |
| @@ -31,7 +61,8 @@ |
| std::move(overlay_candidate_validator), |
| GL_TEXTURE_RECTANGLE_ARB, |
| GL_RGBA, |
| - gpu_memory_buffer_manager) {} |
| + gpu_memory_buffer_manager), |
| + remote_layers_(new RemoteLayers) {} |
| GpuOutputSurfaceMac::~GpuOutputSurfaceMac() {} |
| @@ -48,15 +79,25 @@ |
| const std::vector<ui::LatencyInfo>& latency_info, |
| gfx::SwapResult result, |
| const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac) { |
| + remote_layers_->UpdateLayers(params_mac->ca_context_id, |
| + params_mac->fullscreen_low_power_ca_context_id); |
| if (should_show_frames_state_ == SHOULD_SHOW_FRAMES) { |
| - gfx::AcceleratedWidget native_widget = |
| + ui::AcceleratedWidgetMac* widget = ui::AcceleratedWidgetMac::Get( |
| content::GpuSurfaceTracker::Get()->AcquireNativeWidget( |
| - params_mac->surface_handle); |
| - ui::AcceleratedWidgetMacGotFrame( |
| - native_widget, params_mac->ca_context_id, |
| - params_mac->fullscreen_low_power_ca_context_valid, |
| - params_mac->fullscreen_low_power_ca_context_id, params_mac->io_surface, |
| - params_mac->pixel_size, params_mac->scale_factor, nullptr, nullptr); |
| + params_mac->surface_handle)); |
| + if (widget) { |
| + if (remote_layers_->content_layer) { |
| + widget->GotCALayerFrame( |
| + remote_layers_->content_layer, |
| + params_mac->fullscreen_low_power_ca_context_valid, |
| + remote_layers_->fullscreen_low_power_layer, params_mac->pixel_size, |
| + params_mac->scale_factor); |
| + } else { |
| + widget->GotIOSurfaceFrame(params_mac->io_surface, |
| + params_mac->pixel_size, |
| + params_mac->scale_factor); |
| + } |
| + } |
| } |
| GpuSurfacelessBrowserCompositorOutputSurface::OnGpuSwapBuffersCompleted( |
| latency_info, result, params_mac); |