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

Side by Side Diff: Source/modules/mediastream/MediaStream.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
« no previous file with comments | « Source/modules/mediastream/MediaStream.h ('k') | Source/modules/mediastream/MediaStreamTrack.h » ('j') | 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) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * Copyright (C) 2011, 2012 Ericsson AB. All rights reserved. 3 * Copyright (C) 2011, 2012 Ericsson AB. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the 11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution. 12 * documentation and/or other materials provided with the distribution.
13 * 13 *
14 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND AN Y 14 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND AN Y
15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17 * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR AN Y 17 * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR AN Y
18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND O N 20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND O N
21 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #include "config.h" 26 #include "config.h"
27 #include "modules/mediastream/MediaStream.h" 27 #include "modules/mediastream/MediaStream.h"
28 28
29 #include "bindings/v8/ExceptionState.h"
30 #include "core/dom/Event.h" 29 #include "core/dom/Event.h"
31 #include "core/dom/ExceptionCode.h" 30 #include "core/dom/ExceptionCode.h"
32 #include "core/platform/mediastream/MediaStreamCenter.h" 31 #include "core/platform/mediastream/MediaStreamCenter.h"
33 #include "core/platform/mediastream/MediaStreamSource.h" 32 #include "core/platform/mediastream/MediaStreamSource.h"
34 #include "modules/mediastream/MediaStreamRegistry.h" 33 #include "modules/mediastream/MediaStreamRegistry.h"
35 #include "modules/mediastream/MediaStreamTrackEvent.h" 34 #include "modules/mediastream/MediaStreamTrackEvent.h"
36 35
37 namespace WebCore { 36 namespace WebCore {
38 37
39 static bool containsSource(MediaStreamSourceVector& sourceVector, MediaStreamSou rce* source) 38 static bool containsSource(MediaStreamSourceVector& sourceVector, MediaStreamSou rce* source)
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 MediaStream::~MediaStream() 125 MediaStream::~MediaStream()
127 { 126 {
128 m_descriptor->setClient(0); 127 m_descriptor->setClient(0);
129 } 128 }
130 129
131 bool MediaStream::ended() const 130 bool MediaStream::ended() const
132 { 131 {
133 return m_stopped || m_descriptor->ended(); 132 return m_stopped || m_descriptor->ended();
134 } 133 }
135 134
136 void MediaStream::addTrack(PassRefPtr<MediaStreamTrack> prpTrack, ExceptionState & es) 135 void MediaStream::addTrack(PassRefPtr<MediaStreamTrack> prpTrack, ExceptionCode& ec)
137 { 136 {
138 if (ended()) { 137 if (ended()) {
139 es.throwDOMException(InvalidStateError); 138 ec = InvalidStateError;
140 return; 139 return;
141 } 140 }
142 141
143 if (!prpTrack) { 142 if (!prpTrack) {
144 es.throwDOMException(TypeMismatchError); 143 ec = TypeMismatchError;
145 return; 144 return;
146 } 145 }
147 146
148 RefPtr<MediaStreamTrack> track = prpTrack; 147 RefPtr<MediaStreamTrack> track = prpTrack;
149 148
150 if (getTrackById(track->id())) 149 if (getTrackById(track->id()))
151 return; 150 return;
152 151
153 RefPtr<MediaStreamComponent> component = MediaStreamComponent::create(m_desc riptor.get(), track->component()->source()); 152 RefPtr<MediaStreamComponent> component = MediaStreamComponent::create(m_desc riptor.get(), track->component()->source());
154 RefPtr<MediaStreamTrack> newTrack = MediaStreamTrack::create(scriptExecution Context(), component.get()); 153 RefPtr<MediaStreamTrack> newTrack = MediaStreamTrack::create(scriptExecution Context(), component.get());
155 154
156 switch (component->source()->type()) { 155 switch (component->source()->type()) {
157 case MediaStreamSource::TypeAudio: 156 case MediaStreamSource::TypeAudio:
158 m_audioTracks.append(newTrack); 157 m_audioTracks.append(newTrack);
159 break; 158 break;
160 case MediaStreamSource::TypeVideo: 159 case MediaStreamSource::TypeVideo:
161 m_videoTracks.append(newTrack); 160 m_videoTracks.append(newTrack);
162 break; 161 break;
163 } 162 }
164 163
165 m_descriptor->addComponent(component.release()); 164 m_descriptor->addComponent(component.release());
166 165
167 MediaStreamCenter::instance().didAddMediaStreamTrack(m_descriptor.get(), new Track->component()); 166 MediaStreamCenter::instance().didAddMediaStreamTrack(m_descriptor.get(), new Track->component());
168 } 167 }
169 168
170 void MediaStream::removeTrack(PassRefPtr<MediaStreamTrack> prpTrack, ExceptionSt ate& es) 169 void MediaStream::removeTrack(PassRefPtr<MediaStreamTrack> prpTrack, ExceptionCo de& ec)
171 { 170 {
172 if (ended()) { 171 if (ended()) {
173 es.throwDOMException(InvalidStateError); 172 ec = InvalidStateError;
174 return; 173 return;
175 } 174 }
176 175
177 if (!prpTrack) { 176 if (!prpTrack) {
178 es.throwDOMException(TypeMismatchError); 177 ec = TypeMismatchError;
179 return; 178 return;
180 } 179 }
181 180
182 RefPtr<MediaStreamTrack> track = prpTrack; 181 RefPtr<MediaStreamTrack> track = prpTrack;
183 182
184 size_t pos = notFound; 183 size_t pos = notFound;
185 switch (track->component()->source()->type()) { 184 switch (track->component()->source()->type()) {
186 case MediaStreamSource::TypeAudio: 185 case MediaStreamSource::TypeAudio:
187 pos = m_audioTracks.find(track); 186 pos = m_audioTracks.find(track);
188 if (pos != notFound) 187 if (pos != notFound)
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 354
356 events.clear(); 355 events.clear();
357 } 356 }
358 357
359 URLRegistry& MediaStream::registry() const 358 URLRegistry& MediaStream::registry() const
360 { 359 {
361 return MediaStreamRegistry::registry(); 360 return MediaStreamRegistry::registry();
362 } 361 }
363 362
364 } // namespace WebCore 363 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/modules/mediastream/MediaStream.h ('k') | Source/modules/mediastream/MediaStreamTrack.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698