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

Unified Diff: blimp/client/core/compositor/blimp_compositor.h

Issue 2459823003: blimp: Use SwapPromises for readback API. (Closed)
Patch Set: comment updated 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 | « no previous file | blimp/client/core/compositor/blimp_compositor.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: blimp/client/core/compositor/blimp_compositor.h
diff --git a/blimp/client/core/compositor/blimp_compositor.h b/blimp/client/core/compositor/blimp_compositor.h
index cf14c64cfae17b9ba522bb774b7ffebf771c1e44..ff7bb03827ea8f7d2f391d4f7fc6cbcd6d7427cd 100644
--- a/blimp/client/core/compositor/blimp_compositor.h
+++ b/blimp/client/core/compositor/blimp_compositor.h
@@ -36,6 +36,7 @@ class CompositorMessage;
class CompositorStateDeserializer;
class ContextProvider;
+class CopyOutputRequest;
class Layer;
class LayerTreeHost;
class LayerTreeSettings;
@@ -90,10 +91,12 @@ class BlimpCompositor : public cc::LayerTreeHostClient,
virtual void SetVisible(bool visible);
- // Notifies |callback| when all pending commits have been drawn to the screen.
- // If this compositor is destroyed or becomes hidden |callback| will be
- // notified.
- void NotifyWhenDonePendingCommits(base::Closure callback);
+ // Requests a copy of the compositor frame.
+ // Setting |flush_pending_update| to true ensures that if a frame update on
+ // the main thread is pending, then it is drawn before copying from the
+ // surface.
+ void RequestCopyOfOutput(std::unique_ptr<cc::CopyOutputRequest> copy_request,
+ bool flush_pending_update);
// Called to forward the compositor message from the remote server
// LayerTreeHost of the render widget for this compositor.
@@ -109,6 +112,7 @@ class BlimpCompositor : public cc::LayerTreeHostClient,
private:
friend class BlimpCompositorForTesting;
+ class FrameTrackingSwapPromise;
// LayerTreeHostClient implementation.
void WillBeginMainFrame() override {}
@@ -176,11 +180,6 @@ class BlimpCompositor : public cc::LayerTreeHostClient,
// associated state.
void DestroyLayerTreeHost();
- // Updates |pending_commit_trackers_|, decrementing the count and, if 0,
- // notifying the callback. If |flush| is true, flushes all entries regardless
- // of the count.
- void CheckPendingCommitCounts(bool flush);
-
// Acks a submitted CompositorFrame when it has been processed and another
// frame should be started.
void SubmitCompositorFrameAck();
@@ -193,6 +192,12 @@ class BlimpCompositor : public cc::LayerTreeHostClient,
// updates from the engine.
const bool use_threaded_layer_tree_host_;
+ void MakeCopyRequestOnNextSwap(
+ std::unique_ptr<cc::CopyOutputRequest> copy_request);
+
+ void RequestCopyOfOutputDeprecated(
+ std::unique_ptr<cc::CopyOutputRequest> copy_request);
+
BlimpCompositorClient* client_;
BlimpCompositorDependencies* compositor_dependencies_;
@@ -224,16 +229,21 @@ class BlimpCompositor : public cc::LayerTreeHostClient,
// to |render_widget_id_|.
cc::RemoteProtoChannel::ProtoReceiver* remote_proto_channel_receiver_;
+ std::vector<std::unique_ptr<cc::CopyOutputRequest>>
+ copy_requests_for_next_swap_;
+
// The number of times a START_COMMIT proto has been received but a call to
// DidCommitAndDrawFrame hasn't been seen. This should track the number of
// outstanding commits.
size_t outstanding_commits_;
- // When NotifyWhenDonePendingCommitsis called |outstanding_commits_| is copied
- // along with the |callback| into this vector. Each time
- // DidCommitAndDrawFrame is called these entries get decremented. If they hit
- // 0 the callback is triggered.
- std::vector<std::pair<size_t, base::Closure>> pending_commit_trackers_;
+ // When RequestCopyOfOutput is called with a request to flush any pending
+ // updates, |outstanding_commits_| is copied along with the |copy_request|
+ // into this vector. Each time DidCommitAndDrawFrame is called these entries
+ // get decremented. If they hit 0 the copy request is queued for the current
+ // |local_frame_id_|.
+ std::vector<std::pair<size_t, std::unique_ptr<cc::CopyOutputRequest>>>
+ pending_commit_trackers_;
// Stores a frame update received from the engine, when a threaded
// LayerTreeHost is used. There can only be a single frame in flight at any
« no previous file with comments | « no previous file | blimp/client/core/compositor/blimp_compositor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698