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

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: Do not change SetNeedsCommit invalidation, leave it as-is. Created 4 years, 3 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
« no previous file with comments | « cc/animation/element_animations_unittest.cc ('k') | cc/test/animation_timelines_test_common.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 16 matching lines...) Expand all
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_->SetNeedsCommit();
37 animation_host_->SetNeedsPushProperties();
37 } 38 }
38 39
39 void ScrollOffsetAnimations::AddTakeoverUpdate(ElementId element_id) { 40 void ScrollOffsetAnimations::AddTakeoverUpdate(ElementId element_id) {
40 DCHECK(element_id); 41 DCHECK(element_id);
41 ScrollOffsetAnimationUpdate update = GetUpdateForElementId(element_id); 42 ScrollOffsetAnimationUpdate update = GetUpdateForElementId(element_id);
42 update.takeover_ = true; 43 update.takeover_ = true;
43 element_to_update_map_[element_id] = update; 44 element_to_update_map_[element_id] = update;
44 animation_host_->SetNeedsCommit(); 45 animation_host_->SetNeedsCommit();
46 animation_host_->SetNeedsPushProperties();
45 } 47 }
46 48
47 bool ScrollOffsetAnimations::HasUpdatesForTesting() const { 49 bool ScrollOffsetAnimations::HasUpdatesForTesting() const {
48 return !element_to_update_map_.empty(); 50 return !element_to_update_map_.empty();
49 } 51 }
50 52
51 void ScrollOffsetAnimations::PushPropertiesTo( 53 void ScrollOffsetAnimations::PushPropertiesTo(
52 ScrollOffsetAnimationsImpl* animations) { 54 ScrollOffsetAnimationsImpl* animations) {
53 DCHECK(animations); 55 DCHECK(animations);
54 if (element_to_update_map_.empty()) 56 if (element_to_update_map_.empty())
55 return; 57 return;
56 58
57 for (auto& kv : element_to_update_map_) { 59 for (auto& kv : element_to_update_map_) {
58 const auto& update = kv.second; 60 const auto& update = kv.second;
59 if (update.takeover_) 61 if (update.takeover_)
60 animations->ScrollAnimationAbort(true /*needs_completion*/); 62 animations->ScrollAnimationAbort(true /*needs_completion*/);
61 else 63 else
62 animations->ScrollAnimationApplyAdjustment(update.element_id_, 64 animations->ScrollAnimationApplyAdjustment(update.element_id_,
63 update.adjustment_); 65 update.adjustment_);
64 } 66 }
65 element_to_update_map_.clear(); 67 element_to_update_map_.clear();
66 } 68 }
67 69
68 } // namespace cc 70 } // namespace cc
OLDNEW
« no previous file with comments | « cc/animation/element_animations_unittest.cc ('k') | cc/test/animation_timelines_test_common.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698