1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
media / base / cdm_callback_promise.h [blame]
// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MEDIA_BASE_CDM_CALLBACK_PROMISE_H_
#define MEDIA_BASE_CDM_CALLBACK_PROMISE_H_
#include <stdint.h>
#include <string>
#include "base/functional/callback.h"
#include "media/base/cdm_promise.h"
#include "media/base/media_export.h"
namespace media {
typedef base::OnceCallback<void(CdmPromise::Exception exception_code,
uint32_t system_code,
const std::string& error_message)>
PromiseRejectedCB;
template <typename... T>
class MEDIA_EXPORT CdmCallbackPromise : public CdmPromiseTemplate<T...> {
public:
CdmCallbackPromise(base::OnceCallback<void(const T&...)> resolve_cb,
PromiseRejectedCB reject_cb);
CdmCallbackPromise(const CdmCallbackPromise&) = delete;
CdmCallbackPromise& operator=(const CdmCallbackPromise&) = delete;
virtual ~CdmCallbackPromise();
// CdmPromiseTemplate<T> implementation.
virtual void resolve(const T&... result) override;
virtual void reject(CdmPromise::Exception exception_code,
uint32_t system_code,
const std::string& error_message) override;
private:
using CdmPromiseTemplate<T...>::IsPromiseSettled;
using CdmPromiseTemplate<T...>::MarkPromiseSettled;
using CdmPromiseTemplate<T...>::RejectPromiseOnDestruction;
base::OnceCallback<void(const T&...)> resolve_cb_;
PromiseRejectedCB reject_cb_;
};
} // namespace media
#endif // MEDIA_BASE_CDM_CALLBACK_PROMISE_H_