Changeset 243298 in webkit
- Timestamp:
- Mar 21, 2019, 10:21:38 AM (7 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 7 edited
-
ChangeLog (modified) (1 diff)
-
platform/cocoa/VideoFullscreenChangeObserver.h (modified) (2 diffs)
-
platform/cocoa/VideoFullscreenModel.h (modified) (2 diffs)
-
platform/ios/VideoFullscreenInterfaceAVKit.h (modified) (3 diffs)
-
platform/ios/VideoFullscreenInterfaceAVKit.mm (modified) (8 diffs)
-
platform/mac/VideoFullscreenInterfaceMac.h (modified) (3 diffs)
-
platform/mac/VideoFullscreenInterfaceMac.mm (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r243296 r243298 1 2019-03-21 Brent Fulgham <bfulgham@apple.com> 2 3 Hardening: Use WeakPtrs in VideoFullscreenInterface{Mac,AVKit} 4 https://bugs.webkit.org/show_bug.cgi?id=196052 5 <rdar://problem/48778571> 6 7 Reviewed by Eric Carlson. 8 9 The VideoFullscreenInterface{Mac,AVKit} implementations store their fullscreen model 10 and fullscreen change observer members as bare pointers, something we've been working 11 to eliminate. 12 13 This patch corrects this oversight. 14 15 No new tests since no changes in behavior. 16 17 * platform/cocoa/VideoFullscreenChangeObserver.h: 18 * platform/cocoa/VideoFullscreenModel.h: 19 * platform/ios/VideoFullscreenInterfaceAVKit.h: 20 * platform/ios/VideoFullscreenInterfaceAVKit.mm: 21 (VideoFullscreenInterfaceAVKit::setVideoFullscreenModel): 22 (VideoFullscreenInterfaceAVKit::setVideoFullscreenChangeObserver): 23 (VideoFullscreenInterfaceAVKit::presentingViewController): 24 (VideoFullscreenInterfaceAVKit::invalidate): 25 (VideoFullscreenInterfaceAVKit::preparedToExitFullscreen): 26 (VideoFullscreenInterfaceAVKit::shouldExitFullscreenWithReason): 27 (VideoFullscreenInterfaceAVKit::doSetup): 28 * platform/mac/VideoFullscreenInterfaceMac.h: 29 (WebCore::VideoFullscreenInterfaceMac::videoFullscreenModel const): 30 (WebCore::VideoFullscreenInterfaceMac::videoFullscreenChangeObserver const): 31 * platform/mac/VideoFullscreenInterfaceMac.mm: 32 (WebCore::VideoFullscreenInterfaceMac::setVideoFullscreenModel): 33 (WebCore::VideoFullscreenInterfaceMac::setVideoFullscreenChangeObserver): 34 (WebCore::VideoFullscreenInterfaceMac::enterFullscreen): 35 (WebCore::VideoFullscreenInterfaceMac::invalidate): 36 1 37 2019-03-21 Megan Gardner <megan_gardner@apple.com> 2 38 -
trunk/Source/WebCore/platform/cocoa/VideoFullscreenChangeObserver.h
r237266 r243298 1 1 /* 2 * Copyright (C) 2016 Apple Inc. All rights reserved.2 * Copyright (C) 2016-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 31 31 namespace WebCore { 32 32 33 class VideoFullscreenChangeObserver {33 class VideoFullscreenChangeObserver : public CanMakeWeakPtr<VideoFullscreenChangeObserver> { 34 34 public: 35 35 virtual ~VideoFullscreenChangeObserver() { }; -
trunk/Source/WebCore/platform/cocoa/VideoFullscreenModel.h
r238528 r243298 1 1 /* 2 * Copyright (C) 2014 Apple Inc. All rights reserved.2 * Copyright (C) 2014-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 45 45 class VideoFullscreenModelClient; 46 46 47 class VideoFullscreenModel {47 class VideoFullscreenModel : public CanMakeWeakPtr<VideoFullscreenModel> { 48 48 public: 49 49 virtual ~VideoFullscreenModel() { }; -
trunk/Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.h
r238528 r243298 1 1 /* 2 * Copyright (C) 2014-201 8Apple Inc. All rights reserved.2 * Copyright (C) 2014-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 128 128 Mode m_targetMode; 129 129 130 VideoFullscreenModel* videoFullscreenModel() const { return m_videoFullscreenModel ; }130 VideoFullscreenModel* videoFullscreenModel() const { return m_videoFullscreenModel.get(); } 131 131 bool shouldExitFullscreenWithReason(ExitFullScreenReason); 132 132 HTMLMediaElementEnums::VideoFullscreenMode mode() const { return m_currentMode.mode(); } … … 172 172 RetainPtr<WebAVPlayerViewControllerDelegate> m_playerViewControllerDelegate; 173 173 RetainPtr<WebAVPlayerViewController> m_playerViewController; 174 VideoFullscreenModel* m_videoFullscreenModel { nullptr };175 VideoFullscreenChangeObserver* m_fullscreenChangeObserver { nullptr };174 WeakPtr<VideoFullscreenModel> m_videoFullscreenModel; 175 WeakPtr<VideoFullscreenChangeObserver> m_fullscreenChangeObserver; 176 176 177 177 // These are only used when fullscreen is presented in a separate window. -
trunk/Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.mm
r240168 r243298 1 1 /* 2 * Copyright (C) 2014-201 8Apple Inc. All rights reserved.2 * Copyright (C) 2014-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 764 764 m_videoFullscreenModel->removeClient(*this); 765 765 766 m_videoFullscreenModel = m odel;766 m_videoFullscreenModel = makeWeakPtr(model); 767 767 768 768 if (m_videoFullscreenModel) { … … 783 783 void VideoFullscreenInterfaceAVKit::setVideoFullscreenChangeObserver(VideoFullscreenChangeObserver* observer) 784 784 { 785 m_fullscreenChangeObserver = observer;785 m_fullscreenChangeObserver = makeWeakPtr(observer); 786 786 } 787 787 … … 834 834 UIViewController *VideoFullscreenInterfaceAVKit::presentingViewController() 835 835 { 836 auto *controller = videoFullscreenModel() ->presentingViewController();836 auto *controller = videoFullscreenModel() ? videoFullscreenModel()->presentingViewController() : nil; 837 837 if (!controller) 838 838 controller = fallbackViewController(m_parentView.get()); … … 928 928 void VideoFullscreenInterfaceAVKit::invalidate() 929 929 { 930 m_videoFullscreenModel = n il;931 m_fullscreenChangeObserver = n il;930 m_videoFullscreenModel = nullptr; 931 m_fullscreenChangeObserver = nullptr; 932 932 933 933 cleanupFullscreen(); … … 967 967 968 968 m_waitingForPreparedToExit = false; 969 m_videoFullscreenModel->requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenModeNone, true); 969 ASSERT(m_videoFullscreenModel); 970 if (m_videoFullscreenModel) 971 m_videoFullscreenModel->requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenModeNone, true); 970 972 #endif 971 973 } … … 1136 1138 1137 1139 BOOL finished = reason == ExitFullScreenReason::DoneButtonTapped || reason == ExitFullScreenReason::PinchGestureHandled; 1138 m_videoFullscreenModel->requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenModeNone, finished); 1140 ASSERT(m_videoFullscreenModel); 1141 if (m_videoFullscreenModel) 1142 m_videoFullscreenModel->requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenModeNone, finished); 1139 1143 1140 1144 return false; … … 1243 1247 1244 1248 #if PLATFORM(WATCHOS) 1245 m_viewController = videoFullscreenModel() ->createVideoFullscreenViewController(m_playerViewController.get().avPlayerViewController);1249 m_viewController = videoFullscreenModel() ? videoFullscreenModel()->createVideoFullscreenViewController(m_playerViewController.get().avPlayerViewController) : nil; 1246 1250 #endif 1247 1251 -
trunk/Source/WebCore/platform/mac/VideoFullscreenInterfaceMac.h
r236748 r243298 1 1 /* 2 * Copyright (C) 2016 Apple Inc. All rights reserved.2 * Copyright (C) 2016-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 57 57 virtual ~VideoFullscreenInterfaceMac(); 58 58 PlaybackSessionInterfaceMac& playbackSessionInterface() const { return m_playbackSessionInterface.get(); } 59 VideoFullscreenModel* videoFullscreenModel() const { return m_videoFullscreenModel ; }59 VideoFullscreenModel* videoFullscreenModel() const { return m_videoFullscreenModel.get(); } 60 60 PlaybackSessionModel* playbackSessionModel() const { return m_playbackSessionInterface->playbackSessionModel(); } 61 61 WEBCORE_EXPORT void setVideoFullscreenModel(VideoFullscreenModel*); 62 VideoFullscreenChangeObserver* videoFullscreenChangeObserver() const { return m_fullscreenChangeObserver ; }62 VideoFullscreenChangeObserver* videoFullscreenChangeObserver() const { return m_fullscreenChangeObserver.get(); } 63 63 WEBCORE_EXPORT void setVideoFullscreenChangeObserver(VideoFullscreenChangeObserver*); 64 64 … … 100 100 WEBCORE_EXPORT VideoFullscreenInterfaceMac(PlaybackSessionInterfaceMac&); 101 101 Ref<PlaybackSessionInterfaceMac> m_playbackSessionInterface; 102 VideoFullscreenModel* m_videoFullscreenModel { nullptr };103 VideoFullscreenChangeObserver* m_fullscreenChangeObserver { nullptr };102 WeakPtr<VideoFullscreenModel> m_videoFullscreenModel; 103 WeakPtr<VideoFullscreenChangeObserver> m_fullscreenChangeObserver; 104 104 HTMLMediaElementEnums::VideoFullscreenMode m_mode { HTMLMediaElementEnums::VideoFullscreenModeNone }; 105 105 RetainPtr<WebVideoFullscreenInterfaceMacObjC> m_webVideoFullscreenInterfaceObjC; -
trunk/Source/WebCore/platform/mac/VideoFullscreenInterfaceMac.mm
r240822 r243298 1 1 /* 2 * Copyright (C) 2016 Apple Inc. All rights reserved.2 * Copyright (C) 2016-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 377 377 if (m_videoFullscreenModel) 378 378 m_videoFullscreenModel->removeClient(*this); 379 m_videoFullscreenModel = m odel;379 m_videoFullscreenModel = makeWeakPtr(model); 380 380 if (m_videoFullscreenModel) 381 381 m_videoFullscreenModel->addClient(*this); … … 384 384 void VideoFullscreenInterfaceMac::setVideoFullscreenChangeObserver(VideoFullscreenChangeObserver* observer) 385 385 { 386 m_fullscreenChangeObserver = observer;386 m_fullscreenChangeObserver = makeWeakPtr(observer); 387 387 } 388 388 … … 448 448 LOG(Fullscreen, "VideoFullscreenInterfaceMac::enterFullscreen(%p)", this); 449 449 450 RELEASE_ASSERT(m_videoFullscreenModel); 450 451 if (mode() == HTMLMediaElementEnums::VideoFullscreenModePictureInPicture) { 451 452 m_videoFullscreenModel->willEnterPictureInPicture(); … … 511 512 LOG(Fullscreen, "VideoFullscreenInterfaceMac::invalidate(%p)", this); 512 513 513 m_videoFullscreenModel = n il;514 m_fullscreenChangeObserver = n il;514 m_videoFullscreenModel = nullptr; 515 m_fullscreenChangeObserver = nullptr; 515 516 516 517 cleanupFullscreen();
Note:
See TracChangeset
for help on using the changeset viewer.