| Index: services/ui/surfaces/display_compositor.cc
|
| diff --git a/services/ui/surfaces/display_compositor.cc b/services/ui/surfaces/display_compositor.cc
|
| index 4c3e0685f2fa20cfbbbe68fd90e5929863e79429..a7d48a911204453ff41b58dfe7c05e51c865a009 100644
|
| --- a/services/ui/surfaces/display_compositor.cc
|
| +++ b/services/ui/surfaces/display_compositor.cc
|
| @@ -13,12 +13,12 @@
|
| #include "cc/surfaces/display.h"
|
| #include "cc/surfaces/display_scheduler.h"
|
| #include "cc/surfaces/surface.h"
|
| -#include "components/display_compositor/gpu_display_compositor_frame_sink.h"
|
| -#include "components/display_compositor/gpu_offscreen_compositor_frame_sink.h"
|
| #include "gpu/command_buffer/client/shared_memory_limits.h"
|
| #include "gpu/ipc/gpu_in_process_thread_service.h"
|
| #include "mojo/public/cpp/bindings/strong_binding.h"
|
| #include "services/ui/surfaces/display_output_surface.h"
|
| +#include "services/ui/surfaces/gpu_display_compositor_frame_sink.h"
|
| +#include "services/ui/surfaces/gpu_offscreen_compositor_frame_sink.h"
|
|
|
| #if defined(USE_OZONE)
|
| #include "gpu/command_buffer/client/gles2_interface.h"
|
| @@ -44,12 +44,33 @@
|
| manager_.AddObserver(this);
|
| }
|
|
|
| +void DisplayCompositor::AddSurfaceReferences(
|
| + const std::vector<cc::SurfaceReference>& references) {
|
| + DCHECK(thread_checker_.CalledOnValidThread());
|
| + for (const auto& reference : references) {
|
| + reference_manager_->AddSurfaceReference(reference.parent_id(),
|
| + reference.child_id());
|
| + }
|
| +}
|
| +
|
| +void DisplayCompositor::RemoveSurfaceReferences(
|
| + const std::vector<cc::SurfaceReference>& references) {
|
| + DCHECK(thread_checker_.CalledOnValidThread());
|
| +
|
| + // TODO(kylechar): Each remove reference can trigger GC, it would be better if
|
| + // we GC only once if removing multiple references.
|
| + for (const auto& reference : references) {
|
| + reference_manager_->RemoveSurfaceReference(reference.parent_id(),
|
| + reference.child_id());
|
| + }
|
| +}
|
| +
|
| DisplayCompositor::~DisplayCompositor() {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
| manager_.RemoveObserver(this);
|
| }
|
|
|
| -void DisplayCompositor::OnClientConnectionLost(
|
| +void DisplayCompositor::OnCompositorFrameSinkClientConnectionLost(
|
| const cc::FrameSinkId& frame_sink_id,
|
| bool destroy_compositor_frame_sink) {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
| @@ -60,7 +81,7 @@
|
| // client instance to create a new CompositorFrameSink.
|
| }
|
|
|
| -void DisplayCompositor::OnPrivateConnectionLost(
|
| +void DisplayCompositor::OnCompositorFrameSinkPrivateConnectionLost(
|
| const cc::FrameSinkId& frame_sink_id,
|
| bool destroy_compositor_frame_sink) {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
| @@ -86,8 +107,8 @@
|
| CreateDisplay(frame_sink_id, surface_handle, begin_frame_source.get());
|
|
|
| compositor_frame_sinks_[frame_sink_id] =
|
| - base::MakeUnique<display_compositor::GpuDisplayCompositorFrameSink>(
|
| - this, &manager_, frame_sink_id, std::move(display),
|
| + base::MakeUnique<GpuDisplayCompositorFrameSink>(
|
| + this, frame_sink_id, std::move(display),
|
| std::move(begin_frame_source), std::move(request),
|
| std::move(private_request), std::move(client),
|
| std::move(display_private_request));
|
| @@ -102,9 +123,9 @@
|
| DCHECK_EQ(0u, compositor_frame_sinks_.count(frame_sink_id));
|
|
|
| compositor_frame_sinks_[frame_sink_id] =
|
| - base::MakeUnique<display_compositor::GpuOffscreenCompositorFrameSink>(
|
| - this, &manager_, frame_sink_id, std::move(request),
|
| - std::move(private_request), std::move(client));
|
| + base::MakeUnique<GpuOffscreenCompositorFrameSink>(
|
| + this, frame_sink_id, std::move(request), std::move(private_request),
|
| + std::move(client));
|
| }
|
|
|
| std::unique_ptr<cc::Display> DisplayCompositor::CreateDisplay(
|
|
|