Changeset 243579 in webkit
- Timestamp:
- Mar 27, 2019, 4:43:57 PM (7 years ago)
- Location:
- branches/safari-607-branch/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
-
branches/safari-607-branch/Source/WebCore/ChangeLog
r243575 r243579 1 2019-03-27 Alan Coon <alancoon@apple.com> 2 3 Cherry-pick r243298. rdar://problem/49308011 4 5 Hardening: Use WeakPtrs in VideoFullscreenInterface{Mac,AVKit} 6 https://bugs.webkit.org/show_bug.cgi?id=196052 7 <rdar://problem/48778571> 8 9 Reviewed by Eric Carlson. 10 11 The VideoFullscreenInterface{Mac,AVKit} implementations store their fullscreen model 12 and fullscreen change observer members as bare pointers, something we've been working 13 to eliminate. 14 15 This patch corrects this oversight. 16 17 No new tests since no changes in behavior. 18 19 * platform/cocoa/VideoFullscreenChangeObserver.h: 20 * platform/cocoa/VideoFullscreenModel.h: 21 * platform/ios/VideoFullscreenInterfaceAVKit.h: 22 * platform/ios/VideoFullscreenInterfaceAVKit.mm: 23 (VideoFullscreenInterfaceAVKit::setVideoFullscreenModel): 24 (VideoFullscreenInterfaceAVKit::setVideoFullscreenChangeObserver): 25 (VideoFullscreenInterfaceAVKit::presentingViewController): 26 (VideoFullscreenInterfaceAVKit::invalidate): 27 (VideoFullscreenInterfaceAVKit::preparedToExitFullscreen): 28 (VideoFullscreenInterfaceAVKit::shouldExitFullscreenWithReason): 29 (VideoFullscreenInterfaceAVKit::doSetup): 30 * platform/mac/VideoFullscreenInterfaceMac.h: 31 (WebCore::VideoFullscreenInterfaceMac::videoFullscreenModel const): 32 (WebCore::VideoFullscreenInterfaceMac::videoFullscreenChangeObserver const): 33 * platform/mac/VideoFullscreenInterfaceMac.mm: 34 (WebCore::VideoFullscreenInterfaceMac::setVideoFullscreenModel): 35 (WebCore::VideoFullscreenInterfaceMac::setVideoFullscreenChangeObserver): 36 (WebCore::VideoFullscreenInterfaceMac::enterFullscreen): 37 (WebCore::VideoFullscreenInterfaceMac::invalidate): 38 39 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243298 268f45cc-cd09-0410-ab3c-d52691b4dbfc 40 41 2019-03-21 Brent Fulgham <bfulgham@apple.com> 42 43 Hardening: Use WeakPtrs in VideoFullscreenInterface{Mac,AVKit} 44 https://bugs.webkit.org/show_bug.cgi?id=196052 45 <rdar://problem/48778571> 46 47 Reviewed by Eric Carlson. 48 49 The VideoFullscreenInterface{Mac,AVKit} implementations store their fullscreen model 50 and fullscreen change observer members as bare pointers, something we've been working 51 to eliminate. 52 53 This patch corrects this oversight. 54 55 No new tests since no changes in behavior. 56 57 * platform/cocoa/VideoFullscreenChangeObserver.h: 58 * platform/cocoa/VideoFullscreenModel.h: 59 * platform/ios/VideoFullscreenInterfaceAVKit.h: 60 * platform/ios/VideoFullscreenInterfaceAVKit.mm: 61 (VideoFullscreenInterfaceAVKit::setVideoFullscreenModel): 62 (VideoFullscreenInterfaceAVKit::setVideoFullscreenChangeObserver): 63 (VideoFullscreenInterfaceAVKit::presentingViewController): 64 (VideoFullscreenInterfaceAVKit::invalidate): 65 (VideoFullscreenInterfaceAVKit::preparedToExitFullscreen): 66 (VideoFullscreenInterfaceAVKit::shouldExitFullscreenWithReason): 67 (VideoFullscreenInterfaceAVKit::doSetup): 68 * platform/mac/VideoFullscreenInterfaceMac.h: 69 (WebCore::VideoFullscreenInterfaceMac::videoFullscreenModel const): 70 (WebCore::VideoFullscreenInterfaceMac::videoFullscreenChangeObserver const): 71 * platform/mac/VideoFullscreenInterfaceMac.mm: 72 (WebCore::VideoFullscreenInterfaceMac::setVideoFullscreenModel): 73 (WebCore::VideoFullscreenInterfaceMac::setVideoFullscreenChangeObserver): 74 (WebCore::VideoFullscreenInterfaceMac::enterFullscreen): 75 (WebCore::VideoFullscreenInterfaceMac::invalidate): 76 1 77 2019-03-27 Alan Coon <alancoon@apple.com> 2 78 -
branches/safari-607-branch/Source/WebCore/platform/cocoa/VideoFullscreenChangeObserver.h
r237266 r243579 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() { }; -
branches/safari-607-branch/Source/WebCore/platform/cocoa/VideoFullscreenModel.h
r238528 r243579 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() { }; -
branches/safari-607-branch/Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.h
r238528 r243579 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. -
branches/safari-607-branch/Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.mm
r239255 r243579 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 … … 772 772 m_videoFullscreenModel->removeClient(*this); 773 773 774 m_videoFullscreenModel = m odel;774 m_videoFullscreenModel = makeWeakPtr(model); 775 775 776 776 if (m_videoFullscreenModel) { … … 791 791 void VideoFullscreenInterfaceAVKit::setVideoFullscreenChangeObserver(VideoFullscreenChangeObserver* observer) 792 792 { 793 m_fullscreenChangeObserver = observer;793 m_fullscreenChangeObserver = makeWeakPtr(observer); 794 794 } 795 795 … … 842 842 UIViewController *VideoFullscreenInterfaceAVKit::presentingViewController() 843 843 { 844 auto *controller = videoFullscreenModel() ->presentingViewController();844 auto *controller = videoFullscreenModel() ? videoFullscreenModel()->presentingViewController() : nil; 845 845 if (!controller) 846 846 controller = fallbackViewController(m_parentView.get()); … … 936 936 void VideoFullscreenInterfaceAVKit::invalidate() 937 937 { 938 m_videoFullscreenModel = n il;939 m_fullscreenChangeObserver = n il;938 m_videoFullscreenModel = nullptr; 939 m_fullscreenChangeObserver = nullptr; 940 940 941 941 cleanupFullscreen(); … … 975 975 976 976 m_waitingForPreparedToExit = false; 977 m_videoFullscreenModel->requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenModeNone, true); 977 ASSERT(m_videoFullscreenModel); 978 if (m_videoFullscreenModel) 979 m_videoFullscreenModel->requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenModeNone, true); 978 980 #endif 979 981 } … … 1144 1146 1145 1147 BOOL finished = reason == ExitFullScreenReason::DoneButtonTapped || reason == ExitFullScreenReason::PinchGestureHandled; 1146 m_videoFullscreenModel->requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenModeNone, finished); 1148 ASSERT(m_videoFullscreenModel); 1149 if (m_videoFullscreenModel) 1150 m_videoFullscreenModel->requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenModeNone, finished); 1147 1151 1148 1152 return false; … … 1251 1255 1252 1256 #if PLATFORM(WATCHOS) 1253 m_viewController = videoFullscreenModel() ->createVideoFullscreenViewController(m_playerViewController.get().avPlayerViewController);1257 m_viewController = videoFullscreenModel() ? videoFullscreenModel()->createVideoFullscreenViewController(m_playerViewController.get().avPlayerViewController) : nil; 1254 1258 #endif 1255 1259 -
branches/safari-607-branch/Source/WebCore/platform/mac/VideoFullscreenInterfaceMac.h
r236748 r243579 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; -
branches/safari-607-branch/Source/WebCore/platform/mac/VideoFullscreenInterfaceMac.mm
r241077 r243579 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.