[EME] MediaKeySession: handle MediaKeys association through a WeakPtr
authorzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 9 Sep 2017 12:42:05 +0000 (12:42 +0000)
committerzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 9 Sep 2017 12:42:05 +0000 (12:42 +0000)
commit832b30dde7cf173f8204c98f18e8afb1fdb173e9
tree67f064f250938445202592ce50cc7127a65b25f8
parentf5d5cd214a537bb2c82af21f608fe4be965f5cca
[EME] MediaKeySession: handle MediaKeys association through a WeakPtr
https://bugs.webkit.org/show_bug.cgi?id=176584

Reviewed by Xabier Rodriguez-Calvar.

Don't keep a raw pointer to the originating MediaKeys object in
MediaKeySession that gets nulled out once MediaKeys is destroyed.
Instead, make MediaKeys a WeakPtrFactory and use a WeakPtr<MediaKeys>
object to maintain the association between MediaKeySession and
MediaKeys.

* Modules/encryptedmedia/MediaKeySession.cpp:
(WebCore::MediaKeySession::create):
(WebCore::MediaKeySession::MediaKeySession):
(WebCore::MediaKeySession::detachKeys): Deleted.
* Modules/encryptedmedia/MediaKeySession.h:
* Modules/encryptedmedia/MediaKeys.cpp:
(WebCore::MediaKeys::MediaKeys):
(WebCore::MediaKeys::createSession):
(WebCore::MediaKeys::~MediaKeys): Deleted.
* Modules/encryptedmedia/MediaKeys.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@221816 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/Modules/encryptedmedia/MediaKeySession.cpp
Source/WebCore/Modules/encryptedmedia/MediaKeySession.h
Source/WebCore/Modules/encryptedmedia/MediaKeys.cpp
Source/WebCore/Modules/encryptedmedia/MediaKeys.h