Changeset 247417 in webkit
- Timestamp:
- Jul 13, 2019 8:28:51 AM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r247416 r247417 1 2019-07-13 Chris Dumez <cdumez@apple.com> 2 3 Drop non thread-safe usage of WeakPtr in VideoFullscreenInterfaceAVKit 4 https://bugs.webkit.org/show_bug.cgi?id=199775 5 6 Reviewed by Eric Carlson. 7 8 The VideoFullscreenInterfaceAVKit constructor was making a weakPtr on the UI Thread 9 of an WebThread object. The WeakPtr would then be used as a data member throughout 10 the class on the UIThread. This is not thread-safe. 11 12 This patch switches to using a raw pointer instead of a WeakPtr. This is a partial 13 rollout of r243298, which turned the raw pointer into a WeakPtr for hardening 14 purposes. For extra safety, this patch updates the VideoFullscreenControllerContext 15 so that it notifies its clients (i.e. PlaybackSessionInterfaceAVKit) that it is 16 getting destroyed, so that they can null-out their m_videoFullscreenModel & 17 m_fullscreenChangeObserver data members. This gives the sames guarantees as WeakPtr 18 but in a thread-safe way. 19 20 This is very similar to the fix that was done for PlaybackSessionInterfaceAVKit in 21 r247380. 22 23 * platform/cocoa/VideoFullscreenModel.h: 24 (WebCore::VideoFullscreenModelClient::modelDestroyed): 25 * platform/ios/VideoFullscreenInterfaceAVKit.h: 26 * platform/ios/VideoFullscreenInterfaceAVKit.mm: 27 (VideoFullscreenInterfaceAVKit::setVideoFullscreenModel): 28 (VideoFullscreenInterfaceAVKit::setVideoFullscreenChangeObserver): 29 (VideoFullscreenInterfaceAVKit::modelDestroyed): 30 * platform/ios/WebVideoFullscreenControllerAVKit.mm: 31 (VideoFullscreenControllerContext::~VideoFullscreenControllerContext): 32 1 33 2019-07-13 Zalan Bujtas <zalan@apple.com> 2 34 -
trunk/Source/WebCore/platform/cocoa/VideoFullscreenModel.h
r243627 r247417 84 84 virtual void willExitPictureInPicture() { } 85 85 virtual void didExitPictureInPicture() { } 86 virtual void modelDestroyed() { } 86 87 }; 87 88 -
trunk/Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.h
r243298 r247417 75 75 WEBCORE_EXPORT void hasVideoChanged(bool) final; 76 76 WEBCORE_EXPORT void videoDimensionsChanged(const FloatSize&) final; 77 WEBCORE_EXPORT void modelDestroyed() final; 77 78 78 79 // PlaybackSessionModelClient … … 128 129 Mode m_targetMode; 129 130 130 VideoFullscreenModel* videoFullscreenModel() const { return m_videoFullscreenModel .get(); }131 VideoFullscreenModel* videoFullscreenModel() const { return m_videoFullscreenModel; } 131 132 bool shouldExitFullscreenWithReason(ExitFullScreenReason); 132 133 HTMLMediaElementEnums::VideoFullscreenMode mode() const { return m_currentMode.mode(); } … … 172 173 RetainPtr<WebAVPlayerViewControllerDelegate> m_playerViewControllerDelegate; 173 174 RetainPtr<WebAVPlayerViewController> m_playerViewController; 174 WeakPtr<VideoFullscreenModel> m_videoFullscreenModel;175 WeakPtr<VideoFullscreenChangeObserver> m_fullscreenChangeObserver;175 VideoFullscreenModel* m_videoFullscreenModel { nullptr }; 176 VideoFullscreenChangeObserver* m_fullscreenChangeObserver { nullptr }; 176 177 177 178 // These are only used when fullscreen is presented in a separate window. -
trunk/Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.mm
r246892 r247417 761 761 m_videoFullscreenModel->removeClient(*this); 762 762 763 m_videoFullscreenModel = m akeWeakPtr(model);763 m_videoFullscreenModel = model; 764 764 765 765 if (m_videoFullscreenModel) { … … 780 780 void VideoFullscreenInterfaceAVKit::setVideoFullscreenChangeObserver(VideoFullscreenChangeObserver* observer) 781 781 { 782 m_fullscreenChangeObserver = makeWeakPtr(observer);782 m_fullscreenChangeObserver = observer; 783 783 } 784 784 … … 929 929 930 930 cleanupFullscreen(); 931 } 932 933 void VideoFullscreenInterfaceAVKit::modelDestroyed() 934 { 935 ASSERT(isUIThread()); 936 invalidate(); 931 937 } 932 938 -
trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm
r247380 r247417 224 224 while (!m_playbackClients.isEmpty()) 225 225 (*m_playbackClients.begin())->modelDestroyed(); 226 while (!m_fullscreenClients.isEmpty()) 227 (*m_fullscreenClients.begin())->modelDestroyed(); 226 228 }; 227 229 if (isUIThread())
Note: See TracChangeset
for help on using the changeset viewer.