Title: [184001] trunk/Source/WebCore
Revision
184001
Author
[email protected]
Date
2015-05-08 11:45:40 -0700 (Fri, 08 May 2015)

Log Message

[Mac] Playback target clients do not unregister on page reload
https://bugs.webkit.org/show_bug.cgi?id=144761

Reviewed by Brady Eidson.

* dom/Document.cpp:
(WebCore::Document::prepareForDestruction): Unregister all target picker clients.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::registerWithDocument): Register for page cache callback.
(WebCore::HTMLMediaElement::unregisterWithDocument): Unregister for page cache callback.
(WebCore::HTMLMediaElement::documentWillSuspendForPageCache): New.
(WebCore::HTMLMediaElement::documentDidResumeFromPageCache): New.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (184000 => 184001)


--- trunk/Source/WebCore/ChangeLog	2015-05-08 18:37:49 UTC (rev 184000)
+++ trunk/Source/WebCore/ChangeLog	2015-05-08 18:45:40 UTC (rev 184001)
@@ -1,3 +1,19 @@
+2015-05-08  Eric Carlson  <[email protected]>
+
+        [Mac] Playback target clients do not unregister on page reload
+        https://bugs.webkit.org/show_bug.cgi?id=144761
+
+        Reviewed by Brady Eidson.
+
+        * dom/Document.cpp:
+        (WebCore::Document::prepareForDestruction): Unregister all target picker clients.
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::registerWithDocument): Register for page cache callback.
+        (WebCore::HTMLMediaElement::unregisterWithDocument): Unregister for page cache callback.
+        (WebCore::HTMLMediaElement::documentWillSuspendForPageCache): New.
+        (WebCore::HTMLMediaElement::documentDidResumeFromPageCache): New.
+
 2015-05-08  Chris Dumez  <[email protected]>
 
         Throttle RequestAnimationFrame in subframes that are outside the viewport

Modified: trunk/Source/WebCore/dom/Document.cpp (184000 => 184001)


--- trunk/Source/WebCore/dom/Document.cpp	2015-05-08 18:37:49 UTC (rev 184000)
+++ trunk/Source/WebCore/dom/Document.cpp	2015-05-08 18:45:40 UTC (rev 184001)
@@ -2252,6 +2252,15 @@
     if (m_mediaQueryMatcher)
         m_mediaQueryMatcher->documentDestroyed();
 
+#if ENABLE(WIRELESS_PLAYBACK_TARGET)
+    if (!m_clientToIDMap.isEmpty() && page()) {
+        Vector<WebCore::MediaPlaybackTargetClient*> clients;
+        copyKeysToVector(m_clientToIDMap, clients);
+        for (auto client : clients)
+            removePlaybackTargetPickerClient(*client);
+    }
+#endif
+
     disconnectFromFrame();
 
     m_hasPreparedForDestruction = true;

Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (184000 => 184001)


--- trunk/Source/WebCore/html/HTMLMediaElement.cpp	2015-05-08 18:37:49 UTC (rev 184000)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp	2015-05-08 18:45:40 UTC (rev 184001)
@@ -460,6 +460,10 @@
         document.registerForPageScaleFactorChangedCallbacks(this);
 #endif
 
+#if ENABLE(WIRELESS_PLAYBACK_TARGET)
+    document.registerForPageCacheSuspensionCallbacks(this);
+#endif
+
     document.addAudioProducer(this);
     addElementToDocumentMap(*this, document);
 }
@@ -488,6 +492,10 @@
         document.unregisterForPageScaleFactorChangedCallbacks(this);
 #endif
 
+#if ENABLE(WIRELESS_PLAYBACK_TARGET)
+    document.unregisterForPageCacheSuspensionCallbacks(this);
+#endif
+
     document.removeAudioProducer(this);
     removeElementFromDocumentMap(*this, document);
 }
@@ -509,6 +517,18 @@
     HTMLElement::didMoveToNewDocument(oldDocument);
 }
 
+#if ENABLE(WIRELESS_PLAYBACK_TARGET)
+void HTMLMediaElement::documentWillSuspendForPageCache()
+{
+    m_mediaSession->unregisterWithDocument(*this);
+}
+
+void HTMLMediaElement::documentDidResumeFromPageCache()
+{
+    m_mediaSession->registerWithDocument(*this);
+}
+#endif
+
 bool HTMLMediaElement::hasCustomFocusLogic() const
 {
     return true;

Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (184000 => 184001)


--- trunk/Source/WebCore/html/HTMLMediaElement.h	2015-05-08 18:37:49 UTC (rev 184000)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h	2015-05-08 18:45:40 UTC (rev 184001)
@@ -737,6 +737,11 @@
 
     void updateCaptionContainer();
 
+#if ENABLE(WIRELESS_PLAYBACK_TARGET)
+    virtual void documentWillSuspendForPageCache() override final;
+    virtual void documentDidResumeFromPageCache() override final;
+#endif
+
     Timer m_pendingActionTimer;
     Timer m_progressEventTimer;
     Timer m_playbackProgressTimer;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to