Index: cc/surfaces/surface.cc |
diff --git a/cc/surfaces/surface.cc b/cc/surfaces/surface.cc |
index 3e16c6928a05e7f2d273785305693021a121491b..6e5e2de74227916cd5e10a5a2ba99889d9ddd096 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,16 +23,18 @@ 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) {} |
Surface::~Surface() { |
ClearCopyRequests(); |
- if (factory_) { |
+ if (compositor_frame_sink_support_) { |
if (pending_frame_) |
UnrefFrameResources(*pending_frame_); |
if (active_frame_) |
@@ -66,13 +68,14 @@ void Surface::QueueFrame(CompositorFrame frame, const DrawCallback& callback) { |
// 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); |
if (!blocking_surfaces_.empty()) { |
pending_frame_ = std::move(frame); |
// Ask the surface manager to inform |this| when its dependencies are |
// resolved. |
- factory_->manager()->RequestSurfaceResolution(this); |
+ compositor_frame_sink_support_->surface_manager()->RequestSurfaceResolution( |
+ this); |
// We do not have to notify observers that referenced surfaces have changed |
// in the else case because ActivateFrame will notify observers. |
@@ -166,7 +169,7 @@ void Surface::ActivatePendingFrame() { |
// deadline has hit and the frame was forcibly activated by the display |
// compositor. |
void Surface::ActivateFrame(CompositorFrame frame) { |
- DCHECK(factory_); |
+ DCHECK(compositor_frame_sink_support_); |
// Save root pass copy requests. |
std::vector<std::unique_ptr<CopyOutputRequest>> old_copy_requests; |
@@ -209,7 +212,8 @@ void Surface::UpdateBlockingSurfaces( |
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; |
} |
@@ -218,7 +222,9 @@ void Surface::UpdateBlockingSurfaces( |
for (const SurfaceId& surface_id : |
current_frame.metadata.referenced_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()) |
@@ -312,7 +318,7 @@ void Surface::UnrefFrameResources(const CompositorFrame& frame) { |
// 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); |
} |
void Surface::ClearCopyRequests() { |