Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Unified Diff: Source/modules/encryptedmedia/SimpleContentDecryptionModuleResult.cpp

Issue 687533004: Simplify use of ContentDecryptionModuleResult with promises (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Changes Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/modules/encryptedmedia/SimpleContentDecryptionModuleResult.cpp
diff --git a/Source/modules/encryptedmedia/SimpleContentDecryptionModuleResult.cpp b/Source/modules/encryptedmedia/SimpleContentDecryptionModuleResult.cpp
deleted file mode 100644
index 8d8e658a3a34baa1e640efc02ee2f538832ad8d1..0000000000000000000000000000000000000000
--- a/Source/modules/encryptedmedia/SimpleContentDecryptionModuleResult.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "config.h"
-#include "modules/encryptedmedia/SimpleContentDecryptionModuleResult.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"
-
-namespace blink {
-
-ExceptionCode WebCdmExceptionToExceptionCode(WebContentDecryptionModuleException cdmException)
-{
- switch (cdmException) {
- case WebContentDecryptionModuleExceptionNotSupportedError:
- return NotSupportedError;
- case WebContentDecryptionModuleExceptionInvalidStateError:
- return InvalidStateError;
- case WebContentDecryptionModuleExceptionInvalidAccessError:
- return InvalidAccessError;
- case WebContentDecryptionModuleExceptionQuotaExceededError:
- return QuotaExceededError;
- case WebContentDecryptionModuleExceptionUnknownError:
- return UnknownError;
- case WebContentDecryptionModuleExceptionClientError:
- case WebContentDecryptionModuleExceptionOutputError:
- // Currently no matching DOMException for these 2 errors.
- // FIXME: Update DOMException to handle these if actually added to
- // the EME spec.
- return UnknownError;
- }
-
- ASSERT_NOT_REACHED();
- return UnknownError;
-}
-
-SimpleContentDecryptionModuleResult::SimpleContentDecryptionModuleResult(ScriptState* scriptState)
- : m_resolver(ScriptPromiseResolver::create(scriptState))
-{
-}
-
-SimpleContentDecryptionModuleResult::~SimpleContentDecryptionModuleResult()
-{
-}
-
-void SimpleContentDecryptionModuleResult::complete()
-{
- m_resolver->resolve(V8UndefinedType());
- m_resolver.clear();
-}
-
-void SimpleContentDecryptionModuleResult::completeWithSession(WebContentDecryptionModuleResult::SessionStatus status)
-{
- ASSERT_NOT_REACHED();
- completeWithDOMException(InvalidStateError, "Unexpected completion.");
-}
-
-void SimpleContentDecryptionModuleResult::completeWithError(WebContentDecryptionModuleException exceptionCode, unsigned long systemCode, const WebString& errorMessage)
-{
- completeWithDOMException(WebCdmExceptionToExceptionCode(exceptionCode), errorMessage);
-}
-
-ScriptPromise SimpleContentDecryptionModuleResult::promise()
-{
- return m_resolver->promise();
-}
-
-void SimpleContentDecryptionModuleResult::completeWithDOMException(ExceptionCode code, const String& errorMessage)
-{
- m_resolver->reject(DOMException::create(code, errorMessage));
- m_resolver.clear();
-}
-
-} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698