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

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

Issue 2040543002: Take MT jank into account when animating the scroll offset on CC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add test + apply suggested improvement 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/animation_host.h ('k') | cc/animation/animation_host_unittest.cc » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/animation_host.h" 5 #include "cc/animation/animation_host.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 } 498 }
499 499
500 bool AnimationHost::HasActiveAnimationForTesting(ElementId element_id) const { 500 bool AnimationHost::HasActiveAnimationForTesting(ElementId element_id) const {
501 auto element_animations = GetElementAnimationsForElementId(element_id); 501 auto element_animations = GetElementAnimationsForElementId(element_id);
502 return element_animations ? element_animations->HasActiveAnimation() : false; 502 return element_animations ? element_animations->HasActiveAnimation() : false;
503 } 503 }
504 504
505 void AnimationHost::ImplOnlyScrollAnimationCreate( 505 void AnimationHost::ImplOnlyScrollAnimationCreate(
506 ElementId element_id, 506 ElementId element_id,
507 const gfx::ScrollOffset& target_offset, 507 const gfx::ScrollOffset& target_offset,
508 const gfx::ScrollOffset& current_offset) { 508 const gfx::ScrollOffset& current_offset,
509 base::TimeDelta delayed_by) {
509 DCHECK(scroll_offset_animations_impl_); 510 DCHECK(scroll_offset_animations_impl_);
510 scroll_offset_animations_impl_->ScrollAnimationCreate( 511 scroll_offset_animations_impl_->ScrollAnimationCreate(
511 element_id, target_offset, current_offset); 512 element_id, target_offset, current_offset, delayed_by);
512 } 513 }
513 514
514 bool AnimationHost::ImplOnlyScrollAnimationUpdateTarget( 515 bool AnimationHost::ImplOnlyScrollAnimationUpdateTarget(
515 ElementId element_id, 516 ElementId element_id,
516 const gfx::Vector2dF& scroll_delta, 517 const gfx::Vector2dF& scroll_delta,
517 const gfx::ScrollOffset& max_scroll_offset, 518 const gfx::ScrollOffset& max_scroll_offset,
518 base::TimeTicks frame_monotonic_time) { 519 base::TimeTicks frame_monotonic_time,
520 base::TimeDelta delayed_by) {
519 DCHECK(scroll_offset_animations_impl_); 521 DCHECK(scroll_offset_animations_impl_);
520 return scroll_offset_animations_impl_->ScrollAnimationUpdateTarget( 522 return scroll_offset_animations_impl_->ScrollAnimationUpdateTarget(
521 element_id, scroll_delta, max_scroll_offset, frame_monotonic_time); 523 element_id, scroll_delta, max_scroll_offset, frame_monotonic_time,
524 delayed_by);
522 } 525 }
523 526
524 ScrollOffsetAnimations& AnimationHost::scroll_offset_animations() const { 527 ScrollOffsetAnimations& AnimationHost::scroll_offset_animations() const {
525 DCHECK(scroll_offset_animations_); 528 DCHECK(scroll_offset_animations_);
526 return *scroll_offset_animations_.get(); 529 return *scroll_offset_animations_.get();
527 } 530 }
528 531
529 void AnimationHost::ScrollAnimationAbort(bool needs_completion) { 532 void AnimationHost::ScrollAnimationAbort(bool needs_completion) {
530 DCHECK(scroll_offset_animations_impl_); 533 DCHECK(scroll_offset_animations_impl_);
531 return scroll_offset_animations_impl_->ScrollAnimationAbort(needs_completion); 534 return scroll_offset_animations_impl_->ScrollAnimationAbort(needs_completion);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 const AnimationHost::ElementToAnimationsMap& 569 const AnimationHost::ElementToAnimationsMap&
567 AnimationHost::all_element_animations_for_testing() const { 570 AnimationHost::all_element_animations_for_testing() const {
568 return element_to_animations_map_; 571 return element_to_animations_map_;
569 } 572 }
570 573
571 void AnimationHost::OnAnimationWaitingForDeletion() { 574 void AnimationHost::OnAnimationWaitingForDeletion() {
572 animation_waiting_for_deletion_ = true; 575 animation_waiting_for_deletion_ = true;
573 } 576 }
574 577
575 } // namespace cc 578 } // namespace cc
OLDNEW
« no previous file with comments | « cc/animation/animation_host.h ('k') | cc/animation/animation_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698