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

Unified Diff: cc/base/synced_property.h

Issue 2035543003: cc: Fix for synced property main thread updates with MFBA. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: test Created 4 years, 6 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | cc/trees/layer_tree_host_unittest_scroll.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/base/synced_property.h
diff --git a/cc/base/synced_property.h b/cc/base/synced_property.h
index 7d1e563343ab8553c26930ae690a8b18de929787..26b00d49b55efaf18a55a6c12cd208505d040b6c 100644
--- a/cc/base/synced_property.h
+++ b/cc/base/synced_property.h
@@ -57,18 +57,20 @@ class SyncedProperty : public base::RefCounted<SyncedProperty<T>> {
// Returns the latest active tree delta and also makes a note that this value
// was sent to the main thread.
typename T::ValueType PullDeltaForMainThread() {
- sent_delta_ = active_delta_;
- return active_delta_.get();
+ sent_delta_ = PendingDelta();
+ return sent_delta_.get();
}
// Push the latest value from the main thread onto pending tree-associated
// state. Returns true if this had any effect.
bool PushFromMainThread(typename T::ValueType main_thread_value) {
+ pending_delta_ = sent_delta_;
+ sent_delta_ = T::Identity();
+
if (pending_base_.get() == main_thread_value)
return false;
pending_base_ = T(main_thread_value);
-
return true;
}
@@ -78,12 +80,12 @@ class SyncedProperty : public base::RefCounted<SyncedProperty<T>> {
// only the difference since the last send).
bool PushPendingToActive() {
if (active_base_.get() == pending_base_.get() &&
- sent_delta_.get() == T::Identity().get())
+ pending_delta_.get() == T::Identity().get())
return false;
active_base_ = pending_base_;
active_delta_ = PendingDelta();
- sent_delta_ = T::Identity();
+ pending_delta_ = T::Identity();
clobber_active_value_ = false;
return true;
@@ -94,7 +96,7 @@ class SyncedProperty : public base::RefCounted<SyncedProperty<T>> {
// active value, and the sent_delta is subtracted from the delta.
void AbortCommit() {
active_base_ = active_base_.Combine(sent_delta_);
- active_delta_ = PendingDelta();
+ active_delta_ = active_delta_.InverseCombine(sent_delta_);
sent_delta_ = T::Identity();
}
@@ -109,7 +111,7 @@ class SyncedProperty : public base::RefCounted<SyncedProperty<T>> {
T PendingDelta() const {
aelias_OOO_until_Jul13 2016/06/07 23:52:26 It's really confusing that this method doesn't ret
if (clobber_active_value_)
return T::Identity();
- return active_delta_.InverseCombine(sent_delta_);
+ return active_delta_.InverseCombine(pending_delta_);
}
void set_clobber_active_value() { clobber_active_value_ = true; }
@@ -118,9 +120,11 @@ class SyncedProperty : public base::RefCounted<SyncedProperty<T>> {
private:
// Value last committed to the pending tree.
T pending_base_;
+ // The delta that the main thread saw for the pending tree.
+ T pending_delta_;
// Value last committed to the active tree (on the last activation).
T active_base_;
- // The difference between the active_base_ and the user-perceived value.
+ // The difference between |active_base_| and the user-perceived value.
T active_delta_;
// The value sent to the main thread (on the last BeginFrame); this is always
// identity outside of the BeginFrame-to-activation interval.
« no previous file with comments | « no previous file | cc/trees/layer_tree_host_unittest_scroll.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698