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

Side by Side Diff: Source/modules/webaudio/OfflineAudioContext.cpp

Issue 1111213002: Treat a stopped AudioContext as closed. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: startRendering() doesn't (directly) raise an exception Created 5 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
« no previous file with comments | « Source/modules/webaudio/AudioContext.h ('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 /* 1 /*
2 * Copyright (C) 2012, Google Inc. All rights reserved. 2 * Copyright (C) 2012, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 : AudioContext(document, numberOfChannels, numberOfFrames, sampleRate) 94 : AudioContext(document, numberOfChannels, numberOfFrames, sampleRate)
95 { 95 {
96 } 96 }
97 97
98 OfflineAudioContext::~OfflineAudioContext() 98 OfflineAudioContext::~OfflineAudioContext()
99 { 99 {
100 } 100 }
101 101
102 ScriptPromise OfflineAudioContext::startOfflineRendering(ScriptState* scriptStat e) 102 ScriptPromise OfflineAudioContext::startOfflineRendering(ScriptState* scriptStat e)
103 { 103 {
104 // Calling close() on an OfflineAudioContext is not supported/allowed,
105 // but it might well have been stopped by its execution context.
106 if (isContextClosed()) {
107 return ScriptPromise::rejectWithDOMException(
108 scriptState,
109 DOMException::create(
110 InvalidStateError,
111 "cannot call startRendering on an OfflineAudioContext in a stopp ed state."));
112 }
113
104 if (m_offlineResolver) { 114 if (m_offlineResolver) {
105 // Can't call startRendering more than once. Return a rejected promise now. 115 // Can't call startRendering more than once. Return a rejected promise now.
106 return ScriptPromise::rejectWithDOMException( 116 return ScriptPromise::rejectWithDOMException(
107 scriptState, 117 scriptState,
108 DOMException::create( 118 DOMException::create(
109 InvalidStateError, 119 InvalidStateError,
110 "cannot call startRendering more than once")); 120 "cannot call startRendering more than once"));
111 } 121 }
112 122
113 m_offlineResolver = ScriptPromiseResolver::create(scriptState); 123 m_offlineResolver = ScriptPromiseResolver::create(scriptState);
114 startRendering(); 124 startRendering();
115 return m_offlineResolver->promise(); 125 return m_offlineResolver->promise();
116 } 126 }
117 127
118 } // namespace blink 128 } // namespace blink
119 129
120 #endif // ENABLE(WEB_AUDIO) 130 #endif // ENABLE(WEB_AUDIO)
OLDNEW
« no previous file with comments | « Source/modules/webaudio/AudioContext.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698