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

Unified Diff: cc/surfaces/compositor_frame_sink_support.cc

Issue 2807653003: Move Work From CompositorFrameSinkSupport() To Init() (Closed)
Patch Set: Set needs_sync_points Created 3 years, 8 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 | « cc/surfaces/compositor_frame_sink_support.h ('k') | cc/surfaces/compositor_frame_sink_support_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/surfaces/compositor_frame_sink_support.cc
diff --git a/cc/surfaces/compositor_frame_sink_support.cc b/cc/surfaces/compositor_frame_sink_support.cc
index 093c5b60d9469aec4fede331dbfb8dd307b3ff5a..d9ce6408cdef297fa0983d6e84a55ee44465650c 100644
--- a/cc/surfaces/compositor_frame_sink_support.cc
+++ b/cc/surfaces/compositor_frame_sink_support.cc
@@ -19,24 +19,15 @@ namespace cc {
CompositorFrameSinkSupport::CompositorFrameSinkSupport(
CompositorFrameSinkSupportClient* client,
- SurfaceManager* surface_manager,
const FrameSinkId& frame_sink_id,
bool is_root,
- bool handles_frame_sink_id_invalidation,
- bool needs_sync_points)
+ bool handles_frame_sink_id_invalidation)
: client_(client),
- surface_manager_(surface_manager),
boliu 2017/04/11 20:49:13 this still needs to be initialized to null, though
Alex Z. 2017/04/11 20:57:17 Done.
frame_sink_id_(frame_sink_id),
- surface_factory_(frame_sink_id_, surface_manager_, this),
reference_tracker_(frame_sink_id),
is_root_(is_root),
handles_frame_sink_id_invalidation_(handles_frame_sink_id_invalidation),
- weak_factory_(this) {
- surface_factory_.set_needs_sync_points(needs_sync_points);
- if (handles_frame_sink_id_invalidation_)
- surface_manager_->RegisterFrameSinkId(frame_sink_id_);
- surface_manager_->RegisterSurfaceFactoryClient(frame_sink_id_, this);
-}
+ weak_factory_(this) {}
CompositorFrameSinkSupport::~CompositorFrameSinkSupport() {
// Unregister |this| as a BeginFrameObserver so that the BeginFrameSource does
@@ -52,12 +43,23 @@ CompositorFrameSinkSupport::~CompositorFrameSinkSupport() {
// SurfaceFactory's destructor will attempt to return resources which will
// call back into here and access |client_| so we should destroy
// |surface_factory_|'s resources early on.
- surface_factory_.EvictSurface();
+ surface_factory_->EvictSurface();
surface_manager_->UnregisterSurfaceFactoryClient(frame_sink_id_);
if (handles_frame_sink_id_invalidation_)
surface_manager_->InvalidateFrameSinkId(frame_sink_id_);
}
+void CompositorFrameSinkSupport::Init(SurfaceManager* surface_manager,
+ bool needs_sync_points) {
+ surface_manager_ = surface_manager;
+ surface_factory_ =
+ base::MakeUnique<SurfaceFactory>(frame_sink_id_, surface_manager_, this);
+ if (handles_frame_sink_id_invalidation_)
+ surface_manager_->RegisterFrameSinkId(frame_sink_id_);
+ surface_manager_->RegisterSurfaceFactoryClient(frame_sink_id_, this);
+ surface_factory_->set_needs_sync_points(needs_sync_points);
+}
+
void CompositorFrameSinkSupport::ReferencedSurfacesChanged(
const LocalSurfaceId& local_surface_id,
const std::vector<SurfaceId>* active_referenced_surfaces,
@@ -110,7 +112,8 @@ void CompositorFrameSinkSupport::WillDrawSurface(
}
void CompositorFrameSinkSupport::EvictFrame() {
- surface_factory_.EvictSurface();
+ DCHECK(surface_factory_);
+ surface_factory_->EvictSurface();
}
void CompositorFrameSinkSupport::SetNeedsBeginFrame(bool needs_begin_frame) {
@@ -137,6 +140,7 @@ void CompositorFrameSinkSupport::BeginFrameDidNotSwap(
void CompositorFrameSinkSupport::SubmitCompositorFrame(
const LocalSurfaceId& local_surface_id,
CompositorFrame frame) {
+ DCHECK(surface_factory_);
++ack_pending_count_;
if (frame.metadata.begin_frame_ack.sequence_number <
@@ -150,7 +154,7 @@ void CompositorFrameSinkSupport::SubmitCompositorFrame(
frame.metadata.begin_frame_ack.has_damage = true;
BeginFrameAck ack = frame.metadata.begin_frame_ack;
- surface_factory_.SubmitCompositorFrame(
+ surface_factory_->SubmitCompositorFrame(
local_surface_id, std::move(frame),
base::Bind(&CompositorFrameSinkSupport::DidReceiveCompositorFrameAck,
weak_factory_.GetWeakPtr()));
@@ -226,7 +230,8 @@ void CompositorFrameSinkSupport::DidReceiveCompositorFrameAck() {
}
void CompositorFrameSinkSupport::ForceReclaimResources() {
- surface_factory_.ClearSurface();
+ DCHECK(surface_factory_);
+ surface_factory_->ClearSurface();
}
void CompositorFrameSinkSupport::ClaimTemporaryReference(
@@ -264,7 +269,8 @@ void CompositorFrameSinkSupport::UpdateNeedsBeginFramesInternal() {
void CompositorFrameSinkSupport::RequestCopyOfSurface(
std::unique_ptr<CopyOutputRequest> request) {
- surface_factory_.RequestCopyOfSurface(std::move(request));
+ DCHECK(surface_factory_);
+ surface_factory_->RequestCopyOfSurface(std::move(request));
}
} // namespace cc
« no previous file with comments | « cc/surfaces/compositor_frame_sink_support.h ('k') | cc/surfaces/compositor_frame_sink_support_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698