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

Side by Side Diff: cc/animation/scroll_offset_animations.cc

Issue 2261113002: CC Animation: Introduce some dirty flags to optimize PushProperties on commit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #include "cc/animation/scroll_offset_animations.h" 5 #include "cc/animation/scroll_offset_animations.h"
6 6
7 #include "cc/animation/animation_host.h" 7 #include "cc/animation/animation_host.h"
8 8
9 namespace cc { 9 namespace cc {
10 10
(...skipping 15 matching lines...) Expand all
26 ? ScrollOffsetAnimationUpdate(element_id) 26 ? ScrollOffsetAnimationUpdate(element_id)
27 : iter->second; 27 : iter->second;
28 } 28 }
29 29
30 void ScrollOffsetAnimations::AddAdjustmentUpdate(ElementId element_id, 30 void ScrollOffsetAnimations::AddAdjustmentUpdate(ElementId element_id,
31 gfx::Vector2dF adjustment) { 31 gfx::Vector2dF adjustment) {
32 DCHECK(element_id); 32 DCHECK(element_id);
33 ScrollOffsetAnimationUpdate update = GetUpdateForElementId(element_id); 33 ScrollOffsetAnimationUpdate update = GetUpdateForElementId(element_id);
34 update.adjustment_ += adjustment; 34 update.adjustment_ += adjustment;
35 element_to_update_map_[element_id] = update; 35 element_to_update_map_[element_id] = update;
36 animation_host_->SetNeedsCommit(); 36 animation_host_->SetNeedsPushProperties();
37 } 37 }
38 38
39 void ScrollOffsetAnimations::AddTakeoverUpdate(ElementId element_id) { 39 void ScrollOffsetAnimations::AddTakeoverUpdate(ElementId element_id) {
40 DCHECK(element_id); 40 DCHECK(element_id);
41 ScrollOffsetAnimationUpdate update = GetUpdateForElementId(element_id); 41 ScrollOffsetAnimationUpdate update = GetUpdateForElementId(element_id);
42 update.takeover_ = true; 42 update.takeover_ = true;
43 element_to_update_map_[element_id] = update; 43 element_to_update_map_[element_id] = update;
44 animation_host_->SetNeedsCommit(); 44 animation_host_->SetNeedsPushProperties();
45 } 45 }
46 46
47 bool ScrollOffsetAnimations::HasUpdatesForTesting() const { 47 bool ScrollOffsetAnimations::HasUpdatesForTesting() const {
48 return !element_to_update_map_.empty(); 48 return !element_to_update_map_.empty();
49 } 49 }
50 50
51 void ScrollOffsetAnimations::PushPropertiesTo( 51 void ScrollOffsetAnimations::PushPropertiesTo(
52 ScrollOffsetAnimationsImpl* animations) { 52 ScrollOffsetAnimationsImpl* animations) {
53 DCHECK(animations); 53 DCHECK(animations);
54 if (element_to_update_map_.empty()) 54 if (element_to_update_map_.empty())
55 return; 55 return;
56 56
57 for (auto& kv : element_to_update_map_) { 57 for (auto& kv : element_to_update_map_) {
58 const auto& update = kv.second; 58 const auto& update = kv.second;
59 if (update.takeover_) 59 if (update.takeover_)
60 animations->ScrollAnimationAbort(true /*needs_completion*/); 60 animations->ScrollAnimationAbort(true /*needs_completion*/);
61 else 61 else
62 animations->ScrollAnimationApplyAdjustment(update.element_id_, 62 animations->ScrollAnimationApplyAdjustment(update.element_id_,
63 update.adjustment_); 63 update.adjustment_);
64 } 64 }
65 element_to_update_map_.clear(); 65 element_to_update_map_.clear();
66 } 66 }
67 67
68 } // namespace cc 68 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698