Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(142)

Side by Side Diff: cc/base/synced_property.h

Issue 2445093002: cc/blimp: Add synchronization for scroll/scale state. (Closed)
Patch Set: Addressed comments Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 // before the commit). 43 // before the commit).
44 bool SetCurrent(typename T::ValueType current) { 44 bool SetCurrent(typename T::ValueType current) {
45 T delta = T(current).InverseCombine(active_base_); 45 T delta = T(current).InverseCombine(active_base_);
46 if (active_delta_.get() == delta.get()) 46 if (active_delta_.get() == delta.get())
47 return false; 47 return false;
48 48
49 active_delta_ = delta; 49 active_delta_ = delta;
50 return true; 50 return true;
51 } 51 }
52 52
53 // Adds the delta that has been reported to the main thread, and was expected
54 // to be reflected/resolved by the main thread in the commit, but could not
55 // be applied because it has not yet been resolved by the LayerTreeHostClient.
56 // The delta is added to the pending base so while the current value on
57 // the associated pending/active tree state simulates the result of the delta
58 // having not been applied to the main thread, but it is excluded in the
59 // subsequent deltas reported to the main thread.
60 void AddUnappliedDeltaToPendingBase(typename T::ValueType unapplied_delta) {
aelias_OOO_until_Jul13 2016/10/26 04:04:12 Could this new method be avoided by applying the d
Khushal 2016/10/26 19:02:35 It could, I'll just end up doing it at the calling
aelias_OOO_until_Jul13 2016/10/27 02:09:55 Right, I'd like to keep it self-contained and with
Khushal 2016/10/27 04:26:26 Oh, I see what you mean now. The place where Push
Khushal 2016/10/27 04:38:32 Or, may be this can be done here, right before syn
aelias_OOO_until_Jul13 2016/10/27 07:01:31 How about registering a did_scroll_callback that c
61 pending_base_ = pending_base_.Combine(T(unapplied_delta));
62 }
63
53 // Returns the difference between the last value that was committed and 64 // Returns the difference between the last value that was committed and
54 // activated from the main thread, and the current total value. 65 // activated from the main thread, and the current total value.
55 typename T::ValueType Delta() const { return active_delta_.get(); } 66 typename T::ValueType Delta() const { return active_delta_.get(); }
56 67
57 // Returns the latest active tree delta and also makes a note that this value 68 // Returns the latest active tree delta and also makes a note that this value
58 // was sent to the main thread. 69 // was sent to the main thread.
59 typename T::ValueType PullDeltaForMainThread() { 70 typename T::ValueType PullDeltaForMainThread() {
60 reflected_delta_in_main_tree_ = PendingDelta(); 71 reflected_delta_in_main_tree_ = PendingDelta();
61 return reflected_delta_in_main_tree_.get(); 72 return reflected_delta_in_main_tree_.get();
62 } 73 }
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 return ScaleGroup(value_ / p.value_); 193 return ScaleGroup(value_ / p.value_);
183 } 194 }
184 195
185 private: 196 private:
186 float value_; 197 float value_;
187 }; 198 };
188 199
189 } // namespace cc 200 } // namespace cc
190 201
191 #endif // CC_BASE_SYNCED_PROPERTY_H_ 202 #endif // CC_BASE_SYNCED_PROPERTY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698