Index: Source/modules/encryptedmedia/MediaKeys.cpp |
diff --git a/Source/modules/encryptedmedia/MediaKeys.cpp b/Source/modules/encryptedmedia/MediaKeys.cpp |
index 99a19edc8b36bd0b19c82d99f15802079a4374f1..59e428313bbd8eb954406b0b5b5b7af5af6ba59d 100644 |
--- a/Source/modules/encryptedmedia/MediaKeys.cpp |
+++ b/Source/modules/encryptedmedia/MediaKeys.cpp |
@@ -53,7 +53,7 @@ static bool isKeySystemSupportedWithContentType(const String& keySystem, const S |
return MIMETypeRegistry::isSupportedEncryptedMediaMIMEType(keySystem, type.type(), codecs); |
} |
-PassRefPtrWillBeRawPtr<MediaKeys> MediaKeys::create(ExecutionContext* context, const String& keySystem, ExceptionState& exceptionState) |
+MediaKeys* MediaKeys::create(ExecutionContext* context, const String& keySystem, ExceptionState& exceptionState) |
{ |
// From <http://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/encrypted-media.html#dom-media-keys-constructor>: |
// The MediaKeys(keySystem) constructor must run the following steps: |
@@ -61,13 +61,13 @@ PassRefPtrWillBeRawPtr<MediaKeys> MediaKeys::create(ExecutionContext* context, c |
// 1. If keySystem is an empty string, throw an InvalidAccessError exception and abort these steps. |
if (keySystem.isEmpty()) { |
exceptionState.throwDOMException(InvalidAccessError, "The key system provided is invalid."); |
- return nullptr; |
+ return 0; |
} |
// 2. If keySystem is not one of the user agent's supported Key Systems, throw a NotSupportedError and abort these steps. |
if (!isKeySystemSupportedWithContentType(keySystem, "")) { |
exceptionState.throwDOMException(NotSupportedError, "The '" + keySystem + "' key system is not supported."); |
- return nullptr; |
+ return 0; |
} |
// 3. Let cdm be the content decryption module corresponding to keySystem. |
@@ -77,24 +77,20 @@ PassRefPtrWillBeRawPtr<MediaKeys> MediaKeys::create(ExecutionContext* context, c |
OwnPtr<blink::WebContentDecryptionModule> cdm = controller->createContentDecryptionModule(context, keySystem); |
if (!cdm) { |
exceptionState.throwDOMException(NotSupportedError, "A content decryption module could not be loaded for the '" + keySystem + "' key system."); |
- return nullptr; |
+ return 0; |
} |
// 5. Create a new MediaKeys object. |
// 5.1 Let the keySystem attribute be keySystem. |
// 6. Return the new object to the caller. |
- return adoptRefWillBeNoop(new MediaKeys(context, keySystem, cdm.release())); |
+ return new MediaKeys(context, keySystem, cdm.release()); |
} |
MediaKeys::MediaKeys(ExecutionContext* context, const String& keySystem, PassOwnPtr<blink::WebContentDecryptionModule> cdm) |
: ContextLifecycleObserver(context) |
- , m_mediaElement(0) |
, m_keySystem(keySystem) |
, m_cdm(cdm) |
, m_initializeNewSessionTimer(this, &MediaKeys::initializeNewSessionTimerFired) |
-#if !ENABLE(OILPAN) |
- , m_weakFactory(this) |
-#endif |
{ |
WTF_LOG(Media, "MediaKeys::MediaKeys"); |
ScriptWrappable::init(this); |
@@ -104,7 +100,7 @@ MediaKeys::~MediaKeys() |
{ |
} |
-PassRefPtrWillBeRawPtr<MediaKeySession> MediaKeys::createSession(ExecutionContext* context, const String& contentType, Uint8Array* initData, ExceptionState& exceptionState) |
+MediaKeySession* MediaKeys::createSession(ExecutionContext* context, const String& contentType, Uint8Array* initData, ExceptionState& exceptionState) |
{ |
WTF_LOG(Media, "MediaKeys::createSession"); |
@@ -114,27 +110,23 @@ PassRefPtrWillBeRawPtr<MediaKeySession> MediaKeys::createSession(ExecutionContex |
if (contentType.isEmpty()) { |
exceptionState.throwDOMException(InvalidAccessError, "The contentType provided ('" + contentType + "') is empty."); |
- return nullptr; |
+ return 0; |
} |
if (!initData->length()) { |
exceptionState.throwDOMException(InvalidAccessError, "The initData provided is empty."); |
- return nullptr; |
+ return 0; |
} |
// 1. If type contains a MIME type that is not supported or is not supported by the keySystem, |
// throw a NOT_SUPPORTED_ERR exception and abort these steps. |
if (!isKeySystemSupportedWithContentType(m_keySystem, contentType)) { |
exceptionState.throwDOMException(NotSupportedError, "The type provided ('" + contentType + "') is unsupported."); |
- return nullptr; |
+ return 0; |
} |
// 2. Create a new MediaKeySession object. |
-#if ENABLE(OILPAN) |
MediaKeySession* session = MediaKeySession::create(context, m_cdm.get(), this); |
-#else |
- RefPtr<MediaKeySession> session = MediaKeySession::create(context, m_cdm.get(), m_weakFactory.createWeakPtr()); |
-#endif |
// 2.1 Let the keySystem attribute be keySystem. |
ASSERT(!session->keySystem().isEmpty()); |
// FIXME: 2.2 Let the state of the session be CREATED. |
@@ -173,14 +165,6 @@ bool MediaKeys::isTypeSupported(const String& keySystem, const String& contentTy |
return isKeySystemSupportedWithContentType(keySystem, contentType); |
} |
-void MediaKeys::setMediaElement(HTMLMediaElement* element) |
-{ |
- // FIXME: Cause HTMLMediaElement::setMediaKeys() to throw an exception if m_mediaElement is not 0 |
- // and remove the code that prevents the assert below in HTMLMediaElement. |
- ASSERT(!m_mediaElement != !element); |
- m_mediaElement = element; |
-} |
- |
blink::WebContentDecryptionModule* MediaKeys::contentDecryptionModule() |
{ |
return m_cdm.get(); |