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

Unified Diff: cc/animation/scroll_offset_animations.h

Issue 2006103004: Send takeover msg from MT to CC using the animation path. (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
index 26b07d52c273341b887a402346018ef9d2288cdb..04d4664a4cdabd74c96fb5e505c518ba17ef34e6 100644
--- a/cc/animation/scroll_offset_animations.h
+++ b/cc/animation/scroll_offset_animations.h
@@ -5,6 +5,8 @@
#ifndef CC_ANIMATION_SCROLL_OFFSET_ANIMATIONS_H_
#define CC_ANIMATION_SCROLL_OFFSET_ANIMATIONS_H_
+#include <unordered_map>
+
#include "cc/animation/scroll_offset_animations_impl.h"
#include "cc/trees/mutator_host_client.h"
@@ -14,16 +16,17 @@ namespace cc {
// that may impact an impl-only scroll offset animation.
// Note that this class only exists on the main thread.
struct CC_EXPORT ScrollOffsetAnimationUpdate {
- enum Type { SCROLL_OFFSET_CHANGED };
-
- ScrollOffsetAnimationUpdate(Type, ElementId);
+ explicit ScrollOffsetAnimationUpdate(ElementId);
- Type type_;
// The element to which this update applies.
ElementId element_id_;
// The amount by which the scroll offset is changed on the main thread.
gfx::Vector2dF adjustment_;
+
+ // If set to true, abort the currently running impl only scroll offset
+ // animation running on cc and finish it on the main thread.
+ bool takeover_;
};
// ScrollOffsetAnimations contains a list of ScrollOffsetAnimationUpdates.
@@ -34,7 +37,9 @@ class CC_EXPORT ScrollOffsetAnimations {
explicit ScrollOffsetAnimations(AnimationHost* animation_host);
~ScrollOffsetAnimations();
- void AddUpdate(ScrollOffsetAnimationUpdate);
+ void AddAdjustmentUpdate(ElementId, gfx::Vector2dF adjustment);
+ void AddTakeoverUpdate(ElementId);
+
bool HasUpdatesForTesting() const;
// Goes through the updates in the order in which they're added and calls the
@@ -42,8 +47,11 @@ class CC_EXPORT ScrollOffsetAnimations {
void PushPropertiesTo(ScrollOffsetAnimationsImpl*);
private:
- using UpdatesQueue = std::vector<ScrollOffsetAnimationUpdate>;
- UpdatesQueue queue_;
+ ScrollOffsetAnimationUpdate GetUpdateForElementId(ElementId) const;
+
+ using ElementToUpdate =
skobes 2016/05/24 23:50:50 I'd call this UpdateMap or maybe ElementToUpdateMa
ymalik 2016/05/25 16:09:05 Done.
+ std::unordered_map<ElementId, ScrollOffsetAnimationUpdate>;
+ ElementToUpdate element_to_update_map_;
AnimationHost* animation_host_;
};

Powered by Google App Engine
This is Rietveld 408576698