Ensure media playback is stopped during page close
authorbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 7 Jul 2015 03:40:19 +0000 (03:40 +0000)
committerbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 7 Jul 2015 03:40:19 +0000 (03:40 +0000)
commit5ffcfb1aa95f4132dd2556ade5b06de7e8d1b8b1
tree66122f9a0942fd9e657ac80a571754672762f46c
parent64fa95d7bafa204b5deb41c5f830072a858eaf8e
Ensure media playback is stopped during page close
https://bugs.webkit.org/show_bug.cgi?id=146554
<rdar://problem/18033944>

Reviewed by Brady Eidson.

Source/WebCore:

* Modules/webaudio/AudioContext.cpp:
(WebCore::WebAudio::hostingDocument): Added.
* Modules/webaudio/AudioContext.h:
* html/HTMLMediaElement.h:
(WebCore::HTMLMediaElement::hostingDocument): Added.
* dom/Document.cpp:
(WebCore::Document::~Document): Call new 'stopAllMediaPlaybackForDocument' at destruction time.
* platform/audio/PlatformMediaSession.h:
Made PlatformMediaSessionManager a friend so it can access the protected 'client' accessor.
Updated PlatformMediaSessionClient to require clients to have a "hostingDocument" member.
* platform/audio/PlatformMediaSessionManager.cpp:
(WebCore::PlatformMediaSessionManager::stopAllMediaPlaybackForDocument): Added. Only pauses
playback on elements that match the provided document.
(WebCore::PlatformMediaSessionManager::stopAllMediaPlaybackForProcess): Added. Pauses playback
on all elements in the current process.
* platform/audio/PlatformMediaSessionManager.h:

Source/WebKit2:

* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::didClose): Make sure to clean up any running media sessions when
the process is being shut down.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@186396 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/Modules/webaudio/AudioContext.cpp
Source/WebCore/Modules/webaudio/AudioContext.h
Source/WebCore/dom/Document.cpp
Source/WebCore/html/HTMLMediaElement.h
Source/WebCore/platform/audio/PlatformMediaSession.h
Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp
Source/WebCore/platform/audio/PlatformMediaSessionManager.h
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebProcess.cpp