Invalidate PlaybackSessionManager in same fashion as VideoFullscreenManager.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 10 Aug 2017 02:11:47 +0000 (02:11 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 10 Aug 2017 02:11:47 +0000 (02:11 +0000)
https://bugs.webkit.org/show_bug.cgi?id=175399
rdar://problem/33663344

Patch by Jeremy Jones <jeremyj@apple.com> on 2017-08-09
Reviewed by Eric Carlson.

Invalidate PlaybackSessionManager when WebPage is destructed.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::~WebPage):
* WebProcess/cocoa/PlaybackSessionManager.h:
* WebProcess/cocoa/PlaybackSessionManager.mm:
(WebKit::PlaybackSessionManager::~PlaybackSessionManager):
(WebKit::PlaybackSessionManager::invalidate):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220504 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/ChangeLog
Source/WebKit/WebProcess/WebPage/WebPage.cpp
Source/WebKit/WebProcess/cocoa/PlaybackSessionManager.h
Source/WebKit/WebProcess/cocoa/PlaybackSessionManager.mm

index 86da1c63b83da9823a4ad9420d413dd1488dc0aa..cf08466c37c14bfdb272dea29984e0d4c76dd18d 100644 (file)
@@ -1,3 +1,20 @@
+2017-08-09  Jeremy Jones  <jeremyj@apple.com>
+
+        Invalidate PlaybackSessionManager in same fashion as VideoFullscreenManager.
+        https://bugs.webkit.org/show_bug.cgi?id=175399
+        rdar://problem/33663344
+
+        Reviewed by Eric Carlson.
+
+        Invalidate PlaybackSessionManager when WebPage is destructed.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::~WebPage):
+        * WebProcess/cocoa/PlaybackSessionManager.h:
+        * WebProcess/cocoa/PlaybackSessionManager.mm:
+        (WebKit::PlaybackSessionManager::~PlaybackSessionManager):
+        (WebKit::PlaybackSessionManager::invalidate):
+
 2017-08-09  Don Olmstead  <don.olmstead@sony.com>
 
         [WTF] Move TextStream into WTF
index 60ae396296ee879b58d9dc42636db0c46d4db440..c755e9370a10d3a347e20c3278b2ab3bb0d4f096 100644 (file)
@@ -673,6 +673,9 @@ WebPage::~WebPage()
 #endif
     
 #if (PLATFORM(IOS) && HAVE(AVKIT)) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
+    if (m_playbackSessionManager)
+        m_playbackSessionManager->invalidate();
+
     if (m_videoFullscreenManager)
         m_videoFullscreenManager->invalidate();
 #endif
index 236a2817b902dda296ba36bb1ce8ace6279013fb..d99706a30bd11277396a979c66a4e01c25f7717a 100644 (file)
@@ -99,6 +99,8 @@ class PlaybackSessionManager : public RefCounted<PlaybackSessionManager>, privat
 public:
     static Ref<PlaybackSessionManager> create(WebPage&);
     virtual ~PlaybackSessionManager();
+    
+    void invalidate();
 
     void didReceiveMessage(IPC::Connection&, IPC::Decoder&) final;
 
index 9141e38f54453db152b31d2abe1f4cbb06038bab..53abb25fc2c34f0d7ee42068be1bc42a11d93431 100644 (file)
@@ -184,7 +184,15 @@ PlaybackSessionManager::~PlaybackSessionManager()
     m_mediaElements.clear();
     m_clientCounts.clear();
 
+    if (m_page)
+        WebProcess::singleton().removeMessageReceiver(Messages::PlaybackSessionManager::messageReceiverName(), m_page->pageID());
+}
+
+void PlaybackSessionManager::invalidate()
+{
+    ASSERT(m_page);
     WebProcess::singleton().removeMessageReceiver(Messages::PlaybackSessionManager::messageReceiverName(), m_page->pageID());
+    m_page = nullptr;
 }
 
 PlaybackSessionManager::ModelInterfaceTuple PlaybackSessionManager::createModelAndInterface(uint64_t contextId)