Skip to content

Commit

Permalink
[BlackBerry] Handle re-entrant destruction of MediaPlayerPrivate whil…
Browse files Browse the repository at this point in the history
…e a dialog is up

https://bugs.webkit.org/show_bug.cgi?id=105906

Patch by Max Feil <mfeil@rim.com> 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):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@138805 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
webkit-commit-queue committed Jan 4, 2013
1 parent 7e1300d commit 1c7b314
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 10 deletions.
22 changes: 22 additions & 0 deletions Source/WebCore/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
2013-01-04 Max Feil <mfeil@rim.com>

[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 <ascian@rim.com>

[Blackberry] Static code analysis warning fixes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,13 @@ MediaPlayerPrivate::~MediaPlayerPrivate()
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)
Expand Down Expand Up @@ -692,9 +698,9 @@ void MediaPlayerPrivate::onWaitMetadataNotified(bool hasFinished, int timeWaited
void MediaPlayerPrivate::waitMetadataTimerFired(Timer<MediaPlayerPrivate>*)
{
if (m_platformPlayer->isMetadataReady()) {
m_platformPlayer->playWithMetadataReady();
conditionallyGoFullscreenAfterPlay();
m_waitMetadataPopDialogCounter = 0;
m_platformPlayer->playWithMetadataReady();
return;
}

Expand All @@ -706,12 +712,10 @@ void MediaPlayerPrivate::waitMetadataTimerFired(Timer<MediaPlayerPrivate>*)
}
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()) {
Expand Down Expand Up @@ -785,7 +789,7 @@ void MediaPlayerPrivate::onAuthenticationAccepted(const MMRAuthChallenge& authCh
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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class MediaPlayerPrivate : public MediaPlayerPrivateInterface, public Authentica
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);

Expand Down

0 comments on commit 1c7b314

Please sign in to comment.