[Extensions Toolbar] Make the ExtensionToolbarModel icon count more stable
[chromium-blink-merge.git] / media / base / cdm_callback_promise.cc
blob7b952ab768cd12f4e06054bd9433334ad2e087fc
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
3 // found in the LICENSE file.
5 #include "media/base/cdm_callback_promise.h"
7 #include "base/logging.h"
9 namespace media {
11 template <typename... T>
12 CdmCallbackPromise<T...>::CdmCallbackPromise(
13 const base::Callback<void(const T&...)>& resolve_cb,
14 const PromiseRejectedCB& reject_cb)
15 : resolve_cb_(resolve_cb), reject_cb_(reject_cb) {
16 DCHECK(!resolve_cb_.is_null());
17 DCHECK(!reject_cb_.is_null());
20 template <typename... T>
21 CdmCallbackPromise<T...>::~CdmCallbackPromise() {
24 template <typename... T>
25 void CdmCallbackPromise<T...>::resolve(const T&... result) {
26 MarkPromiseSettled();
27 resolve_cb_.Run(result...);
30 template <typename... T>
31 void CdmCallbackPromise<T...>::reject(MediaKeys::Exception exception_code,
32 uint32 system_code,
33 const std::string& error_message) {
34 MarkPromiseSettled();
35 reject_cb_.Run(exception_code, system_code, error_message);
38 // Explicit template instantiation for the Promises needed.
39 template class MEDIA_EXPORT CdmCallbackPromise<>;
40 template class MEDIA_EXPORT CdmCallbackPromise<std::string>;
41 template class MEDIA_EXPORT CdmCallbackPromise<KeyIdsVector>;
43 } // namespace media