| 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/mus_browser_compositor_output_surface.h" | 5 #include "content/browser/compositor/mus_browser_compositor_output_surface.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "cc/output/compositor_frame.h" | 9 #include "cc/output/compositor_frame.h" |
| 10 #include "cc/output/output_surface_frame.h" | 10 #include "cc/output/output_surface_frame.h" |
| 11 #include "cc/quads/render_pass.h" | 11 #include "cc/quads/render_pass.h" |
| 12 #include "cc/quads/texture_draw_quad.h" | 12 #include "cc/quads/texture_draw_quad.h" |
| 13 #include "components/display_compositor/compositor_overlay_candidate_validator.h
" | 13 #include "components/display_compositor/compositor_overlay_candidate_validator.h
" |
| 14 #include "content/common/gpu/client/context_provider_command_buffer.h" | 14 #include "content/common/gpu/client/context_provider_command_buffer.h" |
| 15 #include "gpu/command_buffer/client/gles2_interface.h" | 15 #include "gpu/command_buffer/client/gles2_interface.h" |
| 16 #include "gpu/ipc/client/command_buffer_proxy_impl.h" | 16 #include "gpu/ipc/client/command_buffer_proxy_impl.h" |
| 17 #include "services/ui/public/cpp/window.h" | 17 #include "services/ui/public/cpp/window.h" |
| 18 #include "services/ui/public/cpp/window_compositor_frame_sink.h" | 18 #include "services/ui/public/cpp/window_compositor_frame_sink.h" |
| 19 #include "ui/aura/mus/window_compositor_frame_sink.h" | 19 #include "ui/aura/mus/window_compositor_frame_sink.h" |
| 20 #include "ui/aura/mus/window_port_mus.h" | 20 #include "ui/aura/mus/window_port_mus.h" |
| 21 #include "ui/aura/window.h" | 21 #include "ui/aura/window.h" |
| 22 | 22 |
| 23 namespace content { | 23 namespace content { |
| 24 | 24 |
| 25 MusBrowserCompositorOutputSurface::MusBrowserCompositorOutputSurface( | 25 MusBrowserCompositorOutputSurface::MusBrowserCompositorOutputSurface( |
| 26 ui::Window* window, | 26 ui::Window* window, |
| 27 scoped_refptr<ContextProviderCommandBuffer> context, | 27 scoped_refptr<ContextProviderCommandBuffer> context, |
| 28 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 28 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
| 29 scoped_refptr<ui::CompositorVSyncManager> vsync_manager, | 29 const UpdateVSyncParametersCallback& update_vsync_parameters_callback, |
| 30 cc::SyntheticBeginFrameSource* begin_frame_source, | |
| 31 std::unique_ptr<display_compositor::CompositorOverlayCandidateValidator> | 30 std::unique_ptr<display_compositor::CompositorOverlayCandidateValidator> |
| 32 overlay_candidate_validator) | 31 overlay_candidate_validator) |
| 33 : GpuBrowserCompositorOutputSurface(std::move(context), | 32 : GpuBrowserCompositorOutputSurface(std::move(context), |
| 34 std::move(vsync_manager), | 33 update_vsync_parameters_callback, |
| 35 begin_frame_source, | |
| 36 std::move(overlay_candidate_validator)), | 34 std::move(overlay_candidate_validator)), |
| 37 ui_window_(window) { | 35 ui_window_(window) { |
| 38 ui_compositor_frame_sink_ = ui_window_->RequestCompositorFrameSink( | 36 ui_compositor_frame_sink_ = ui_window_->RequestCompositorFrameSink( |
| 39 ui::mojom::CompositorFrameSinkType::DEFAULT, context, | 37 ui::mojom::CompositorFrameSinkType::DEFAULT, context, |
| 40 gpu_memory_buffer_manager); | 38 gpu_memory_buffer_manager); |
| 41 ui_compositor_frame_sink_->BindToClient(this); | 39 ui_compositor_frame_sink_->BindToClient(this); |
| 42 } | 40 } |
| 43 | 41 |
| 44 MusBrowserCompositorOutputSurface::MusBrowserCompositorOutputSurface( | 42 MusBrowserCompositorOutputSurface::MusBrowserCompositorOutputSurface( |
| 45 aura::Window* window, | 43 aura::Window* window, |
| 46 scoped_refptr<ContextProviderCommandBuffer> context, | 44 scoped_refptr<ContextProviderCommandBuffer> context, |
| 47 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 45 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
| 48 scoped_refptr<ui::CompositorVSyncManager> vsync_manager, | 46 const UpdateVSyncParametersCallback& update_vsync_parameters_callback, |
| 49 cc::SyntheticBeginFrameSource* begin_frame_source, | |
| 50 std::unique_ptr<display_compositor::CompositorOverlayCandidateValidator> | 47 std::unique_ptr<display_compositor::CompositorOverlayCandidateValidator> |
| 51 overlay_candidate_validator) | 48 overlay_candidate_validator) |
| 52 : GpuBrowserCompositorOutputSurface(std::move(context), | 49 : GpuBrowserCompositorOutputSurface(std::move(context), |
| 53 std::move(vsync_manager), | 50 update_vsync_parameters_callback, |
| 54 begin_frame_source, | |
| 55 std::move(overlay_candidate_validator)), | 51 std::move(overlay_candidate_validator)), |
| 56 window_(window) { | 52 window_(window) { |
| 57 aura::WindowPortMus* window_port = aura::WindowPortMus::Get(window_); | 53 aura::WindowPortMus* window_port = aura::WindowPortMus::Get(window_); |
| 58 DCHECK(window_port); | 54 DCHECK(window_port); |
| 59 compositor_frame_sink_ = window_port->RequestCompositorFrameSink( | 55 compositor_frame_sink_ = window_port->RequestCompositorFrameSink( |
| 60 ui::mojom::CompositorFrameSinkType::DEFAULT, context, | 56 ui::mojom::CompositorFrameSinkType::DEFAULT, context, |
| 61 gpu_memory_buffer_manager); | 57 gpu_memory_buffer_manager); |
| 62 compositor_frame_sink_->BindToClient(this); | 58 compositor_frame_sink_->BindToClient(this); |
| 63 } | 59 } |
| 64 | 60 |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 | 196 |
| 201 const gpu::Mailbox& MusBrowserCompositorOutputSurface::GetMailboxFromResourceId( | 197 const gpu::Mailbox& MusBrowserCompositorOutputSurface::GetMailboxFromResourceId( |
| 202 uint32_t id) { | 198 uint32_t id) { |
| 203 DCHECK_LT(id, mailboxes_.size()); | 199 DCHECK_LT(id, mailboxes_.size()); |
| 204 DCHECK(std::find(free_resource_ids_.begin(), free_resource_ids_.end(), id) == | 200 DCHECK(std::find(free_resource_ids_.begin(), free_resource_ids_.end(), id) == |
| 205 free_resource_ids_.end()); | 201 free_resource_ids_.end()); |
| 206 return mailboxes_[id]; | 202 return mailboxes_[id]; |
| 207 } | 203 } |
| 208 | 204 |
| 209 } // namespace content | 205 } // namespace content |
| OLD | NEW |