OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_BASE_SYNCED_PROPERTY_H_ | 5 #ifndef CC_BASE_SYNCED_PROPERTY_H_ |
6 #define CC_BASE_SYNCED_PROPERTY_H_ | 6 #define CC_BASE_SYNCED_PROPERTY_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 | 9 |
10 namespace cc { | 10 namespace cc { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 | 90 |
91 // This simulates the consequences of the sent value getting committed and | 91 // This simulates the consequences of the sent value getting committed and |
92 // activated. The value sent to the main thread ends up combined with the | 92 // activated. The value sent to the main thread ends up combined with the |
93 // active value, and the sent_delta is subtracted from the delta. | 93 // active value, and the sent_delta is subtracted from the delta. |
94 void AbortCommit() { | 94 void AbortCommit() { |
95 active_base_ = active_base_.Combine(sent_delta_); | 95 active_base_ = active_base_.Combine(sent_delta_); |
96 active_delta_ = PendingDelta(); | 96 active_delta_ = PendingDelta(); |
97 sent_delta_ = T::Identity(); | 97 sent_delta_ = T::Identity(); |
98 } | 98 } |
99 | 99 |
100 private: | 100 // Values as last pushed to the pending or active tree respectively, with no |
| 101 // impl-thread delta applied. |
| 102 typename T::ValueType PendingBase() const { return pending_base_.get(); } |
| 103 typename T::ValueType ActiveBase() const { return active_base_.get(); } |
| 104 |
101 // The new delta we would use if we decide to activate now. This delta | 105 // The new delta we would use if we decide to activate now. This delta |
102 // excludes the amount that we expect the main thread to reflect back at the | 106 // excludes the amount that we expect the main thread to reflect back at the |
103 // impl thread during the commit. | 107 // impl thread during the commit. |
104 T PendingDelta() const { return active_delta_.InverseCombine(sent_delta_); } | 108 T PendingDelta() const { return active_delta_.InverseCombine(sent_delta_); } |
105 | 109 |
| 110 private: |
106 // Value last committed to the pending tree. | 111 // Value last committed to the pending tree. |
107 T pending_base_; | 112 T pending_base_; |
108 // Value last committed to the active tree (on the last activation). | 113 // Value last committed to the active tree (on the last activation). |
109 T active_base_; | 114 T active_base_; |
110 // The difference between the active_base_ and the user-perceived value. | 115 // The difference between the active_base_ and the user-perceived value. |
111 T active_delta_; | 116 T active_delta_; |
112 // The value sent to the main thread (on the last BeginFrame); this is always | 117 // The value sent to the main thread (on the last BeginFrame); this is always |
113 // identity outside of the BeginFrame-to-activation interval. | 118 // identity outside of the BeginFrame-to-activation interval. |
114 T sent_delta_; | 119 T sent_delta_; |
115 | 120 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 return ScaleGroup(value_ / p.value_); | 168 return ScaleGroup(value_ / p.value_); |
164 } | 169 } |
165 | 170 |
166 private: | 171 private: |
167 float value_; | 172 float value_; |
168 }; | 173 }; |
169 | 174 |
170 } // namespace cc | 175 } // namespace cc |
171 | 176 |
172 #endif // CC_BASE_SYNCED_PROPERTY_H_ | 177 #endif // CC_BASE_SYNCED_PROPERTY_H_ |
OLD | NEW |