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

Side by Side Diff: third_party/WebKit/Source/platform/mac/ScrollAnimatorMac.mm

Issue 1477113003: [Oilpan] Move ScrollAnimators onto oilpan heap (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rename Created 5 years 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 /* 1 /*
2 * Copyright (C) 2010, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 [_trackAlphaAnimation.get() invalidate]; 672 [_trackAlphaAnimation.get() invalidate];
673 [_uiStateTransitionAnimation.get() invalidate]; 673 [_uiStateTransitionAnimation.get() invalidate];
674 [_expansionTransitionAnimation.get() invalidate]; 674 [_expansionTransitionAnimation.get() invalidate];
675 END_BLOCK_OBJC_EXCEPTIONS; 675 END_BLOCK_OBJC_EXCEPTIONS;
676 } 676 }
677 677
678 @end 678 @end
679 679
680 namespace blink { 680 namespace blink {
681 681
682 PassOwnPtr<ScrollAnimatorBase> ScrollAnimatorBase::create(ScrollableArea* scroll ableArea) 682 PassOwnPtrWillBeRawPtr<ScrollAnimatorBase> ScrollAnimatorBase::create(Scrollable Area* scrollableArea)
683 { 683 {
684 return adoptPtr(new ScrollAnimatorMac(scrollableArea)); 684 return adoptPtrWillBeNoop(new ScrollAnimatorMac(scrollableArea));
685 } 685 }
686 686
687 ScrollAnimatorMac::ScrollAnimatorMac(ScrollableArea* scrollableArea) 687 ScrollAnimatorMac::ScrollAnimatorMac(ScrollableArea* scrollableArea)
688 : ScrollAnimatorBase(scrollableArea) 688 : ScrollAnimatorBase(scrollableArea)
689 , m_initialScrollbarPaintTimer(this, &ScrollAnimatorMac::initialScrollbarPai ntTimerFired) 689 , m_initialScrollbarPaintTimer(this, &ScrollAnimatorMac::initialScrollbarPai ntTimerFired)
690 , m_sendContentAreaScrolledTimer(this, &ScrollAnimatorMac::sendContentAreaSc rolledTimerFired) 690 , m_sendContentAreaScrolledTimer(this, &ScrollAnimatorMac::sendContentAreaSc rolledTimerFired)
691 , m_haveScrolledSincePageLoad(false) 691 , m_haveScrolledSincePageLoad(false)
692 , m_needsScrollerStyleUpdate(false) 692 , m_needsScrollerStyleUpdate(false)
693 { 693 {
694 #if ENABLE(OILPAN)
695 ThreadState::current()->registerPreFinalizer(this);
696 #endif
697
694 m_scrollAnimationHelperDelegate.adoptNS([[WebScrollAnimationHelperDelegate a lloc] initWithScrollAnimator:this]); 698 m_scrollAnimationHelperDelegate.adoptNS([[WebScrollAnimationHelperDelegate a lloc] initWithScrollAnimator:this]);
695 m_scrollAnimationHelper.adoptNS([[NSClassFromString(@"NSScrollAnimationHelpe r") alloc] initWithDelegate:m_scrollAnimationHelperDelegate.get()]); 699 m_scrollAnimationHelper.adoptNS([[NSClassFromString(@"NSScrollAnimationHelpe r") alloc] initWithDelegate:m_scrollAnimationHelperDelegate.get()]);
696 700
697 if (ScrollbarThemeMacCommon::isOverlayAPIAvailable()) { 701 if (ScrollbarThemeMacCommon::isOverlayAPIAvailable()) {
698 m_scrollbarPainterControllerDelegate.adoptNS([[WebScrollbarPainterContro llerDelegate alloc] initWithScrollableArea:scrollableArea]); 702 m_scrollbarPainterControllerDelegate.adoptNS([[WebScrollbarPainterContro llerDelegate alloc] initWithScrollableArea:scrollableArea]);
699 m_scrollbarPainterController = [[[NSClassFromString(@"NSScrollerImpPair" ) alloc] init] autorelease]; 703 m_scrollbarPainterController = [[[NSClassFromString(@"NSScrollerImpPair" ) alloc] init] autorelease];
700 [m_scrollbarPainterController.get() performSelector:@selector(setDelegat e:) withObject:m_scrollbarPainterControllerDelegate.get()]; 704 [m_scrollbarPainterController.get() performSelector:@selector(setDelegat e:) withObject:m_scrollbarPainterControllerDelegate.get()];
701 [m_scrollbarPainterController.get() setScrollerStyle:ScrollbarThemeMacCo mmon::recommendedScrollerStyle()]; 705 [m_scrollbarPainterController.get() setScrollerStyle:ScrollbarThemeMacCo mmon::recommendedScrollerStyle()];
702 } 706 }
703 } 707 }
704 708
705 ScrollAnimatorMac::~ScrollAnimatorMac() 709 ScrollAnimatorMac::~ScrollAnimatorMac()
706 { 710 {
711 #if !ENABLE(OILPAN)
712 dispose();
713 #endif
714 }
715
716 void ScrollAnimatorMac::dispose()
717 {
707 if (ScrollbarThemeMacCommon::isOverlayAPIAvailable()) { 718 if (ScrollbarThemeMacCommon::isOverlayAPIAvailable()) {
708 BEGIN_BLOCK_OBJC_EXCEPTIONS; 719 BEGIN_BLOCK_OBJC_EXCEPTIONS;
709 [m_scrollbarPainterControllerDelegate.get() invalidate]; 720 [m_scrollbarPainterControllerDelegate.get() invalidate];
710 [m_scrollbarPainterController.get() setDelegate:nil]; 721 [m_scrollbarPainterController.get() setDelegate:nil];
711 [m_horizontalScrollbarPainterDelegate.get() invalidate]; 722 [m_horizontalScrollbarPainterDelegate.get() invalidate];
712 [m_verticalScrollbarPainterDelegate.get() invalidate]; 723 [m_verticalScrollbarPainterDelegate.get() invalidate];
713 [m_scrollAnimationHelperDelegate.get() invalidate]; 724 [m_scrollAnimationHelperDelegate.get() invalidate];
714 END_BLOCK_OBJC_EXCEPTIONS; 725 END_BLOCK_OBJC_EXCEPTIONS;
715 } 726 }
727 m_initialScrollbarPaintTimer.stop();
728 m_sendContentAreaScrolledTimer.stop();
716 } 729 }
717 730
718 ScrollResultOneDimensional ScrollAnimatorMac::userScroll(ScrollbarOrientation or ientation, ScrollGranularity granularity, float step, float delta) 731 ScrollResultOneDimensional ScrollAnimatorMac::userScroll(ScrollbarOrientation or ientation, ScrollGranularity granularity, float step, float delta)
719 { 732 {
720 bool scrollAnimationEnabledForSystem = static_cast<ScrollbarThemeMacCommon*> ( 733 bool scrollAnimationEnabledForSystem = static_cast<ScrollbarThemeMacCommon*> (
721 ScrollbarTheme::theme()) 734 ScrollbarTheme::theme())
722 ->scrollAnimationEnabledForSystem (); 735 ->scrollAnimationEnabledForSystem ();
723 m_haveScrolledSincePageLoad = true; 736 m_haveScrolledSincePageLoad = true;
724 737
725 if (!scrollAnimationEnabledForSystem || !m_scrollableArea->scrollAnimatorEna bled()) 738 if (!scrollAnimationEnabledForSystem || !m_scrollableArea->scrollAnimatorEna bled())
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
1188 return; 1201 return;
1189 1202
1190 m_visibleScrollerThumbRect = rectInViewCoordinates; 1203 m_visibleScrollerThumbRect = rectInViewCoordinates;
1191 } 1204 }
1192 1205
1193 bool ScrollAnimatorMac::canUseCoordinatedScrollbar() { 1206 bool ScrollAnimatorMac::canUseCoordinatedScrollbar() {
1194 return ScrollbarThemeMacCommon::isOverlayAPIAvailable(); 1207 return ScrollbarThemeMacCommon::isOverlayAPIAvailable();
1195 } 1208 }
1196 1209
1197 } // namespace blink 1210 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698