| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "modules/media_capabilities/MediaCapabilities.h" | 5 #include "modules/media_capabilities/MediaCapabilities.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/CallbackPromiseAdapter.h" | 7 #include "bindings/core/v8/CallbackPromiseAdapter.h" |
| 8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
| 9 #include "bindings/core/v8/ScriptPromiseResolver.h" | 9 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 10 #include "core/dom/DOMException.h" | 10 #include "core/dom/DOMException.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 ScriptPromise promise = resolver->Promise(); | 130 ScriptPromise promise = resolver->Promise(); |
| 131 | 131 |
| 132 if (!configuration.hasVideo() && !configuration.hasAudio()) { | 132 if (!configuration.hasVideo() && !configuration.hasAudio()) { |
| 133 resolver->Reject(DOMException::Create( | 133 resolver->Reject(DOMException::Create( |
| 134 kSyntaxError, | 134 kSyntaxError, |
| 135 "The configuration dictionary has neither |video| nor |audio| " | 135 "The configuration dictionary has neither |video| nor |audio| " |
| 136 "specified and needs at least one of them.")); | 136 "specified and needs at least one of them.")); |
| 137 return promise; | 137 return promise; |
| 138 } | 138 } |
| 139 | 139 |
| 140 WebMediaRecorderHandler* handler = | 140 std::unique_ptr<WebMediaRecorderHandler> handler = |
| 141 Platform::Current()->CreateMediaRecorderHandler(); | 141 Platform::Current()->CreateMediaRecorderHandler(); |
| 142 if (!handler) { | 142 if (!handler) { |
| 143 resolver->Reject(DOMException::Create( | 143 resolver->Reject(DOMException::Create( |
| 144 kInvalidStateError, | 144 kInvalidStateError, |
| 145 "Platform error: could not create MediaRecorderHandler.")); | 145 "Platform error: could not create MediaRecorderHandler.")); |
| 146 return promise; | 146 return promise; |
| 147 } | 147 } |
| 148 | 148 |
| 149 handler->EncodingInfo( | 149 handler->EncodingInfo( |
| 150 ToWebMediaConfiguration(configuration), | 150 ToWebMediaConfiguration(configuration), |
| 151 WTF::MakeUnique<CallbackPromiseAdapter<MediaCapabilitiesInfo, void>>( | 151 WTF::MakeUnique<CallbackPromiseAdapter<MediaCapabilitiesInfo, void>>( |
| 152 resolver)); | 152 resolver)); |
| 153 return promise; | 153 return promise; |
| 154 } | 154 } |
| 155 | 155 |
| 156 DEFINE_TRACE(MediaCapabilities) {} | 156 DEFINE_TRACE(MediaCapabilities) {} |
| 157 | 157 |
| 158 } // namespace blink | 158 } // namespace blink |
| OLD | NEW |