OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CC_OUTPUT_SWAP_PROMISE_H_ | 5 #ifndef CC_OUTPUT_SWAP_PROMISE_H_ |
6 #define CC_OUTPUT_SWAP_PROMISE_H_ | 6 #define CC_OUTPUT_SWAP_PROMISE_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "cc/output/compositor_frame_metadata.h" | 10 #include "cc/output/compositor_frame_metadata.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 // member data in Did*(). | 43 // member data in Did*(). |
44 class CC_EXPORT SwapPromise { | 44 class CC_EXPORT SwapPromise { |
45 public: | 45 public: |
46 enum DidNotSwapReason { | 46 enum DidNotSwapReason { |
47 SWAP_FAILS, | 47 SWAP_FAILS, |
48 COMMIT_FAILS, | 48 COMMIT_FAILS, |
49 COMMIT_NO_UPDATE, | 49 COMMIT_NO_UPDATE, |
50 ACTIVATION_FAILS, | 50 ACTIVATION_FAILS, |
51 }; | 51 }; |
52 | 52 |
| 53 enum class DidNotSwapAction { |
| 54 BREAK_PROMISE, |
| 55 KEEP_ACTIVE, |
| 56 }; |
| 57 |
53 SwapPromise() {} | 58 SwapPromise() {} |
54 virtual ~SwapPromise() {} | 59 virtual ~SwapPromise() {} |
55 | 60 |
56 virtual void DidActivate() = 0; | 61 virtual void DidActivate() = 0; |
57 virtual void DidSwap(CompositorFrameMetadata* metadata) = 0; | 62 virtual void DidSwap(CompositorFrameMetadata* metadata) = 0; |
58 virtual void DidNotSwap(DidNotSwapReason reason) = 0; | 63 // Return |KEEP_ACTIVE| if this promise should remain active (should not be |
| 64 // broken by the owner). |
| 65 virtual DidNotSwapAction DidNotSwap(DidNotSwapReason reason) = 0; |
59 // This is called when the main thread starts a (blocking) commit | 66 // This is called when the main thread starts a (blocking) commit |
60 virtual void OnCommit() {} | 67 virtual void OnCommit() {} |
61 | 68 |
62 // A non-zero trace id identifies a trace flow object that is embedded in the | 69 // A non-zero trace id identifies a trace flow object that is embedded in the |
63 // swap promise. This can be used for registering additional flow steps to | 70 // swap promise. This can be used for registering additional flow steps to |
64 // visualize the object's path through the system. | 71 // visualize the object's path through the system. |
65 virtual int64_t TraceId() const = 0; | 72 virtual int64_t TraceId() const = 0; |
66 }; | 73 }; |
67 | 74 |
68 } // namespace cc | 75 } // namespace cc |
69 | 76 |
70 #endif // CC_OUTPUT_SWAP_PROMISE_H_ | 77 #endif // CC_OUTPUT_SWAP_PROMISE_H_ |
OLD | NEW |