OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2013 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_BASE_SWAP_PROMISE_H_ | |
6 #define CC_BASE_SWAP_PROMISE_H_ | |
7 | |
8 #include "base/compiler_specific.h" | |
9 | |
10 namespace cc { | |
11 | |
12 // A SwapPromise can be queued into LTH/LTI to track if an expected swap | |
danakj
2013/11/13 23:22:09
spell out LayerTreeHost(Impl) here
Yufeng Shen (Slow to review)
2013/11/14 22:09:55
Done.
| |
13 // buffer will happen or not. If the swap buffer happens, DidSwap() will | |
danakj
2013/11/13 23:22:09
Can you reword this comment to match what I wrote
Yufeng Shen (Slow to review)
2013/11/14 22:09:55
Done.
| |
14 // be called, and if the swap buffer somehow fails to happen, DidNotSwap() | |
15 // will be called. | |
16 // Client wishes to use SwapPromise should have a subclass that defines | |
17 // the behavior of DidSwap() and DidNotSwap(). Notice that swap buffer can | |
18 // fail at main/impl thread, so don't assume that DidSwap() and DidNotSwap() | |
19 // are called at a particular thread. It is better to let the subclass carry | |
20 // thread-safe member data and operate on that member data in DidSwap() and | |
21 // DidNotSwap(). | |
22 class SwapPromise { | |
23 public: | |
24 enum SwapPromiseType { | |
25 SWAP_PROMISE_UNKNOWN, | |
26 }; | |
27 | |
28 explicit SwapPromise(SwapPromiseType type); | |
29 virtual ~SwapPromise() {} | |
30 | |
31 enum DidNotSwapReason { | |
32 DID_NOT_SWAP_UNKNOWN, | |
33 SWAP_FAILS, | |
34 COMMIT_FAILS, | |
35 SWAP_PROMISE_LIST_OVERFLOW, | |
36 }; | |
37 | |
38 SwapPromiseType type() { | |
danakj
2013/11/13 23:22:09
If there's only one type, what's the point of this
Yufeng Shen (Slow to review)
2013/11/14 22:09:55
It is intended that subclass added in the future w
danakj
2013/11/20 03:00:55
Then I prefer we add it in a later patch that will
Yufeng Shen (Slow to review)
2013/11/20 19:15:41
removed.
| |
39 return type_; | |
40 } | |
41 | |
42 virtual void DidSwap() = 0; | |
43 virtual void DidNotSwap(DidNotSwapReason reason) = 0; | |
44 | |
45 protected: | |
46 SwapPromiseType type_; | |
47 }; | |
48 | |
49 } // namespace cc | |
50 | |
51 #endif // CC_BASE_SWAP_PROMISE_H_ | |
OLD | NEW |