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 0fdb6c6855755951a03bcee2ce4fda161f209986..f42569568cee113005e6ce8673d50bcdbc5b4519 100644 |
--- a/cc/surfaces/compositor_frame_sink_support.cc |
+++ b/cc/surfaces/compositor_frame_sink_support.cc |
@@ -87,13 +87,18 @@ void CompositorFrameSinkSupport::SetNeedsBeginFrame(bool needs_begin_frame) { |
void CompositorFrameSinkSupport::BeginFrameDidNotSwap( |
const BeginFrameAck& ack) { |
- // TODO(eseckler): While a pending CompositorFrame exists (see TODO below), we |
- // should not acknowledge immediately. Instead, we should update the ack that |
- // will be sent to DisplayScheduler when the pending frame is activated. |
+ TRACE_EVENT2("cc", "CompositorFrameSinkSupport::BeginFrameDidNotSwap", |
+ "ack.source_id", ack.source_id, "ack.sequence_number", |
+ ack.sequence_number); |
DCHECK_GE(ack.sequence_number, BeginFrameArgs::kStartingFrameNumber); |
// |has_damage| is not transmitted, but false by default. |
DCHECK(!ack.has_damage); |
+ |
+ if (current_surface_) { |
+ surface_manager_->SurfaceFinishedBeginFrame(current_surface_->surface_id(), |
+ ack); |
+ } |
if (begin_frame_source_) |
begin_frame_source_->DidFinishFrame(this, ack); |
} |
@@ -148,11 +153,8 @@ void CompositorFrameSinkSupport::SubmitCompositorFrame( |
} |
current_surface_ = std::move(surface); |
- // TODO(eseckler): The CompositorFrame submitted below might not be activated |
- // right away b/c of surface synchronization. We should only send the |
- // BeginFrameAck to DisplayScheduler when it is activated. This also means |
- // that we need to stay an active BFO while a CompositorFrame is pending. |
- // See https://crbug.com/703079. |
+ surface_manager_->SurfaceFinishedBeginFrame(current_surface_->surface_id(), |
+ ack); |
if (begin_frame_source_) |
begin_frame_source_->DidFinishFrame(this, ack); |
} |
@@ -281,6 +283,10 @@ void CompositorFrameSinkSupport::Init(SurfaceManager* surface_manager) { |
void CompositorFrameSinkSupport::OnBeginFrame(const BeginFrameArgs& args) { |
UpdateNeedsBeginFramesInternal(); |
+ if (current_surface_) { |
+ surface_manager_->SurfaceReceivedBeginFrame(current_surface_->surface_id(), |
+ args); |
+ } |
last_begin_frame_args_ = args; |
if (client_) |
client_->OnBeginFrame(args); |