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

Side by Side Diff: third_party/WebKit/Source/modules/mediarecorder/MediaRecorder.cpp

Issue 2846843002: [blink] Unique pointers in Platform.h (Closed)
Patch Set: fix compilation (and again) Created 3 years, 7 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/mediarecorder/MediaRecorder.h" 5 #include "modules/mediarecorder/MediaRecorder.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include "bindings/core/v8/Dictionary.h" 9 #include "bindings/core/v8/Dictionary.h"
10 #include "core/events/Event.h" 10 #include "core/events/Event.h"
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 mime_type_(options.hasMimeType() ? options.mimeType() : kDefaultMimeType), 166 mime_type_(options.hasMimeType() ? options.mimeType() : kDefaultMimeType),
167 stopped_(true), 167 stopped_(true),
168 audio_bits_per_second_(0), 168 audio_bits_per_second_(0),
169 video_bits_per_second_(0), 169 video_bits_per_second_(0),
170 state_(State::kInactive), 170 state_(State::kInactive),
171 dispatch_scheduled_event_runner_(AsyncMethodRunner<MediaRecorder>::Create( 171 dispatch_scheduled_event_runner_(AsyncMethodRunner<MediaRecorder>::Create(
172 this, 172 this,
173 &MediaRecorder::DispatchScheduledEvent)) { 173 &MediaRecorder::DispatchScheduledEvent)) {
174 DCHECK(stream_->getTracks().size()); 174 DCHECK(stream_->getTracks().size());
175 175
176 recorder_handler_ = 176 recorder_handler_ = Platform::Current()->CreateMediaRecorderHandler();
177 WTF::WrapUnique(Platform::Current()->CreateMediaRecorderHandler());
178 DCHECK(recorder_handler_); 177 DCHECK(recorder_handler_);
179 178
180 if (!recorder_handler_) { 179 if (!recorder_handler_) {
181 exception_state.ThrowDOMException( 180 exception_state.ThrowDOMException(
182 kNotSupportedError, "No MediaRecorder handler can be created."); 181 kNotSupportedError, "No MediaRecorder handler can be created.");
183 return; 182 return;
184 } 183 }
185 184
186 AllocateVideoAndAudioBitrates(exception_state, context, options, stream, 185 AllocateVideoAndAudioBitrates(exception_state, context, options, stream,
187 &audio_bits_per_second_, 186 &audio_bits_per_second_,
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 exception_state.ThrowDOMException( 276 exception_state.ThrowDOMException(
278 kInvalidStateError, 277 kInvalidStateError,
279 "The MediaRecorder's state is '" + StateToString(state_) + "'."); 278 "The MediaRecorder's state is '" + StateToString(state_) + "'.");
280 return; 279 return;
281 } 280 }
282 WriteData(nullptr /* data */, 0 /* length */, true /* lastInSlice */, 281 WriteData(nullptr /* data */, 0 /* length */, true /* lastInSlice */,
283 WTF::CurrentTimeMS()); 282 WTF::CurrentTimeMS());
284 } 283 }
285 284
286 bool MediaRecorder::isTypeSupported(const String& type) { 285 bool MediaRecorder::isTypeSupported(const String& type) {
287 WebMediaRecorderHandler* handler = 286 std::unique_ptr<WebMediaRecorderHandler> handler =
288 Platform::Current()->CreateMediaRecorderHandler(); 287 Platform::Current()->CreateMediaRecorderHandler();
289 if (!handler) 288 if (!handler)
290 return false; 289 return false;
291 290
292 // If true is returned from this method, it only indicates that the 291 // If true is returned from this method, it only indicates that the
293 // MediaRecorder implementation is capable of recording Blob objects for the 292 // MediaRecorder implementation is capable of recording Blob objects for the
294 // specified MIME type. Recording may still fail if sufficient resources are 293 // specified MIME type. Recording may still fail if sufficient resources are
295 // not available to support the concrete media encoding. 294 // not available to support the concrete media encoding.
296 // [1] https://w3c.github.io/mediacapture-record/MediaRecorder.html#methods 295 // [1] https://w3c.github.io/mediacapture-record/MediaRecorder.html#methods
297 ContentType content_type(type); 296 ContentType content_type(type);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 387
389 DEFINE_TRACE(MediaRecorder) { 388 DEFINE_TRACE(MediaRecorder) {
390 visitor->Trace(stream_); 389 visitor->Trace(stream_);
391 visitor->Trace(dispatch_scheduled_event_runner_); 390 visitor->Trace(dispatch_scheduled_event_runner_);
392 visitor->Trace(scheduled_events_); 391 visitor->Trace(scheduled_events_);
393 EventTargetWithInlineData::Trace(visitor); 392 EventTargetWithInlineData::Trace(visitor);
394 SuspendableObject::Trace(visitor); 393 SuspendableObject::Trace(visitor);
395 } 394 }
396 395
397 } // namespace blink 396 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698