| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "services/ui/surfaces/display_compositor.h" | 5 #include "services/ui/surfaces/display_compositor.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| 11 #include "base/threading/thread_task_runner_handle.h" | 11 #include "base/threading/thread_task_runner_handle.h" |
| 12 #include "cc/base/switches.h" | 12 #include "cc/base/switches.h" |
| 13 #include "cc/output/in_process_context_provider.h" | 13 #include "cc/output/in_process_context_provider.h" |
| 14 #include "cc/output/texture_mailbox_deleter.h" | 14 #include "cc/output/texture_mailbox_deleter.h" |
| 15 #include "cc/surfaces/display.h" | 15 #include "cc/surfaces/display.h" |
| 16 #include "cc/surfaces/display_scheduler.h" | 16 #include "cc/surfaces/display_scheduler.h" |
| 17 #include "cc/surfaces/surface.h" | 17 #include "cc/surfaces/surface.h" |
| 18 #include "components/display_compositor/gpu_display_compositor_frame_sink.h" | 18 #include "components/display_compositor/gpu_compositor_frame_sink.h" |
| 19 #include "components/display_compositor/gpu_offscreen_compositor_frame_sink.h" | 19 #include "components/display_compositor/gpu_root_compositor_frame_sink.h" |
| 20 #include "gpu/command_buffer/client/shared_memory_limits.h" | 20 #include "gpu/command_buffer/client/shared_memory_limits.h" |
| 21 #include "gpu/ipc/gpu_in_process_thread_service.h" | 21 #include "gpu/ipc/gpu_in_process_thread_service.h" |
| 22 #include "mojo/public/cpp/bindings/strong_binding.h" | 22 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 23 #include "services/ui/surfaces/display_output_surface.h" | 23 #include "services/ui/surfaces/display_output_surface.h" |
| 24 | 24 |
| 25 #if defined(USE_OZONE) | 25 #if defined(USE_OZONE) |
| 26 #include "gpu/command_buffer/client/gles2_interface.h" | 26 #include "gpu/command_buffer/client/gles2_interface.h" |
| 27 #include "services/ui/surfaces/display_output_surface_ozone.h" | 27 #include "services/ui/surfaces/display_output_surface_ozone.h" |
| 28 #endif | 28 #endif |
| 29 | 29 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 } | 62 } |
| 63 | 63 |
| 64 void DisplayCompositor::OnPrivateConnectionLost( | 64 void DisplayCompositor::OnPrivateConnectionLost( |
| 65 const cc::FrameSinkId& frame_sink_id, | 65 const cc::FrameSinkId& frame_sink_id, |
| 66 bool destroy_compositor_frame_sink) { | 66 bool destroy_compositor_frame_sink) { |
| 67 DCHECK(thread_checker_.CalledOnValidThread()); | 67 DCHECK(thread_checker_.CalledOnValidThread()); |
| 68 if (destroy_compositor_frame_sink) | 68 if (destroy_compositor_frame_sink) |
| 69 DestroyCompositorFrameSink(frame_sink_id); | 69 DestroyCompositorFrameSink(frame_sink_id); |
| 70 } | 70 } |
| 71 | 71 |
| 72 void DisplayCompositor::CreateDisplayCompositorFrameSink( | 72 void DisplayCompositor::CreateRootCompositorFrameSink( |
| 73 const cc::FrameSinkId& frame_sink_id, | 73 const cc::FrameSinkId& frame_sink_id, |
| 74 gpu::SurfaceHandle surface_handle, | 74 gpu::SurfaceHandle surface_handle, |
| 75 cc::mojom::MojoCompositorFrameSinkAssociatedRequest request, | 75 cc::mojom::MojoCompositorFrameSinkAssociatedRequest request, |
| 76 cc::mojom::MojoCompositorFrameSinkPrivateRequest private_request, | 76 cc::mojom::MojoCompositorFrameSinkPrivateRequest private_request, |
| 77 cc::mojom::MojoCompositorFrameSinkClientPtr client, | 77 cc::mojom::MojoCompositorFrameSinkClientPtr client, |
| 78 cc::mojom::DisplayPrivateAssociatedRequest display_private_request) { | 78 cc::mojom::DisplayPrivateAssociatedRequest display_private_request) { |
| 79 DCHECK(thread_checker_.CalledOnValidThread()); | 79 DCHECK(thread_checker_.CalledOnValidThread()); |
| 80 DCHECK_NE(surface_handle, gpu::kNullSurfaceHandle); | 80 DCHECK_NE(surface_handle, gpu::kNullSurfaceHandle); |
| 81 DCHECK_EQ(0u, compositor_frame_sinks_.count(frame_sink_id)); | 81 DCHECK_EQ(0u, compositor_frame_sinks_.count(frame_sink_id)); |
| 82 | 82 |
| 83 std::unique_ptr<cc::SyntheticBeginFrameSource> begin_frame_source( | 83 std::unique_ptr<cc::SyntheticBeginFrameSource> begin_frame_source( |
| 84 new cc::DelayBasedBeginFrameSource( | 84 new cc::DelayBasedBeginFrameSource( |
| 85 base::MakeUnique<cc::DelayBasedTimeSource>(task_runner_.get()))); | 85 base::MakeUnique<cc::DelayBasedTimeSource>(task_runner_.get()))); |
| 86 std::unique_ptr<cc::Display> display = | 86 std::unique_ptr<cc::Display> display = |
| 87 CreateDisplay(frame_sink_id, surface_handle, begin_frame_source.get()); | 87 CreateDisplay(frame_sink_id, surface_handle, begin_frame_source.get()); |
| 88 | 88 |
| 89 compositor_frame_sinks_[frame_sink_id] = | 89 compositor_frame_sinks_[frame_sink_id] = |
| 90 base::MakeUnique<display_compositor::GpuDisplayCompositorFrameSink>( | 90 base::MakeUnique<display_compositor::GpuRootCompositorFrameSink>( |
| 91 this, &manager_, frame_sink_id, std::move(display), | 91 this, &manager_, frame_sink_id, std::move(display), |
| 92 std::move(begin_frame_source), std::move(request), | 92 std::move(begin_frame_source), std::move(request), |
| 93 std::move(private_request), std::move(client), | 93 std::move(private_request), std::move(client), |
| 94 std::move(display_private_request)); | 94 std::move(display_private_request)); |
| 95 } | 95 } |
| 96 | 96 |
| 97 void DisplayCompositor::CreateOffscreenCompositorFrameSink( | 97 void DisplayCompositor::CreateCompositorFrameSink( |
| 98 const cc::FrameSinkId& frame_sink_id, | 98 const cc::FrameSinkId& frame_sink_id, |
| 99 cc::mojom::MojoCompositorFrameSinkRequest request, | 99 cc::mojom::MojoCompositorFrameSinkRequest request, |
| 100 cc::mojom::MojoCompositorFrameSinkPrivateRequest private_request, | 100 cc::mojom::MojoCompositorFrameSinkPrivateRequest private_request, |
| 101 cc::mojom::MojoCompositorFrameSinkClientPtr client) { | 101 cc::mojom::MojoCompositorFrameSinkClientPtr client) { |
| 102 DCHECK(thread_checker_.CalledOnValidThread()); | 102 DCHECK(thread_checker_.CalledOnValidThread()); |
| 103 DCHECK_EQ(0u, compositor_frame_sinks_.count(frame_sink_id)); | 103 DCHECK_EQ(0u, compositor_frame_sinks_.count(frame_sink_id)); |
| 104 | 104 |
| 105 compositor_frame_sinks_[frame_sink_id] = | 105 compositor_frame_sinks_[frame_sink_id] = |
| 106 base::MakeUnique<display_compositor::GpuOffscreenCompositorFrameSink>( | 106 base::MakeUnique<display_compositor::GpuCompositorFrameSink>( |
| 107 this, &manager_, frame_sink_id, std::move(request), | 107 this, &manager_, frame_sink_id, std::move(request), |
| 108 std::move(private_request), std::move(client)); | 108 std::move(private_request), std::move(client)); |
| 109 } | 109 } |
| 110 | 110 |
| 111 std::unique_ptr<cc::Display> DisplayCompositor::CreateDisplay( | 111 std::unique_ptr<cc::Display> DisplayCompositor::CreateDisplay( |
| 112 const cc::FrameSinkId& frame_sink_id, | 112 const cc::FrameSinkId& frame_sink_id, |
| 113 gpu::SurfaceHandle surface_handle, | 113 gpu::SurfaceHandle surface_handle, |
| 114 cc::SyntheticBeginFrameSource* begin_frame_source) { | 114 cc::SyntheticBeginFrameSource* begin_frame_source) { |
| 115 scoped_refptr<cc::InProcessContextProvider> context_provider = | 115 scoped_refptr<cc::InProcessContextProvider> context_provider = |
| 116 new cc::InProcessContextProvider( | 116 new cc::InProcessContextProvider( |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 DCHECK_GT(surface_info.device_scale_factor(), 0.0f); | 164 DCHECK_GT(surface_info.device_scale_factor(), 0.0f); |
| 165 | 165 |
| 166 if (client_) | 166 if (client_) |
| 167 client_->OnSurfaceCreated(surface_info); | 167 client_->OnSurfaceCreated(surface_info); |
| 168 } | 168 } |
| 169 | 169 |
| 170 void DisplayCompositor::OnSurfaceDamaged(const cc::SurfaceId& surface_id, | 170 void DisplayCompositor::OnSurfaceDamaged(const cc::SurfaceId& surface_id, |
| 171 bool* changed) {} | 171 bool* changed) {} |
| 172 | 172 |
| 173 } // namespace ui | 173 } // namespace ui |
| OLD | NEW |