Chromium Code Reviews| Index: cc/surfaces/surface.h |
| diff --git a/cc/surfaces/surface.h b/cc/surfaces/surface.h |
| index 0ac97a13b05bd675b9b941daceea0c8e7be6f050..9ecc376bd6ea7356a19c87623891f16b062fb083 100644 |
| --- a/cc/surfaces/surface.h |
| +++ b/cc/surfaces/surface.h |
| @@ -20,6 +20,7 @@ |
| #include "base/optional.h" |
| #include "cc/output/copy_output_request.h" |
| #include "cc/surfaces/frame_sink_id.h" |
| +#include "cc/surfaces/pending_frame_observer.h" |
| #include "cc/surfaces/surface_factory.h" |
| #include "cc/surfaces/surface_id.h" |
| #include "cc/surfaces/surface_sequence.h" |
| @@ -54,14 +55,29 @@ class CC_SURFACES_EXPORT Surface { |
| void QueueFrame(CompositorFrame frame, const DrawCallback& draw_callback); |
| void EvictFrame(); |
| void RequestCopyOfOutput(std::unique_ptr<CopyOutputRequest> copy_request); |
| + |
| + // Reports to the Surface that a blocking SurfaceId is now available. |
| + void ReportSurfaceIdAvailable(const SurfaceId& surface_id); |
|
vmpstr
2017/02/07 22:46:19
Notify?
Fady Samuel
2017/02/08 00:52:49
Done.
|
| + |
| + void AddObserver(PendingFrameObserver* observer); |
| + void RemoveObserver(PendingFrameObserver* observer); |
| + |
| + // Called if a deadline has been hit and this surface is not yet active but |
| + // it's marked as respecting deadlines. |
| + void ActivatePendingFrameForDeadline(); |
| + |
| // Adds each CopyOutputRequest in the current frame to copy_requests. The |
| // caller takes ownership of them. |copy_requests| is keyed by RenderPass ids. |
| void TakeCopyOutputRequests( |
| std::multimap<int, std::unique_ptr<CopyOutputRequest>>* copy_requests); |
| // Returns the most recent frame that is eligible to be rendered. |
| - // You must check whether HasFrame() returns true before calling this method. |
| - const CompositorFrame& GetEligibleFrame() const; |
| + // You must check whether HasActiveFrame() returns true before calling this |
| + // method. |
| + const CompositorFrame& GetActiveFrame() const; |
| + |
| + // Returns the currently pending frame. |
|
vmpstr
2017/02/07 22:46:19
Can you add a similar comment here as above, "must
Fady Samuel
2017/02/08 00:52:49
Done.
|
| + const CompositorFrame& GetPendingFrame(); |
| // Returns a number that increments by 1 every time a new frame is enqueued. |
| int frame_index() const { return frame_index_; } |
| @@ -88,12 +104,17 @@ class CC_SURFACES_EXPORT Surface { |
| return referenced_surfaces_; |
| } |
| - bool HasFrame() const { return current_frame_.has_value(); } |
| + bool HasActiveFrame() const { return active_frame_.has_value(); } |
| + bool HasPendingFrame() const { return pending_frame_.has_value(); } |
| bool destroyed() const { return destroyed_; } |
| void set_destroyed(bool destroyed) { destroyed_ = destroyed; } |
| private: |
| + void ActivatePendingFrame(); |
| + // Called when all of the surface's dependencies have been resolved. |
| + void ActivateFrame(CompositorFrame frame); |
| + |
| void UnrefFrameResources(const CompositorFrame& frame_data); |
| void ClearCopyRequests(); |
| @@ -101,7 +122,8 @@ class CC_SURFACES_EXPORT Surface { |
| SurfaceId previous_frame_surface_id_; |
| base::WeakPtr<SurfaceFactory> factory_; |
| // TODO(jamesr): Support multiple frames in flight. |
| - base::Optional<CompositorFrame> current_frame_; |
| + base::Optional<CompositorFrame> pending_frame_; |
| + base::Optional<CompositorFrame> active_frame_; |
| int frame_index_; |
| bool destroyed_; |
| std::vector<SurfaceSequence> destruction_dependencies_; |
| @@ -112,11 +134,16 @@ class CC_SURFACES_EXPORT Surface { |
| std::vector<SurfaceId> referenced_surfaces_; |
| + SurfaceDependencies blocked_on_surfaces_; |
|
vmpstr
2017/02/07 22:46:19
nit: "blocking_surfaces_"?
Fady Samuel
2017/02/08 00:52:49
Done.
|
| + base::ObserverList<PendingFrameObserver, true> observers_; |
| + |
| DrawCallback draw_callback_; |
| DISALLOW_COPY_AND_ASSIGN(Surface); |
| }; |
| +using PendingSurfaceSet = std::unordered_set<Surface*>; |
|
vmpstr
2017/02/07 22:46:19
What's the expected size of these things? flat set
Fady Samuel
2017/02/08 00:52:49
Added a TODO.
|
| + |
| } // namespace cc |
| #endif // CC_SURFACES_SURFACE_H_ |