Chromium Code Reviews| 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 // | |
| 43 // For each SwapPromise, OnCommitForSwapPromises traces its original LatencyInfo | |
|
Yufeng Shen (Slow to review)
2015/06/16 17:32:18
SwapPromise is generic, so you should only mention
| |
| 42 class CC_EXPORT SwapPromise { | 44 class CC_EXPORT SwapPromise { |
| 43 public: | 45 public: |
| 44 enum DidNotSwapReason { | 46 enum DidNotSwapReason { |
| 45 SWAP_FAILS, | 47 SWAP_FAILS, |
| 46 COMMIT_FAILS, | 48 COMMIT_FAILS, |
| 47 COMMIT_NO_UPDATE, | 49 COMMIT_NO_UPDATE, |
| 48 ACTIVATION_FAILS, | 50 ACTIVATION_FAILS, |
| 49 }; | 51 }; |
| 50 | 52 |
| 51 SwapPromise() {} | 53 SwapPromise() {} |
| 52 virtual ~SwapPromise() {} | 54 virtual ~SwapPromise() {} |
| 53 | 55 |
| 54 virtual void DidActivate() = 0; | 56 virtual void DidActivate() = 0; |
| 55 virtual void DidSwap(CompositorFrameMetadata* metadata) = 0; | 57 virtual void DidSwap(CompositorFrameMetadata* metadata) = 0; |
| 56 virtual void DidNotSwap(DidNotSwapReason reason) = 0; | 58 virtual void DidNotSwap(DidNotSwapReason reason) = 0; |
| 59 virtual void OnCommitForSwapPromises() {} | |
| 57 | 60 |
|
Yufeng Shen (Slow to review)
2015/06/16 17:32:18
ah, I actually meant the naming to be LayerTreeHos
| |
| 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 |