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 #include "media/mojo/services/mojo_cdm_promise.h" | 5 #include "media/mojo/services/mojo_cdm_promise.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 | 44 |
45 template <typename... T> | 45 template <typename... T> |
46 void MojoCdmPromise<T...>::resolve(const T&... result) { | 46 void MojoCdmPromise<T...>::resolve(const T&... result) { |
47 MarkPromiseSettled(); | 47 MarkPromiseSettled(); |
48 mojom::CdmPromiseResultPtr cdm_promise_result(mojom::CdmPromiseResult::New()); | 48 mojom::CdmPromiseResultPtr cdm_promise_result(mojom::CdmPromiseResult::New()); |
49 cdm_promise_result->success = true; | 49 cdm_promise_result->success = true; |
50 callback_.Run( | 50 callback_.Run( |
51 std::move(cdm_promise_result), | 51 std::move(cdm_promise_result), |
52 mojo::TypeConverter<typename MojoTypeTrait<T>::MojoType, T>::Convert( | 52 mojo::TypeConverter<typename MojoTypeTrait<T>::MojoType, T>::Convert( |
53 result)...); | 53 result)...); |
54 callback_.reset(); | 54 callback_.Reset(); |
55 } | 55 } |
56 | 56 |
57 template <typename... T> | 57 template <typename... T> |
58 void MojoCdmPromise<T...>::reject(MediaKeys::Exception exception, | 58 void MojoCdmPromise<T...>::reject(MediaKeys::Exception exception, |
59 uint32_t system_code, | 59 uint32_t system_code, |
60 const std::string& error_message) { | 60 const std::string& error_message) { |
61 MarkPromiseSettled(); | 61 MarkPromiseSettled(); |
62 callback_.Run(GetRejectResult(exception, system_code, error_message), | 62 callback_.Run(GetRejectResult(exception, system_code, error_message), |
63 MojoTypeTrait<T>::DefaultValue()...); | 63 MojoTypeTrait<T>::DefaultValue()...); |
64 callback_.reset(); | 64 callback_.Reset(); |
65 } | 65 } |
66 | 66 |
67 template class MojoCdmPromise<>; | 67 template class MojoCdmPromise<>; |
68 template class MojoCdmPromise<std::string>; | 68 template class MojoCdmPromise<std::string>; |
69 | 69 |
70 } // namespace media | 70 } // namespace media |
OLD | NEW |