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

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: Do not touch on-heap objects in destructors 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 22 matching lines...) Expand all
33 #include "platform/animation/TimingFunction.h" 33 #include "platform/animation/TimingFunction.h"
34 #include "platform/geometry/FloatRect.h" 34 #include "platform/geometry/FloatRect.h"
35 #include "platform/geometry/IntRect.h" 35 #include "platform/geometry/IntRect.h"
36 #include "platform/mac/BlockExceptions.h" 36 #include "platform/mac/BlockExceptions.h"
37 #include "platform/mac/NSScrollerImpDetails.h" 37 #include "platform/mac/NSScrollerImpDetails.h"
38 #include "platform/scroll/ScrollableArea.h" 38 #include "platform/scroll/ScrollableArea.h"
39 #include "platform/scroll/ScrollbarTheme.h" 39 #include "platform/scroll/ScrollbarTheme.h"
40 #include "platform/scroll/ScrollbarThemeMacCommon.h" 40 #include "platform/scroll/ScrollbarThemeMacCommon.h"
41 #include "platform/scroll/ScrollbarThemeMacOverlayAPI.h" 41 #include "platform/scroll/ScrollbarThemeMacOverlayAPI.h"
42 #include "wtf/MainThread.h" 42 #include "wtf/MainThread.h"
43 #include "wtf/PassOwnPtr.h"
44 43
45 using namespace blink; 44 using namespace blink;
46 45
47 static bool supportsUIStateTransitionProgress() 46 static bool supportsUIStateTransitionProgress()
48 { 47 {
49 // FIXME: This is temporary until all platforms that support ScrollbarPainte r support this part of the API. 48 // FIXME: This is temporary until all platforms that support ScrollbarPainte r support this part of the API.
50 static bool globalSupportsUIStateTransitionProgress = [NSClassFromString(@"N SScrollerImp") instancesRespondToSelector:@selector(mouseEnteredScroller)]; 49 static bool globalSupportsUIStateTransitionProgress = [NSClassFromString(@"N SScrollerImp") instancesRespondToSelector:@selector(mouseEnteredScroller)];
51 return globalSupportsUIStateTransitionProgress; 50 return globalSupportsUIStateTransitionProgress;
52 } 51 }
53 52
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 [_trackAlphaAnimation.get() invalidate]; 671 [_trackAlphaAnimation.get() invalidate];
673 [_uiStateTransitionAnimation.get() invalidate]; 672 [_uiStateTransitionAnimation.get() invalidate];
674 [_expansionTransitionAnimation.get() invalidate]; 673 [_expansionTransitionAnimation.get() invalidate];
675 END_BLOCK_OBJC_EXCEPTIONS; 674 END_BLOCK_OBJC_EXCEPTIONS;
676 } 675 }
677 676
678 @end 677 @end
679 678
680 namespace blink { 679 namespace blink {
681 680
682 PassOwnPtr<ScrollAnimatorBase> ScrollAnimatorBase::create(ScrollableArea* scroll ableArea) 681 ScrollAnimatorBase* ScrollAnimatorBase::create(ScrollableArea* scrollableArea)
683 { 682 {
684 return adoptPtr(new ScrollAnimatorMac(scrollableArea)); 683 return new ScrollAnimatorMac(scrollableArea);
685 } 684 }
686 685
687 ScrollAnimatorMac::ScrollAnimatorMac(ScrollableArea* scrollableArea) 686 ScrollAnimatorMac::ScrollAnimatorMac(ScrollableArea* scrollableArea)
688 : ScrollAnimatorBase(scrollableArea) 687 : ScrollAnimatorBase(scrollableArea)
689 , m_initialScrollbarPaintTimer(this, &ScrollAnimatorMac::initialScrollbarPai ntTimerFired) 688 , m_initialScrollbarPaintTimer(this, &ScrollAnimatorMac::initialScrollbarPai ntTimerFired)
690 , m_sendContentAreaScrolledTimer(this, &ScrollAnimatorMac::sendContentAreaSc rolledTimerFired) 689 , m_sendContentAreaScrolledTimer(this, &ScrollAnimatorMac::sendContentAreaSc rolledTimerFired)
691 , m_haveScrolledSincePageLoad(false) 690 , m_haveScrolledSincePageLoad(false)
692 , m_needsScrollerStyleUpdate(false) 691 , m_needsScrollerStyleUpdate(false)
693 { 692 {
693 ThreadState::current()->registerPreFinalizer(this);
694
694 m_scrollAnimationHelperDelegate.adoptNS([[WebScrollAnimationHelperDelegate a lloc] initWithScrollAnimator:this]); 695 m_scrollAnimationHelperDelegate.adoptNS([[WebScrollAnimationHelperDelegate a lloc] initWithScrollAnimator:this]);
695 m_scrollAnimationHelper.adoptNS([[NSClassFromString(@"NSScrollAnimationHelpe r") alloc] initWithDelegate:m_scrollAnimationHelperDelegate.get()]); 696 m_scrollAnimationHelper.adoptNS([[NSClassFromString(@"NSScrollAnimationHelpe r") alloc] initWithDelegate:m_scrollAnimationHelperDelegate.get()]);
696 697
697 if (ScrollbarThemeMacCommon::isOverlayAPIAvailable()) { 698 if (ScrollbarThemeMacCommon::isOverlayAPIAvailable()) {
698 m_scrollbarPainterControllerDelegate.adoptNS([[WebScrollbarPainterContro llerDelegate alloc] initWithScrollableArea:scrollableArea]); 699 m_scrollbarPainterControllerDelegate.adoptNS([[WebScrollbarPainterContro llerDelegate alloc] initWithScrollableArea:scrollableArea]);
699 m_scrollbarPainterController = [[[NSClassFromString(@"NSScrollerImpPair" ) alloc] init] autorelease]; 700 m_scrollbarPainterController = [[[NSClassFromString(@"NSScrollerImpPair" ) alloc] init] autorelease];
700 [m_scrollbarPainterController.get() performSelector:@selector(setDelegat e:) withObject:m_scrollbarPainterControllerDelegate.get()]; 701 [m_scrollbarPainterController.get() performSelector:@selector(setDelegat e:) withObject:m_scrollbarPainterControllerDelegate.get()];
701 [m_scrollbarPainterController.get() setScrollerStyle:ScrollbarThemeMacCo mmon::recommendedScrollerStyle()]; 702 [m_scrollbarPainterController.get() setScrollerStyle:ScrollbarThemeMacCo mmon::recommendedScrollerStyle()];
702 } 703 }
703 } 704 }
704 705
705 ScrollAnimatorMac::~ScrollAnimatorMac() 706 ScrollAnimatorMac::~ScrollAnimatorMac()
706 { 707 {
708 cleanup();
haraken 2015/12/03 03:47:11 Remove this. cleanup() is already called in the pr
peria 2015/12/03 05:02:14 Done.
709 }
710
711 void ScrollAnimatorMac::cleanup()
712 {
707 if (ScrollbarThemeMacCommon::isOverlayAPIAvailable()) { 713 if (ScrollbarThemeMacCommon::isOverlayAPIAvailable()) {
708 BEGIN_BLOCK_OBJC_EXCEPTIONS; 714 BEGIN_BLOCK_OBJC_EXCEPTIONS;
709 [m_scrollbarPainterControllerDelegate.get() invalidate]; 715 [m_scrollbarPainterControllerDelegate.get() invalidate];
710 [m_scrollbarPainterController.get() setDelegate:nil]; 716 [m_scrollbarPainterController.get() setDelegate:nil];
711 [m_horizontalScrollbarPainterDelegate.get() invalidate]; 717 [m_horizontalScrollbarPainterDelegate.get() invalidate];
712 [m_verticalScrollbarPainterDelegate.get() invalidate]; 718 [m_verticalScrollbarPainterDelegate.get() invalidate];
713 [m_scrollAnimationHelperDelegate.get() invalidate]; 719 [m_scrollAnimationHelperDelegate.get() invalidate];
714 END_BLOCK_OBJC_EXCEPTIONS; 720 END_BLOCK_OBJC_EXCEPTIONS;
715 } 721 }
722 m_initialScrollbarPaintTimer.stop();
723 m_sendContentAreaScrolledTimer.stop();
716 } 724 }
717 725
718 ScrollResultOneDimensional ScrollAnimatorMac::userScroll(ScrollbarOrientation or ientation, ScrollGranularity granularity, float step, float delta) 726 ScrollResultOneDimensional ScrollAnimatorMac::userScroll(ScrollbarOrientation or ientation, ScrollGranularity granularity, float step, float delta)
719 { 727 {
720 bool scrollAnimationEnabledForSystem = static_cast<ScrollbarThemeMacCommon*> ( 728 bool scrollAnimationEnabledForSystem = static_cast<ScrollbarThemeMacCommon*> (
721 ScrollbarTheme::theme()) 729 ScrollbarTheme::theme())
722 ->scrollAnimationEnabledForSystem (); 730 ->scrollAnimationEnabledForSystem ();
723 m_haveScrolledSincePageLoad = true; 731 m_haveScrolledSincePageLoad = true;
724 732
725 if (!scrollAnimationEnabledForSystem || !m_scrollableArea->scrollAnimatorEna bled()) 733 if (!scrollAnimationEnabledForSystem || !m_scrollableArea->scrollAnimatorEna bled())
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
1188 return; 1196 return;
1189 1197
1190 m_visibleScrollerThumbRect = rectInViewCoordinates; 1198 m_visibleScrollerThumbRect = rectInViewCoordinates;
1191 } 1199 }
1192 1200
1193 bool ScrollAnimatorMac::canUseCoordinatedScrollbar() { 1201 bool ScrollAnimatorMac::canUseCoordinatedScrollbar() {
1194 return ScrollbarThemeMacCommon::isOverlayAPIAvailable(); 1202 return ScrollbarThemeMacCommon::isOverlayAPIAvailable();
1195 } 1203 }
1196 1204
1197 } // namespace blink 1205 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698