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

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

Issue 19724003: Revert "Transition modules/** to use ExceptionState" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, Google Inc. All rights reserved. 2 * Copyright (C) 2011, 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 10 matching lines...) Expand all
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 */ 23 */
24 24
25 #include "config.h" 25 #include "config.h"
26 26
27 #if ENABLE(WEB_AUDIO) 27 #if ENABLE(WEB_AUDIO)
28 28
29 #include "modules/webaudio/DefaultAudioDestinationNode.h" 29 #include "modules/webaudio/DefaultAudioDestinationNode.h"
30 30
31 #include "bindings/v8/ExceptionState.h"
32 #include "core/dom/ExceptionCode.h" 31 #include "core/dom/ExceptionCode.h"
33 #include "core/platform/Logging.h" 32 #include "core/platform/Logging.h"
34 #include "wtf/MainThread.h" 33 #include "wtf/MainThread.h"
35 34
36 const unsigned EnabledInputChannels = 2; 35 const unsigned EnabledInputChannels = 2;
37 36
38 namespace WebCore { 37 namespace WebCore {
39 38
40 DefaultAudioDestinationNode::DefaultAudioDestinationNode(AudioContext* context) 39 DefaultAudioDestinationNode::DefaultAudioDestinationNode(AudioContext* context)
41 : AudioDestinationNode(context, AudioDestination::hardwareSampleRate()) 40 : AudioDestinationNode(context, AudioDestination::hardwareSampleRate())
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 ASSERT(isInitialized()); 102 ASSERT(isInitialized());
104 if (isInitialized()) 103 if (isInitialized())
105 m_destination->start(); 104 m_destination->start();
106 } 105 }
107 106
108 unsigned long DefaultAudioDestinationNode::maxChannelCount() const 107 unsigned long DefaultAudioDestinationNode::maxChannelCount() const
109 { 108 {
110 return AudioDestination::maxChannelCount(); 109 return AudioDestination::maxChannelCount();
111 } 110 }
112 111
113 void DefaultAudioDestinationNode::setChannelCount(unsigned long channelCount, Ex ceptionState& es) 112 void DefaultAudioDestinationNode::setChannelCount(unsigned long channelCount, Ex ceptionCode& ec)
114 { 113 {
115 // The channelCount for the input to this node controls the actual number of channels we 114 // The channelCount for the input to this node controls the actual number of channels we
116 // send to the audio hardware. It can only be set depending on the maximum n umber of 115 // send to the audio hardware. It can only be set depending on the maximum n umber of
117 // channels supported by the hardware. 116 // channels supported by the hardware.
118 117
119 ASSERT(isMainThread()); 118 ASSERT(isMainThread());
120 119
121 if (!maxChannelCount() || channelCount > maxChannelCount()) { 120 if (!maxChannelCount() || channelCount > maxChannelCount()) {
122 es.throwDOMException(InvalidStateError); 121 ec = InvalidStateError;
123 return; 122 return;
124 } 123 }
125 124
126 unsigned long oldChannelCount = this->channelCount(); 125 unsigned long oldChannelCount = this->channelCount();
127 AudioNode::setChannelCount(channelCount, es); 126 AudioNode::setChannelCount(channelCount, ec);
128 127
129 if (!es.hadException() && this->channelCount() != oldChannelCount && isIniti alized()) { 128 if (!ec && this->channelCount() != oldChannelCount && isInitialized()) {
130 // Re-create destination. 129 // Re-create destination.
131 m_destination->stop(); 130 m_destination->stop();
132 createDestination(); 131 createDestination();
133 m_destination->start(); 132 m_destination->start();
134 } 133 }
135 } 134 }
136 135
137 } // namespace WebCore 136 } // namespace WebCore
138 137
139 #endif // ENABLE(WEB_AUDIO) 138 #endif // ENABLE(WEB_AUDIO)
OLDNEW
« no previous file with comments | « Source/modules/webaudio/DefaultAudioDestinationNode.h ('k') | Source/modules/webaudio/DelayNode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698