| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/compositor/gpu_output_surface_mac.h" | 5 #include "content/browser/compositor/gpu_output_surface_mac.h" |
| 6 | 6 |
| 7 #include "cc/output/compositor_frame.h" | 7 #include "cc/output/compositor_frame.h" |
| 8 #include "components/display_compositor/compositor_overlay_candidate_validator.h
" | 8 #include "components/display_compositor/compositor_overlay_candidate_validator.h
" |
| 9 #include "content/browser/gpu/gpu_surface_tracker.h" | 9 #include "content/browser/gpu/gpu_surface_tracker.h" |
| 10 #include "content/common/gpu/client/context_provider_command_buffer.h" | 10 #include "content/common/gpu/client/context_provider_command_buffer.h" |
| 11 #include "gpu/GLES2/gl2extchromium.h" | 11 #include "gpu/GLES2/gl2extchromium.h" |
| 12 #include "gpu/ipc/client/gpu_process_hosted_ca_layer_tree_params.h" | 12 #include "gpu/ipc/client/gpu_process_hosted_ca_layer_tree_params.h" |
| 13 #include "ui/accelerated_widget_mac/accelerated_widget_mac.h" | 13 #include "ui/accelerated_widget_mac/accelerated_widget_mac.h" |
| 14 #include "ui/base/cocoa/remote_layer_api.h" | 14 #include "ui/base/cocoa/remote_layer_api.h" |
| 15 #include "ui/display/types/display_snapshot.h" |
| 15 #include "ui/gfx/mac/io_surface.h" | 16 #include "ui/gfx/mac/io_surface.h" |
| 16 | 17 |
| 17 namespace content { | 18 namespace content { |
| 18 | 19 |
| 19 struct GpuOutputSurfaceMac::RemoteLayers { | 20 struct GpuOutputSurfaceMac::RemoteLayers { |
| 20 void UpdateLayers(CAContextID content_ca_context_id, | 21 void UpdateLayers(CAContextID content_ca_context_id, |
| 21 CAContextID fullscreen_low_power_ca_context_id) { | 22 CAContextID fullscreen_low_power_ca_context_id) { |
| 22 if (content_ca_context_id) { | 23 if (content_ca_context_id) { |
| 23 if ([content_layer contextId] != content_ca_context_id) { | 24 if ([content_layer contextId] != content_ca_context_id) { |
| 24 content_layer.reset([[CALayerHost alloc] init]); | 25 content_layer.reset([[CALayerHost alloc] init]); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 55 overlay_candidate_validator, | 56 overlay_candidate_validator, |
| 56 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager) | 57 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager) |
| 57 : GpuSurfacelessBrowserCompositorOutputSurface( | 58 : GpuSurfacelessBrowserCompositorOutputSurface( |
| 58 std::move(context), | 59 std::move(context), |
| 59 surface_handle, | 60 surface_handle, |
| 60 std::move(vsync_manager), | 61 std::move(vsync_manager), |
| 61 begin_frame_source, | 62 begin_frame_source, |
| 62 std::move(overlay_candidate_validator), | 63 std::move(overlay_candidate_validator), |
| 63 GL_TEXTURE_RECTANGLE_ARB, | 64 GL_TEXTURE_RECTANGLE_ARB, |
| 64 GL_RGBA, | 65 GL_RGBA, |
| 66 gfx::BufferFormat::RGBA_8888, |
| 65 gpu_memory_buffer_manager), | 67 gpu_memory_buffer_manager), |
| 66 remote_layers_(new RemoteLayers) {} | 68 remote_layers_(new RemoteLayers) {} |
| 67 | 69 |
| 68 GpuOutputSurfaceMac::~GpuOutputSurfaceMac() {} | 70 GpuOutputSurfaceMac::~GpuOutputSurfaceMac() {} |
| 69 | 71 |
| 70 void GpuOutputSurfaceMac::SwapBuffers(cc::CompositorFrame frame) { | 72 void GpuOutputSurfaceMac::SwapBuffers(cc::CompositorFrame frame) { |
| 71 GpuSurfacelessBrowserCompositorOutputSurface::SwapBuffers(std::move(frame)); | 73 GpuSurfacelessBrowserCompositorOutputSurface::SwapBuffers(std::move(frame)); |
| 72 | 74 |
| 73 if (should_show_frames_state_ == | 75 if (should_show_frames_state_ == |
| 74 SHOULD_NOT_SHOW_FRAMES_NO_SWAP_AFTER_SUSPENDED) { | 76 SHOULD_NOT_SHOW_FRAMES_NO_SWAP_AFTER_SUSPENDED) { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 SHOULD_NOT_SHOW_FRAMES_NO_SWAP_AFTER_SUSPENDED; | 132 SHOULD_NOT_SHOW_FRAMES_NO_SWAP_AFTER_SUSPENDED; |
| 131 } | 133 } |
| 132 } | 134 } |
| 133 } | 135 } |
| 134 | 136 |
| 135 bool GpuOutputSurfaceMac::SurfaceIsSuspendForRecycle() const { | 137 bool GpuOutputSurfaceMac::SurfaceIsSuspendForRecycle() const { |
| 136 return should_show_frames_state_ == SHOULD_NOT_SHOW_FRAMES_SUSPENDED; | 138 return should_show_frames_state_ == SHOULD_NOT_SHOW_FRAMES_SUSPENDED; |
| 137 } | 139 } |
| 138 | 140 |
| 139 } // namespace content | 141 } // namespace content |
| OLD | NEW |