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

Unified Diff: cc/surfaces/compositor_frame_sink_support.h

Issue 2785103003: [cc] CompositorFrameSinkSupport: Defer BeginFrameAck of pending frames. (Closed)
Patch Set: add comment Created 3 years, 9 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 | « no previous file | cc/surfaces/compositor_frame_sink_support.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.h
diff --git a/cc/surfaces/compositor_frame_sink_support.h b/cc/surfaces/compositor_frame_sink_support.h
index bdafb4933e6c0f752edc1fde38a9d63fd003d6b5..26b398fa53be44009ce125e02d04704ad25b6ec7 100644
--- a/cc/surfaces/compositor_frame_sink_support.h
+++ b/cc/surfaces/compositor_frame_sink_support.h
@@ -11,6 +11,7 @@
#include "base/compiler_specific.h"
#include "base/memory/weak_ptr.h"
+#include "base/optional.h"
#include "cc/output/compositor_frame.h"
#include "cc/scheduler/begin_frame_source.h"
#include "cc/surfaces/referenced_surface_tracker.h"
@@ -56,6 +57,11 @@ class CC_SURFACES_EXPORT CompositorFrameSinkSupport
void ForceReclaimResources();
void ClaimTemporaryReference(const SurfaceId& surface_id);
+ base::Optional<BeginFrameAck> begin_frame_ack_for_pending_frame_for_testing()
+ const {
+ return begin_frame_ack_for_pending_frame_;
+ }
+
private:
// Update surface references with SurfaceManager for current CompositorFrame
// that has |local_surface_id|. UpdateReferences() must be called on
@@ -68,6 +74,7 @@ class CC_SURFACES_EXPORT CompositorFrameSinkSupport
void RemoveTopLevelRootReference(const SurfaceId& surface_id);
void DidReceiveCompositorFrameAck();
+ void PendingFrameDiscarded();
// SurfaceFactoryClient implementation.
void ReferencedSurfacesChanged(
@@ -78,6 +85,8 @@ class CC_SURFACES_EXPORT CompositorFrameSinkSupport
void SetBeginFrameSource(BeginFrameSource* begin_frame_source) override;
void WillDrawSurface(const LocalSurfaceId& local_surface_id,
const gfx::Rect& damage_rect) override;
+ void PendingFrameActivated(const LocalSurfaceId& local_surface_id) override;
+ void SurfaceDiscarded(const LocalSurfaceId& local_surface_id) override;
// BeginFrameObserver implementation.
void OnBeginFrame(const BeginFrameArgs& args) override;
@@ -85,6 +94,13 @@ class CC_SURFACES_EXPORT CompositorFrameSinkSupport
void OnBeginFrameSourcePausedChanged(bool paused) override;
void UpdateNeedsBeginFramesInternal();
+ // Send |ack| to BeginFrameSource and update
+ // |latest_confirmed_begin_frame_sequence_number_ / source_id_|.
+ void AcknowledgeBeginFrame(const BeginFrameAck& ack);
+ // Send a no-damage BeginFrameAck for the last BeginFrame that re-confirms the
+ // |latest_confirmed_begin_frame_sequence_number_|. Used to confirm past
+ // BeginFrames while a pending CompositorFrame is queued but not activated.
+ void AcknowledgeLastBeginFrameWithoutUpdates();
CompositorFrameSinkSupportClient* const client_;
@@ -104,8 +120,24 @@ class CC_SURFACES_EXPORT CompositorFrameSinkSupport
// The last begin frame args generated by the begin frame source.
BeginFrameArgs last_begin_frame_args_;
+ // The BeginFrameAck that will be issued when the last submitted
+ // CompositorFrame is activated. Only set if we recently submitted a
+ // CompositorFrame that has not been activated yet.
+ base::Optional<BeginFrameAck> begin_frame_ack_for_pending_frame_;
+ // The surface that the last CompositorFrame was submitted to. Used to
+ // determine whether the last CompositorFrame may have been dropped during
+ // SurfaceDiscarded.
+ LocalSurfaceId surface_id_for_pending_frame_;
+
+ // Whether the last BeginFrame was forwarded to the client.
+ bool last_begin_frame_sent_to_client_ = true;
+
+ uint32_t latest_confirmed_begin_frame_source_id_ = 0;
+ uint64_t latest_confirmed_begin_frame_sequence_number_ =
+ BeginFrameArgs::kInvalidFrameNumber;
+
// Whether a request for begin frames has been issued.
- bool needs_begin_frame_ = false;
+ bool client_needs_begin_frame_ = false;
// Whether or not a frame observer has been added.
bool added_frame_observer_ = false;
« no previous file with comments | « no previous file | cc/surfaces/compositor_frame_sink_support.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698