Title: [138805] trunk/Source/WebCore
Revision
138805
Author
[email protected]
Date
2013-01-04 09:30:10 -0800 (Fri, 04 Jan 2013)

Log Message

[BlackBerry] Handle re-entrant destruction of MediaPlayerPrivate while a dialog is up
https://bugs.webkit.org/show_bug.cgi?id=105906

Patch by Max Feil <[email protected]> on 2013-01-04
Reviewed by George Staikos.

Now that dialogs are not truly modal anymore, we need to
handle the case where MediaPlayerPrivate gets destroyed by
re-entrant calls while a dialog is up. We do this by deferring
the destruction of MMRPlayer until the user dismisses the dialog.

No new tests because user dialog input is not yet part of the
layouttest framework.

* platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp:
(WebCore::MediaPlayerPrivate::~MediaPlayerPrivate):
(WebCore::MediaPlayerPrivate::waitMetadataTimerFired):
(WebCore::MediaPlayerPrivate::onShowErrorDialog):
* platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h:
(MediaPlayerPrivate):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (138804 => 138805)


--- trunk/Source/WebCore/ChangeLog	2013-01-04 17:16:08 UTC (rev 138804)
+++ trunk/Source/WebCore/ChangeLog	2013-01-04 17:30:10 UTC (rev 138805)
@@ -1,3 +1,25 @@
+2013-01-04  Max Feil  <[email protected]>
+
+        [BlackBerry] Handle re-entrant destruction of MediaPlayerPrivate while a dialog is up
+        https://bugs.webkit.org/show_bug.cgi?id=105906
+
+        Reviewed by George Staikos.
+
+        Now that dialogs are not truly modal anymore, we need to
+        handle the case where MediaPlayerPrivate gets destroyed by
+        re-entrant calls while a dialog is up. We do this by deferring
+        the destruction of MMRPlayer until the user dismisses the dialog.
+
+        No new tests because user dialog input is not yet part of the
+        layouttest framework.
+
+        * platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp:
+        (WebCore::MediaPlayerPrivate::~MediaPlayerPrivate):
+        (WebCore::MediaPlayerPrivate::waitMetadataTimerFired):
+        (WebCore::MediaPlayerPrivate::onShowErrorDialog):
+        * platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h:
+        (MediaPlayerPrivate):
+
 2013-01-04  Anthony Scian  <[email protected]>
 
         [Blackberry] Static code analysis warning fixes

Modified: trunk/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp (138804 => 138805)


--- trunk/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp	2013-01-04 17:16:08 UTC (rev 138804)
+++ trunk/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp	2013-01-04 17:30:10 UTC (rev 138805)
@@ -138,7 +138,13 @@
         static_cast<VideoLayerWebKitThread*>(m_platformLayer.get())->setMediaPlayer(0);
 #endif
 
-    deleteGuardedObject(m_platformPlayer);
+    if (m_platformPlayer) {
+        if (m_platformPlayer->dialogState() == PlatformPlayer::DialogShown) {
+            m_platformPlayer->setDialogState(PlatformPlayer::MediaPlayerPrivateDestroyed);
+            m_platformPlayer->stop();
+        } else
+            deleteGuardedObject(m_platformPlayer);
+    }
 }
 
 void MediaPlayerPrivate::load(const WTF::String& url)
@@ -692,9 +698,9 @@
 void MediaPlayerPrivate::waitMetadataTimerFired(Timer<MediaPlayerPrivate>*)
 {
     if (m_platformPlayer->isMetadataReady()) {
-        m_platformPlayer->playWithMetadataReady();
         conditionallyGoFullscreenAfterPlay();
         m_waitMetadataPopDialogCounter = 0;
+        m_platformPlayer->playWithMetadataReady();
         return;
     }
 
@@ -706,12 +712,10 @@
     }
     m_waitMetadataPopDialogCounter = 0;
 
-    // Need to prevent re-entrant play here
-    m_platformPlayer->setPreventReentrantPlay(true);
-    int wait = showErrorDialog(PlatformPlayer::MediaMetaDataTimeoutError);
-    m_platformPlayer->setPreventReentrantPlay(false);
-
-    if (!wait)
+    PlatformPlayer::DialogResult wait = m_platformPlayer->showErrorDialog(PlatformPlayer::MediaMetaDataTimeoutError);
+    if (wait == PlatformPlayer::DialogEmergencyExit)
+        return;
+    if (wait == PlatformPlayer::DialogResponse0)
         onPauseNotified();
     else {
         if (m_platformPlayer->isMetadataReady()) {
@@ -785,7 +789,7 @@
         CredentialStorage::set(Credential(authChallenge.username().c_str(), authChallenge.password().c_str(), static_cast<CredentialPersistence>(authChallenge.persistence())), protectionSpace, url);
 }
 
-int MediaPlayerPrivate::showErrorDialog(PlatformPlayer::Error type)
+int MediaPlayerPrivate::onShowErrorDialog(PlatformPlayer::Error type)
 {
     using namespace BlackBerry::WebKit;
 

Modified: trunk/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h (138804 => 138805)


--- trunk/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h	2013-01-04 17:16:08 UTC (rev 138804)
+++ trunk/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h	2013-01-04 17:30:10 UTC (rev 138805)
@@ -148,7 +148,7 @@
     virtual bool isFullscreen() const;
     virtual bool isElementPaused() const;
     virtual bool isTabVisible() const;
-    virtual int showErrorDialog(BlackBerry::Platform::PlatformPlayer::Error);
+    virtual int onShowErrorDialog(BlackBerry::Platform::PlatformPlayer::Error);
     virtual BlackBerry::Platform::Graphics::Window* platformWindow();
     virtual BlackBerry::Platform::WebMediaStreamDescriptor lookupMediaStream(const BlackBerry::Platform::String& url);
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to