Index: cc/surfaces/surface.cc |
diff --git a/cc/surfaces/surface.cc b/cc/surfaces/surface.cc |
index 2ceae59329081c2295c5aadac3d04fb171d0742e..3c43cca5d4d9d98a4233f0c3e250bc939ff89a72 100644 |
--- a/cc/surfaces/surface.cc |
+++ b/cc/surfaces/surface.cc |
@@ -12,9 +12,9 @@ |
#include "base/stl_util.h" |
#include "cc/output/compositor_frame.h" |
#include "cc/output/copy_output_request.h" |
+#include "cc/surfaces/compositor_frame_sink_support.h" |
#include "cc/surfaces/local_surface_id_allocator.h" |
#include "cc/surfaces/pending_frame_observer.h" |
-#include "cc/surfaces/surface_factory.h" |
#include "cc/surfaces/surface_manager.h" |
namespace cc { |
@@ -23,10 +23,12 @@ namespace cc { |
// completely damaged the first time they're drawn from. |
static const int kFrameIndexStart = 2; |
-Surface::Surface(const SurfaceId& id, base::WeakPtr<SurfaceFactory> factory) |
+Surface::Surface( |
+ const SurfaceId& id, |
+ base::WeakPtr<CompositorFrameSinkSupport> compositor_frame_sink_support) |
: surface_id_(id), |
previous_frame_surface_id_(id), |
- factory_(factory), |
+ compositor_frame_sink_support_(compositor_frame_sink_support), |
frame_index_(kFrameIndexStart), |
destroyed_(false) {} |
@@ -63,7 +65,7 @@ void Surface::QueueFrame(CompositorFrame frame, |
// Receive and track the resources referenced from the CompositorFrame |
// regardless of whether it's pending or active. |
- factory_->ReceiveFromChild(frame.resource_list); |
+ compositor_frame_sink_support_->ReceiveFromChild(frame.resource_list); |
bool is_pending_frame = !blocking_surfaces_.empty(); |
@@ -72,7 +74,8 @@ void Surface::QueueFrame(CompositorFrame frame, |
FrameData(std::move(frame), callback, will_draw_callback); |
// Ask the surface manager to inform |this| when its dependencies are |
// resolved. |
- factory_->manager()->RequestSurfaceResolution(this); |
+ compositor_frame_sink_support_->surface_manager()->RequestSurfaceResolution( |
+ this); |
} else { |
// If there are no blockers, then immediately activate the frame. |
ActivateFrame(FrameData(std::move(frame), callback, will_draw_callback)); |
@@ -163,7 +166,7 @@ void Surface::ActivatePendingFrame() { |
// deadline has hit and the frame was forcibly activated by the display |
// compositor. |
void Surface::ActivateFrame(FrameData frame_data) { |
- DCHECK(factory_); |
+ DCHECK(compositor_frame_sink_support_); |
// Save root pass copy requests. |
std::vector<std::unique_ptr<CopyOutputRequest>> old_copy_requests; |
@@ -201,7 +204,8 @@ void Surface::UpdateBlockingSurfaces(bool has_previous_pending_frame, |
const CompositorFrame& current_frame) { |
// If there is no SurfaceDependencyTracker installed then the |current_frame| |
// does not block on anything. |
- if (!factory_->manager()->dependency_tracker()) { |
+ if (!compositor_frame_sink_support_->surface_manager() |
+ ->dependency_tracker()) { |
blocking_surfaces_.clear(); |
return; |
} |
@@ -209,7 +213,9 @@ void Surface::UpdateBlockingSurfaces(bool has_previous_pending_frame, |
base::flat_set<SurfaceId> new_blocking_surfaces; |
for (const SurfaceId& surface_id : current_frame.metadata.embedded_surfaces) { |
- Surface* surface = factory_->manager()->GetSurfaceForId(surface_id); |
+ Surface* surface = |
+ compositor_frame_sink_support_->surface_manager()->GetSurfaceForId( |
+ surface_id); |
// If a referenced surface does not have a corresponding active frame in the |
// display compositor, then it blocks this frame. |
if (!surface || !surface->HasActiveFrame()) |
@@ -307,7 +313,7 @@ void Surface::SatisfyDestructionDependencies( |
void Surface::UnrefFrameResourcesAndRunDrawCallback( |
base::Optional<FrameData> frame_data) { |
- if (!frame_data || !factory_) |
+ if (!frame_data || !compositor_frame_sink_support_) |
return; |
ReturnedResourceArray resources; |
@@ -316,7 +322,7 @@ void Surface::UnrefFrameResourcesAndRunDrawCallback( |
// No point in returning same sync token to sender. |
for (auto& resource : resources) |
resource.sync_token.Clear(); |
- factory_->UnrefResources(resources); |
+ compositor_frame_sink_support_->UnrefResources(resources); |
if (!frame_data->draw_callback.is_null()) |
frame_data->draw_callback.Run(); |