| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef ContentDecryptionModuleResultPromise_h | 5 #ifndef ContentDecryptionModuleResultPromise_h |
| 6 #define ContentDecryptionModuleResultPromise_h | 6 #define ContentDecryptionModuleResultPromise_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptPromiseResolver.h" | 8 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 9 #include "core/dom/ExceptionCode.h" | 9 #include "core/dom/ExceptionCode.h" |
| 10 #include "platform/ContentDecryptionModuleResult.h" | 10 #include "platform/ContentDecryptionModuleResult.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 | 38 |
| 39 // Resolves the promise with |value|. Used by subclasses to resolve the | 39 // Resolves the promise with |value|. Used by subclasses to resolve the |
| 40 // promise. | 40 // promise. |
| 41 template <typename... T> | 41 template <typename... T> |
| 42 void resolve(T... value) | 42 void resolve(T... value) |
| 43 { | 43 { |
| 44 m_resolver->resolve(value...); | 44 m_resolver->resolve(value...); |
| 45 m_resolver.clear(); | 45 m_resolver.clear(); |
| 46 } | 46 } |
| 47 | 47 |
| 48 // Rejects the promise with a DOMException. | 48 // Rejects the promise with a DOMException. This will post a task to |
| 49 // actually reject the promise later on. |
| 49 void reject(ExceptionCode, const String& errorMessage); | 50 void reject(ExceptionCode, const String& errorMessage); |
| 50 | 51 |
| 51 ExecutionContext* getExecutionContext() const; | 52 ExecutionContext* getExecutionContext() const; |
| 52 | 53 |
| 53 private: | 54 private: |
| 55 // Rejects the promise with a DOMException. |
| 56 void rejectInternal(ExceptionCode, const String& errorMessage); |
| 57 |
| 54 Member<ScriptPromiseResolver> m_resolver; | 58 Member<ScriptPromiseResolver> m_resolver; |
| 55 }; | 59 }; |
| 56 | 60 |
| 57 } // namespace blink | 61 } // namespace blink |
| 58 | 62 |
| 59 #endif // ContentDecryptionModuleResultPromise_h | 63 #endif // ContentDecryptionModuleResultPromise_h |
| OLD | NEW |