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

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

Issue 2571093002: MediaRecoder: only throw exception from requestData() if state is inactive (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/mediarecorder/MediaRecorder-events-and-exceptions.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "bindings/core/v8/Dictionary.h" 7 #include "bindings/core/v8/Dictionary.h"
8 #include "core/events/Event.h" 8 #include "core/events/Event.h"
9 #include "core/fileapi/Blob.h" 9 #include "core/fileapi/Blob.h"
10 #include "core/inspector/ConsoleMessage.h" 10 #include "core/inspector/ConsoleMessage.h"
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 if (m_state == State::Recording) 267 if (m_state == State::Recording)
268 return; 268 return;
269 269
270 m_state = State::Recording; 270 m_state = State::Recording;
271 271
272 m_recorderHandler->resume(); 272 m_recorderHandler->resume();
273 scheduleDispatchEvent(Event::create(EventTypeNames::resume)); 273 scheduleDispatchEvent(Event::create(EventTypeNames::resume));
274 } 274 }
275 275
276 void MediaRecorder::requestData(ExceptionState& exceptionState) { 276 void MediaRecorder::requestData(ExceptionState& exceptionState) {
277 if (m_state != State::Recording) { 277 if (m_state == State::Inactive) {
278 exceptionState.throwDOMException( 278 exceptionState.throwDOMException(
279 InvalidStateError, 279 InvalidStateError,
280 "The MediaRecorder's state is '" + stateToString(m_state) + "'."); 280 "The MediaRecorder's state is '" + stateToString(m_state) + "'.");
281 return; 281 return;
282 } 282 }
283 writeData(nullptr /* data */, 0 /* length */, true /* lastInSlice */); 283 writeData(nullptr /* data */, 0 /* length */, true /* lastInSlice */);
284 } 284 }
285 285
286 bool MediaRecorder::isTypeSupported(const String& type) { 286 bool MediaRecorder::isTypeSupported(const String& type) {
287 WebMediaRecorderHandler* handler = 287 WebMediaRecorderHandler* handler =
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 393
394 DEFINE_TRACE(MediaRecorder) { 394 DEFINE_TRACE(MediaRecorder) {
395 visitor->trace(m_stream); 395 visitor->trace(m_stream);
396 visitor->trace(m_dispatchScheduledEventRunner); 396 visitor->trace(m_dispatchScheduledEventRunner);
397 visitor->trace(m_scheduledEvents); 397 visitor->trace(m_scheduledEvents);
398 EventTargetWithInlineData::trace(visitor); 398 EventTargetWithInlineData::trace(visitor);
399 SuspendableObject::trace(visitor); 399 SuspendableObject::trace(visitor);
400 } 400 }
401 401
402 } // namespace blink 402 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/mediarecorder/MediaRecorder-events-and-exceptions.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698