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 7b1601dd32a3ba361568f3717a5abe3a985c36b4..cdb56727d7ed2b754611a40790ecd75d8f985038 100644 |
--- a/blimp/client/core/compositor/blimp_compositor.h |
+++ b/blimp/client/core/compositor/blimp_compositor.h |
@@ -6,6 +6,7 @@ |
#define BLIMP_CLIENT_CORE_COMPOSITOR_BLIMP_COMPOSITOR_H_ |
#include <memory> |
+#include <vector> |
#include "base/macros.h" |
#include "base/memory/ref_counted.h" |
@@ -97,6 +98,11 @@ class BlimpCompositor : public cc::LayerTreeHostClient, |
// virtual for testing. |
virtual bool OnTouchEvent(const ui::MotionEvent& motion_event); |
+ // 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); |
Khushal
2016/09/13 23:47:10
May be add, if there are no pending commits, the c
David Trainor- moved to gerrit
2016/09/14 00:31:09
Done.
|
+ |
// Called to forward the compositor message from the remote server |
// LayerTreeHost of the render widget for this compositor. |
// virtual for testing. |
@@ -172,6 +178,11 @@ 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); |
+ |
// The unique identifier for the render widget for this compositor. |
const int render_widget_id_; |
@@ -215,6 +226,17 @@ class BlimpCompositor : public cc::LayerTreeHostClient, |
// widget. |
std::unique_ptr<BlimpInputManager> input_manager_; |
+ // 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_; |
+ |
base::WeakPtrFactory<BlimpCompositor> weak_ptr_factory_; |
DISALLOW_COPY_AND_ASSIGN(BlimpCompositor); |