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

Unified Diff: cc/surfaces/surface.h

Issue 2834553002: Replace CompositorFrameSinkSupport::WillDrawSurface With RepeatingCallback (Closed)
Patch Set: Address Comments On Documentation Created 3 years, 8 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 | « cc/surfaces/display.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 7614440fd9c08074f6c33d09a606e376c50ec030..5d1e63e7c9b6956c533ba581babe4cb784f051d8 100644
--- a/cc/surfaces/surface.h
+++ b/cc/surfaces/surface.h
@@ -41,6 +41,7 @@ class SurfaceFactory;
class CC_SURFACES_EXPORT Surface {
public:
using DrawCallback = SurfaceFactory::DrawCallback;
+ using WillDrawCallback = SurfaceFactory::WillDrawCallback;
Surface(const SurfaceId& id, base::WeakPtr<SurfaceFactory> factory);
~Surface();
@@ -52,7 +53,14 @@ class CC_SURFACES_EXPORT Surface {
void SetPreviousFrameSurface(Surface* surface);
- void QueueFrame(CompositorFrame frame, const DrawCallback& draw_callback);
+ // |draw_callback| is called once to notify the client that the previously
+ // submitted CompositorFrame is processed and that another frame can be
+ // submitted.
+ // |will_draw_callback| is called when |surface| is scheduled for a draw and
+ // there is visible damage.
+ void QueueFrame(CompositorFrame frame,
+ const DrawCallback& draw_callback,
+ const WillDrawCallback& will_draw_callback);
void EvictFrame();
void RequestCopyOfOutput(std::unique_ptr<CopyOutputRequest> copy_request);
@@ -84,7 +92,8 @@ class CC_SURFACES_EXPORT Surface {
int frame_index() const { return frame_index_; }
void TakeLatencyInfo(std::vector<ui::LatencyInfo>* latency_info);
- void RunDrawCallbacks();
+ void RunDrawCallback();
+ void RunWillDrawCallback(const gfx::Rect& damage_rect);
base::WeakPtr<SurfaceFactory> factory() { return factory_; }
@@ -119,12 +128,15 @@ class CC_SURFACES_EXPORT Surface {
private:
struct FrameData {
- FrameData(CompositorFrame&& frame, const DrawCallback& draw_callback);
+ FrameData(CompositorFrame&& frame,
+ const DrawCallback& draw_callback,
+ const WillDrawCallback& will_draw_callback);
FrameData(FrameData&& other);
~FrameData();
FrameData& operator=(FrameData&& other);
CompositorFrame frame;
DrawCallback draw_callback;
+ WillDrawCallback will_draw_callback;
};
void ActivatePendingFrame();
« no previous file with comments | « cc/surfaces/display.cc ('k') | cc/surfaces/surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698