Index: Source/modules/encryptedmedia/ContentDecryptionModuleResultPromise.cpp |
diff --git a/Source/modules/encryptedmedia/SimpleContentDecryptionModuleResult.cpp b/Source/modules/encryptedmedia/ContentDecryptionModuleResultPromise.cpp |
similarity index 57% |
rename from Source/modules/encryptedmedia/SimpleContentDecryptionModuleResult.cpp |
rename to Source/modules/encryptedmedia/ContentDecryptionModuleResultPromise.cpp |
index 8d8e658a3a34baa1e640efc02ee2f538832ad8d1..380fdcfaecb0eff48c579402925ab98dd24b0bb2 100644 |
--- a/Source/modules/encryptedmedia/SimpleContentDecryptionModuleResult.cpp |
+++ b/Source/modules/encryptedmedia/ContentDecryptionModuleResultPromise.cpp |
@@ -3,14 +3,11 @@ |
// found in the LICENSE file. |
#include "config.h" |
-#include "modules/encryptedmedia/SimpleContentDecryptionModuleResult.h" |
+#include "modules/encryptedmedia/ContentDecryptionModuleResultPromise.h" |
#include "bindings/core/v8/ScriptPromise.h" |
-#include "bindings/core/v8/ScriptPromiseResolver.h" |
#include "bindings/core/v8/ScriptState.h" |
-#include "bindings/core/v8/V8Binding.h" |
#include "core/dom/DOMException.h" |
-#include "platform/Logging.h" |
#include "public/platform/WebString.h" |
#include "wtf/Assertions.h" |
@@ -41,41 +38,51 @@ ExceptionCode WebCdmExceptionToExceptionCode(WebContentDecryptionModuleException |
return UnknownError; |
} |
-SimpleContentDecryptionModuleResult::SimpleContentDecryptionModuleResult(ScriptState* scriptState) |
+ContentDecryptionModuleResultPromise::ContentDecryptionModuleResultPromise(ScriptState* scriptState) |
: m_resolver(ScriptPromiseResolver::create(scriptState)) |
{ |
} |
-SimpleContentDecryptionModuleResult::~SimpleContentDecryptionModuleResult() |
+ContentDecryptionModuleResultPromise::~ContentDecryptionModuleResultPromise() |
{ |
} |
-void SimpleContentDecryptionModuleResult::complete() |
+void ContentDecryptionModuleResultPromise::complete() |
{ |
- m_resolver->resolve(V8UndefinedType()); |
- m_resolver.clear(); |
+ ASSERT_NOT_REACHED(); |
+ reject(InvalidStateError, "Unexpected completion."); |
} |
-void SimpleContentDecryptionModuleResult::completeWithSession(WebContentDecryptionModuleResult::SessionStatus status) |
+void ContentDecryptionModuleResultPromise::completeWithSession(WebContentDecryptionModuleResult::SessionStatus status) |
{ |
ASSERT_NOT_REACHED(); |
- completeWithDOMException(InvalidStateError, "Unexpected completion."); |
+ reject(InvalidStateError, "Unexpected completion."); |
} |
-void SimpleContentDecryptionModuleResult::completeWithError(WebContentDecryptionModuleException exceptionCode, unsigned long systemCode, const WebString& errorMessage) |
+void ContentDecryptionModuleResultPromise::completeWithError(WebContentDecryptionModuleException exceptionCode, unsigned long systemCode, const WebString& errorMessage) |
{ |
- completeWithDOMException(WebCdmExceptionToExceptionCode(exceptionCode), errorMessage); |
+ reject(WebCdmExceptionToExceptionCode(exceptionCode), errorMessage); |
} |
-ScriptPromise SimpleContentDecryptionModuleResult::promise() |
+ScriptPromise ContentDecryptionModuleResultPromise::promise() |
{ |
return m_resolver->promise(); |
} |
-void SimpleContentDecryptionModuleResult::completeWithDOMException(ExceptionCode code, const String& errorMessage) |
+void ContentDecryptionModuleResultPromise::reject(ExceptionCode code, const String& errorMessage) |
{ |
m_resolver->reject(DOMException::create(code, errorMessage)); |
m_resolver.clear(); |
} |
+ExecutionContext* ContentDecryptionModuleResultPromise::executionContext() const |
+{ |
+ return m_resolver->executionContext(); |
+} |
+ |
+void ContentDecryptionModuleResultPromise::trace(Visitor* visitor) |
+{ |
+ ContentDecryptionModuleResult::trace(visitor); |
+} |
+ |
} // namespace blink |