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 "cc/output/compositor_frame_metadata.h" | 8 #include "cc/output/compositor_frame_metadata.h" |
9 | 9 |
10 namespace cc { | 10 namespace cc { |
(...skipping 21 matching lines...) Expand all Loading... | |
32 // DidActivate() ; DidNotSwap() | 32 // DidActivate() ; DidNotSwap() |
33 // | 33 // |
34 // Clients that wish to use SwapPromise should have a subclass that defines | 34 // Clients that wish to use SwapPromise should have a subclass that defines |
35 // the behavior of DidActivate(), DidSwap() and DidNotSwap(). Notice that the | 35 // the behavior of DidActivate(), DidSwap() and DidNotSwap(). Notice that the |
36 // promise can be broken at either main or impl thread, e.g. commit fails on | 36 // promise can be broken at either main or impl thread, e.g. commit fails on |
37 // main thread, new frame data has no actual damage so | 37 // main thread, new frame data has no actual damage so |
38 // LayerTreeHostImpl::SwapBuffers() bails out early on impl thread, so don't | 38 // LayerTreeHostImpl::SwapBuffers() bails out early on impl thread, so don't |
39 // assume that Did*() methods are called at a particular thread. It is better | 39 // assume that Did*() methods are called at a particular thread. It is better |
40 // to let the subclass carry thread-safe member data and operate on that | 40 // to let the subclass carry thread-safe member data and operate on that |
41 // member data in Did*(). | 41 // member data in Did*(). |
42 // | |
Yufeng Shen (Slow to review)
2015/06/16 17:54:16
extra line
| |
42 class CC_EXPORT SwapPromise { | 43 class CC_EXPORT SwapPromise { |
43 public: | 44 public: |
44 enum DidNotSwapReason { | 45 enum DidNotSwapReason { |
45 SWAP_FAILS, | 46 SWAP_FAILS, |
46 COMMIT_FAILS, | 47 COMMIT_FAILS, |
47 COMMIT_NO_UPDATE, | 48 COMMIT_NO_UPDATE, |
48 ACTIVATION_FAILS, | 49 ACTIVATION_FAILS, |
49 }; | 50 }; |
50 | 51 |
51 SwapPromise() {} | 52 SwapPromise() {} |
52 virtual ~SwapPromise() {} | 53 virtual ~SwapPromise() {} |
53 | 54 |
54 virtual void DidActivate() = 0; | 55 virtual void DidActivate() = 0; |
55 virtual void DidSwap(CompositorFrameMetadata* metadata) = 0; | 56 virtual void DidSwap(CompositorFrameMetadata* metadata) = 0; |
56 virtual void DidNotSwap(DidNotSwapReason reason) = 0; | 57 virtual void DidNotSwap(DidNotSwapReason reason) = 0; |
58 // OnCommit is only called for LatencyInfoSwapPromise | |
59 virtual void OnCommit() {} | |
Yufeng Shen (Slow to review)
2015/06/16 17:54:16
Should not mention subclass's behavior, only menti
| |
57 | 60 |
58 // A non-zero trace id identifies a trace flow object that is embedded in the | 61 // A non-zero trace id identifies a trace flow object that is embedded in the |
59 // swap promise. This can be used for registering additional flow steps to | 62 // swap promise. This can be used for registering additional flow steps to |
60 // visualize the object's path through the system. | 63 // visualize the object's path through the system. |
61 virtual int64 TraceId() const = 0; | 64 virtual int64 TraceId() const = 0; |
62 }; | 65 }; |
63 | 66 |
64 } // namespace cc | 67 } // namespace cc |
65 | 68 |
66 #endif // CC_OUTPUT_SWAP_PROMISE_H_ | 69 #endif // CC_OUTPUT_SWAP_PROMISE_H_ |
OLD | NEW |