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

Unified Diff: cc/animation/scroll_offset_animations.h

Issue 1950243005: Communicate MT changes to impl-only scroll offset animations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
Index: cc/animation/scroll_offset_animations.h
diff --git a/cc/animation/scroll_offset_animations.h b/cc/animation/scroll_offset_animations.h
new file mode 100644
index 0000000000000000000000000000000000000000..9a7df12a38c7ceb3d6fd1947ebb15834e6a02eaa
--- /dev/null
+++ b/cc/animation/scroll_offset_animations.h
@@ -0,0 +1,50 @@
+// Copyright (c) 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CC_ANIMATION_SCROLL_OFFSET_ANIMATIONS_H_
+#define CC_ANIMATION_SCROLL_OFFSET_ANIMATIONS_H_
+
+#include "cc/animation/scroll_offset_animations_impl.h"
+#include "cc/trees/mutator_host_client.h"
+
+namespace cc {
+
+// A ScrollOffsetAnimationUpdate represents a change on the main thread
+// that may impact an impl-only scroll offset animation. PushPropertiesTo is
+// called during commit time and the necessary update is made to the impl-only
+// animation.
+// Note that this class only exists on the main thread.
+struct CC_EXPORT ScrollOffsetAnimationUpdate {
+ enum Type { SCROLL_OFFSET_CHANGED };
+
+ ScrollOffsetAnimationUpdate();
+
+ // The element to which this update applies.
+ ElementId element_id_;
+ Type type_;
+
+ // The amount by which the scroll offset is changed on the main thread.
+ gfx::Vector2dF adjustment_;
+};
+
+class CC_EXPORT ScrollOffsetAnimations {
+ public:
+ ScrollOffsetAnimations();
+ ~ScrollOffsetAnimations();
+
+ void AddUpdate(ScrollOffsetAnimationUpdate);
+ bool HasUpdates() const;
+
+ // Goes through the updates in the order in which they're added and calls the
+ // appropriate handler for each update.
+ void PushPropertiesTo(ScrollOffsetAnimationsImpl*,
+ base::TimeTicks frame_monotonic_time);
+
+ private:
+ std::vector<ScrollOffsetAnimationUpdate> queue_;
loyso (OOO) 2016/05/06 01:04:38 using UpdatesQueue = std::vector<ScrollOffsetAnima
ymalik 2016/05/06 05:41:49 Done.
+};
+
+} // namespace cc
+
+#endif // CC_ANIMATION_SCROLL_OFFSET_ANIMATIONS_H_

Powered by Google App Engine
This is Rietveld 408576698