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

Side by Side Diff: media/base/cdm_callback_promise.cc

Issue 604283003: Refactor CdmPromise and related classes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Variadic Templates Created 6 years, 2 months 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 unified diff | Download patch
OLDNEW
(Empty)
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.
4
5 #include "media/base/cdm_callback_promise.h"
6
7 #include "base/logging.h"
8
9 namespace media {
10
11 template <typename... T>
12 CdmCallbackPromise<T...>::CdmCallbackPromise(
13 base::Callback<void(const T&...)> resolve_cb,
14 PromiseRejectedCB reject_cb)
15 : CdmPromiseTemplate<T...>(),
xhwang 2014/10/03 07:34:21 is this necessary?
jrummell 2014/10/03 18:58:30 Removed.
16 resolve_cb_(resolve_cb),
17 reject_cb_(reject_cb) {
18 DCHECK(!resolve_cb_.is_null());
19 DCHECK(!reject_cb_.is_null());
20 }
21
22 template <typename... T>
23 CdmCallbackPromise<T...>::~CdmCallbackPromise() {
24 }
25
26 template <typename... T>
27 void CdmCallbackPromise<T...>::resolve(const T&... result) {
28 this->PromiseSettled();
xhwang 2014/10/03 07:34:21 ditto
jrummell 2014/10/03 18:58:30 Done.
29 resolve_cb_.Run(result...);
30 }
31
32 template <typename... T>
33 void CdmCallbackPromise<T...>::reject(MediaKeys::Exception exception_code,
34 uint32 system_code,
35 const std::string& error_message) {
36 this->PromiseSettled();
37 reject_cb_.Run(exception_code, system_code, error_message);
38 }
39
40 // Explicit template instantiation for the Promises needed.
41 template class MEDIA_EXPORT CdmCallbackPromise<>;
42 template class MEDIA_EXPORT CdmCallbackPromise<std::string>;
43 template class MEDIA_EXPORT CdmCallbackPromise<KeyIdsVector>;
44
45 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698