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

Unified Diff: cc/surfaces/surface.h

Issue 2449853004: Getting rid of DelegatedFrameData (Closed)
Patch Set: nit Created 4 years, 1 month 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/display_unittest.cc ('k') | cc/surfaces/surface.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/surfaces/surface.h
diff --git a/cc/surfaces/surface.h b/cc/surfaces/surface.h
index ad29d8142747f94f6ef7d05eddf541faaf72b697..a6a225e2d66dc96f1fa99264b6fea4bdc5b5741e 100644
--- a/cc/surfaces/surface.h
+++ b/cc/surfaces/surface.h
@@ -17,6 +17,7 @@
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
+#include "base/optional.h"
#include "cc/output/copy_output_request.h"
#include "cc/quads/render_pass_id.h"
#include "cc/surfaces/frame_sink_id.h"
@@ -52,6 +53,7 @@ class CC_SURFACES_EXPORT Surface {
void SetPreviousFrameSurface(Surface* surface);
void QueueFrame(CompositorFrame frame, const DrawCallback& draw_callback);
+ void EvictFrame();
void RequestCopyOfOutput(std::unique_ptr<CopyOutputRequest> copy_request);
// Adds each CopyOutputRequest in the current frame to copy_requests. The
// caller takes ownership of them.
@@ -60,8 +62,7 @@ class CC_SURFACES_EXPORT Surface {
copy_requests);
// Returns the most recent frame that is eligible to be rendered.
- // If the CompositorFrame's DelegateFrameData is null then there is
- // no eligible frame.
+ // You must check whether HasFrame() returns true before calling this method.
const CompositorFrame& GetEligibleFrame();
// Returns a number that increments by 1 every time a new frame is enqueued.
@@ -89,18 +90,20 @@ class CC_SURFACES_EXPORT Surface {
return referenced_surfaces_;
}
+ bool HasFrame() const { return current_frame_.has_value(); }
+
bool destroyed() const { return destroyed_; }
void set_destroyed(bool destroyed) { destroyed_ = destroyed; }
private:
- void UnrefFrameResources(DelegatedFrameData* frame_data);
+ void UnrefFrameResources(const CompositorFrame& frame_data);
void ClearCopyRequests();
SurfaceId surface_id_;
SurfaceId previous_frame_surface_id_;
base::WeakPtr<SurfaceFactory> factory_;
// TODO(jamesr): Support multiple frames in flight.
- CompositorFrame current_frame_;
+ base::Optional<CompositorFrame> current_frame_;
int frame_index_;
bool destroyed_;
std::vector<SurfaceSequence> destruction_dependencies_;
« no previous file with comments | « cc/surfaces/display_unittest.cc ('k') | cc/surfaces/surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698