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

Unified Diff: components/display_compositor/gpu_compositor_frame_sink.cc

Issue 2651283004: Reland of "Decouple GpuCompositorFrameSink from DisplayCompositor" (Closed)
Patch Set: 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
Index: components/display_compositor/gpu_compositor_frame_sink.cc
diff --git a/services/ui/surfaces/gpu_compositor_frame_sink.cc b/components/display_compositor/gpu_compositor_frame_sink.cc
similarity index 82%
rename from services/ui/surfaces/gpu_compositor_frame_sink.cc
rename to components/display_compositor/gpu_compositor_frame_sink.cc
index 4b472776b264e9802b1bd8c2687cb6661e3178a1..02b38f9d039573ff070e3942e50439932b8ca79c 100644
--- a/services/ui/surfaces/gpu_compositor_frame_sink.cc
+++ b/components/display_compositor/gpu_compositor_frame_sink.cc
@@ -2,27 +2,28 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "services/ui/surfaces/gpu_compositor_frame_sink.h"
+#include "components/display_compositor/gpu_compositor_frame_sink.h"
#include "cc/surfaces/surface_reference.h"
-#include "services/ui/surfaces/display_compositor.h"
-namespace ui {
+namespace display_compositor {
GpuCompositorFrameSink::GpuCompositorFrameSink(
- DisplayCompositor* display_compositor,
+ GpuCompositorFrameSinkDelegate* delegate,
+ cc::SurfaceManager* surface_manager,
const cc::FrameSinkId& frame_sink_id,
std::unique_ptr<cc::Display> display,
std::unique_ptr<cc::BeginFrameSource> begin_frame_source,
cc::mojom::MojoCompositorFrameSinkPrivateRequest
compositor_frame_sink_private_request,
cc::mojom::MojoCompositorFrameSinkClientPtr client)
- : display_compositor_(display_compositor),
+ : delegate_(delegate),
support_(this,
- display_compositor->manager(),
+ surface_manager,
frame_sink_id,
std::move(display),
std::move(begin_frame_source)),
+ surface_manager_(surface_manager),
surface_tracker_(frame_sink_id),
client_(std::move(client)),
compositor_frame_sink_private_binding_(
@@ -38,10 +39,10 @@ GpuCompositorFrameSink::~GpuCompositorFrameSink() {
// indicate the display root surface is no longer visible.
if (support_.display() && surface_tracker_.current_surface_id().is_valid()) {
const cc::SurfaceId top_level_root_surface_id =
- display_compositor_->manager()->GetRootSurfaceId();
+ surface_manager_->GetRootSurfaceId();
std::vector<cc::SurfaceReference> references_to_remove{cc::SurfaceReference(
top_level_root_surface_id, surface_tracker_.current_surface_id())};
- display_compositor_->RemoveSurfaceReferences(references_to_remove);
+ surface_manager_->RemoveSurfaceReferences(references_to_remove);
}
}
@@ -59,6 +60,8 @@ void GpuCompositorFrameSink::SubmitCompositorFrame(
cc::SurfaceId start_surface_id = surface_tracker_.current_surface_id();
surface_tracker_.UpdateReferences(local_frame_id,
frame.metadata.referenced_surfaces);
+ // TODO(kylechar): Move adding top-level root references to
+ // GpuDisplayCompositorFrameSink.
support_.SubmitCompositorFrame(local_frame_id, std::move(frame));
@@ -74,7 +77,7 @@ void GpuCompositorFrameSink::SubmitCompositorFrame(
if (support_.display() &&
start_surface_id != surface_tracker_.current_surface_id()) {
const cc::SurfaceId top_level_root_surface_id =
- display_compositor_->manager()->GetRootSurfaceId();
+ surface_manager_->GetRootSurfaceId();
// The first frame will not have a valid |start_surface_id| and there will
// be no surface to remove.
@@ -88,9 +91,9 @@ void GpuCompositorFrameSink::SubmitCompositorFrame(
}
if (!references_to_add.empty())
- display_compositor_->AddSurfaceReferences(references_to_add);
+ surface_manager_->AddSurfaceReferences(references_to_add);
if (!references_to_remove.empty())
- display_compositor_->RemoveSurfaceReferences(references_to_remove);
+ surface_manager_->RemoveSurfaceReferences(references_to_remove);
}
void GpuCompositorFrameSink::Require(const cc::LocalFrameId& local_frame_id,
@@ -136,15 +139,15 @@ void GpuCompositorFrameSink::WillDrawSurface() {
void GpuCompositorFrameSink::OnClientConnectionLost() {
client_connection_lost_ = true;
// Request destruction of |this| only if both connections are lost.
- display_compositor_->OnCompositorFrameSinkClientConnectionLost(
- support_.frame_sink_id(), private_connection_lost_);
+ delegate_->OnClientConnectionLost(support_.frame_sink_id(),
+ private_connection_lost_);
}
void GpuCompositorFrameSink::OnPrivateConnectionLost() {
private_connection_lost_ = true;
// Request destruction of |this| only if both connections are lost.
- display_compositor_->OnCompositorFrameSinkPrivateConnectionLost(
- support_.frame_sink_id(), client_connection_lost_);
+ delegate_->OnPrivateConnectionLost(support_.frame_sink_id(),
+ client_connection_lost_);
}
-} // namespace ui
+} // namespace display_compositor

Powered by Google App Engine
This is Rietveld 408576698