Index: cc/surfaces/surface.h |
diff --git a/cc/surfaces/surface.h b/cc/surfaces/surface.h |
index 2e0996821ec35630b863bf340b78a4146c369029..5393efc1e52e90dd7ce586e22c972067403c9dc6 100644 |
--- a/cc/surfaces/surface.h |
+++ b/cc/surfaces/surface.h |
@@ -18,8 +18,8 @@ |
#include "base/macros.h" |
#include "base/memory/weak_ptr.h" |
#include "base/optional.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/frame_sink_id.h" |
#include "cc/surfaces/surface_id.h" |
#include "cc/surfaces/surface_sequence.h" |
@@ -32,14 +32,22 @@ class LatencyInfo; |
namespace cc { |
-class CompositorFrame; |
+class CompositorFrameSinkSupport; |
class CopyOutputRequest; |
+class SurfaceManager; |
class CC_SURFACES_EXPORT Surface { |
public: |
using WillDrawCallback = |
base::RepeatingCallback<void(const LocalSurfaceId&, const gfx::Rect&)>; |
+ // State of a CompositorFrame producer. |
+ enum ProducerState { |
+ IDLE, // Has acknowledged the latest BeginFrame or is inactive. |
+ PENDING, // Waiting for response to the last BeginFrame. |
+ READY // A CompositorFrame was submitted but not yet drawn. |
+ }; |
+ |
Surface( |
const SurfaceId& id, |
base::WeakPtr<CompositorFrameSinkSupport> compositor_frame_sink_support); |
@@ -120,6 +128,11 @@ class CC_SURFACES_EXPORT Surface { |
bool HasActiveFrame() const { return active_frame_data_.has_value(); } |
bool HasPendingFrame() const { return pending_frame_data_.has_value(); } |
+ // Get/Set the state of the producer that submits CompositorFrames to this |
+ // surface. |
+ ProducerState GetProducerState() const { return producer_state_; } |
+ void SetProducerState(ProducerState state); |
+ |
bool destroyed() const { return destroyed_; } |
void set_destroyed(bool destroyed) { destroyed_ = destroyed; } |
@@ -170,6 +183,11 @@ class CC_SURFACES_EXPORT Surface { |
base::flat_set<SurfaceId> blocking_surfaces_; |
+ // The current state of the producer that submits CompositorFrames to this |
+ // surface. This state helps the DisplayScheduler decide whether to wait for |
+ // damage on this surface. |
+ ProducerState producer_state_ = IDLE; |
+ |
DISALLOW_COPY_AND_ASSIGN(Surface); |
}; |