Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CC_TREES_SWAP_PROMISE_MANAGER_H_ | |
| 6 #define CC_TREES_SWAP_PROMISE_MANAGER_H_ | |
| 7 | |
| 8 #include <set> | |
| 9 #include <vector> | |
| 10 | |
| 11 #include "base/macros.h" | |
| 12 #include "cc/base/cc_export.h" | |
| 13 #include "cc/output/swap_promise.h" | |
| 14 | |
| 15 namespace cc { | |
| 16 class SwapPromise; | |
| 17 class SwapPromiseMonitor; | |
| 18 | |
| 19 class CC_EXPORT SwapPromiseManager { | |
| 20 public: | |
| 21 SwapPromiseManager(); | |
| 22 ~SwapPromiseManager(); | |
| 23 | |
| 24 // Call this function when you expect there to be a swap buffer. | |
| 25 // See swap_promise.h for how to use SwapPromise. | |
| 26 void QueueSwapPromise(std::unique_ptr<SwapPromise> swap_promise); | |
| 27 | |
| 28 // When a SwapPromiseMonitor is created on the main thread, it calls | |
| 29 // InsertSwapPromiseMonitor() to register itself with LayerTreeHost. | |
| 30 // When the monitor is destroyed, it calls RemoveSwapPromiseMonitor() | |
| 31 // to unregister itself. | |
| 32 void InsertSwapPromiseMonitor(SwapPromiseMonitor* monitor); | |
| 33 void RemoveSwapPromiseMonitor(SwapPromiseMonitor* monitor); | |
| 34 | |
| 35 // Called when a commit request is made on the LayerTreeHost. | |
| 36 void NotifySwapPromiseMonitorsOfSetNeedsCommit(); | |
| 37 | |
| 38 // Called before the commit of the main thread state will be started. | |
| 39 void WillCommit(); | |
| 40 | |
| 41 // The current swap promise list is moved to the caller. | |
| 42 std::vector<std::unique_ptr<SwapPromise>> TakeSwapPromises(); | |
| 43 | |
| 44 // Breaks the currently queued swap promises with the specified reason. | |
| 45 void BreakSwapPromises(SwapPromise::DidNotSwapReason reason); | |
| 46 | |
| 47 size_t num_queued_swap_promises() const { return swap_promise_list_.size(); } | |
| 48 | |
| 49 private: | |
| 50 std::vector<std::unique_ptr<SwapPromise>> swap_promise_list_; | |
| 51 std::set<SwapPromiseMonitor*> swap_promise_monitor_; | |
|
vmpstr
2016/09/12 20:44:31
swap_promise_monitors_?
Khushal
2016/09/12 22:53:03
Done.
| |
| 52 | |
| 53 DISALLOW_COPY_AND_ASSIGN(SwapPromiseManager); | |
| 54 }; | |
| 55 | |
| 56 } // namespace cc | |
| 57 | |
| 58 #endif // CC_TREES_SWAP_PROMISE_MANAGER_H_ | |
| OLD | NEW |