Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(748)

Unified Diff: services/ui/surfaces/display_compositor.cc

Issue 2654693003: Decouple GpuCompositorFrameSink from DisplayCompositor (Closed)
Patch Set: Refactor code Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « services/ui/surfaces/display_compositor.h ('k') | services/ui/surfaces/gpu_compositor_frame_sink.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/surfaces/display_compositor.cc
diff --git a/services/ui/surfaces/display_compositor.cc b/services/ui/surfaces/display_compositor.cc
index a7d48a911204453ff41b58dfe7c05e51c865a009..4c3e0685f2fa20cfbbbe68fd90e5929863e79429 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,33 +44,12 @@ DisplayCompositor::DisplayCompositor(
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::OnCompositorFrameSinkClientConnectionLost(
+void DisplayCompositor::OnClientConnectionLost(
const cc::FrameSinkId& frame_sink_id,
bool destroy_compositor_frame_sink) {
DCHECK(thread_checker_.CalledOnValidThread());
@@ -81,7 +60,7 @@ void DisplayCompositor::OnCompositorFrameSinkClientConnectionLost(
// client instance to create a new CompositorFrameSink.
}
-void DisplayCompositor::OnCompositorFrameSinkPrivateConnectionLost(
+void DisplayCompositor::OnPrivateConnectionLost(
const cc::FrameSinkId& frame_sink_id,
bool destroy_compositor_frame_sink) {
DCHECK(thread_checker_.CalledOnValidThread());
@@ -107,8 +86,8 @@ void DisplayCompositor::CreateDisplayCompositorFrameSink(
CreateDisplay(frame_sink_id, surface_handle, begin_frame_source.get());
compositor_frame_sinks_[frame_sink_id] =
- base::MakeUnique<GpuDisplayCompositorFrameSink>(
- this, frame_sink_id, std::move(display),
+ base::MakeUnique<display_compositor::GpuDisplayCompositorFrameSink>(
+ this, &manager_, 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));
@@ -123,9 +102,9 @@ void DisplayCompositor::CreateOffscreenCompositorFrameSink(
DCHECK_EQ(0u, compositor_frame_sinks_.count(frame_sink_id));
compositor_frame_sinks_[frame_sink_id] =
- base::MakeUnique<GpuOffscreenCompositorFrameSink>(
- this, frame_sink_id, std::move(request), std::move(private_request),
- std::move(client));
+ base::MakeUnique<display_compositor::GpuOffscreenCompositorFrameSink>(
+ this, &manager_, frame_sink_id, std::move(request),
+ std::move(private_request), std::move(client));
}
std::unique_ptr<cc::Display> DisplayCompositor::CreateDisplay(
« no previous file with comments | « services/ui/surfaces/display_compositor.h ('k') | services/ui/surfaces/gpu_compositor_frame_sink.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698