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

Side by Side 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: review comments 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CC_ANIMATION_SCROLL_OFFSET_ANIMATIONS_H_
6 #define CC_ANIMATION_SCROLL_OFFSET_ANIMATIONS_H_
7
8 #include "cc/animation/scroll_offset_animations_impl.h"
9 #include "cc/trees/mutator_host_client.h"
10
11 namespace cc {
12
13 // A ScrollOffsetAnimationUpdate represents a change on the main thread
14 // that may impact an impl-only scroll offset animation.
15 // Note that this class only exists on the main thread.
16 struct CC_EXPORT ScrollOffsetAnimationUpdate {
17 enum Type { SCROLL_OFFSET_CHANGED };
18
19 ScrollOffsetAnimationUpdate(Type, ElementId);
20
21 Type type_;
22 // The element to which this update applies.
23 ElementId element_id_;
24
25 // The amount by which the scroll offset is changed on the main thread.
26 gfx::Vector2dF adjustment_;
27 };
28
29 // ScrollOffsetAnimations contains a list of ScrollOffsetAnimationUpdates.
30 // PushPropertiesTo is called during commit time and the necessary update is
31 // made to the impl-only animation.
32 class CC_EXPORT ScrollOffsetAnimations {
33 public:
34 explicit ScrollOffsetAnimations(AnimationHost* animation_host);
35 ~ScrollOffsetAnimations();
36
37 void AddUpdate(ScrollOffsetAnimationUpdate);
38 bool HasUpdatesForTesting() const;
39
40 // Goes through the updates in the order in which they're added and calls the
41 // appropriate handler for each update.
42 void PushPropertiesTo(ScrollOffsetAnimationsImpl*,
43 base::TimeTicks frame_monotonic_time);
44
45 private:
46 using UpdatesQueue = std::vector<ScrollOffsetAnimationUpdate>;
47 UpdatesQueue queue_;
48
49 AnimationHost* animation_host_;
50 };
51
52 } // namespace cc
53
54 #endif // CC_ANIMATION_SCROLL_OFFSET_ANIMATIONS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698