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

Side by Side Diff: Source/modules/mediastream/MediaStream.cpp

Issue 72363002: Rename es => exceptionState in other than bindings/ (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Retry Created 7 years, 1 month 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 * 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
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 MediaStream::~MediaStream() 126 MediaStream::~MediaStream()
127 { 127 {
128 m_descriptor->setClient(0); 128 m_descriptor->setClient(0);
129 } 129 }
130 130
131 bool MediaStream::ended() const 131 bool MediaStream::ended() const
132 { 132 {
133 return m_stopped || m_descriptor->ended(); 133 return m_stopped || m_descriptor->ended();
134 } 134 }
135 135
136 void MediaStream::addTrack(PassRefPtr<MediaStreamTrack> prpTrack, ExceptionState & es) 136 void MediaStream::addTrack(PassRefPtr<MediaStreamTrack> prpTrack, ExceptionState & exceptionState)
137 { 137 {
138 if (ended()) { 138 if (ended()) {
139 es.throwUninformativeAndGenericDOMException(InvalidStateError); 139 exceptionState.throwUninformativeAndGenericDOMException(InvalidStateErro r);
140 return; 140 return;
141 } 141 }
142 142
143 if (!prpTrack) { 143 if (!prpTrack) {
144 es.throwUninformativeAndGenericDOMException(TypeMismatchError); 144 exceptionState.throwUninformativeAndGenericDOMException(TypeMismatchErro r);
145 return; 145 return;
146 } 146 }
147 147
148 RefPtr<MediaStreamTrack> track = prpTrack; 148 RefPtr<MediaStreamTrack> track = prpTrack;
149 149
150 if (getTrackById(track->id())) 150 if (getTrackById(track->id()))
151 return; 151 return;
152 152
153 RefPtr<MediaStreamComponent> component = MediaStreamComponent::create(m_desc riptor.get(), track->component()->source()); 153 RefPtr<MediaStreamComponent> component = MediaStreamComponent::create(m_desc riptor.get(), track->component()->source());
154 RefPtr<MediaStreamTrack> newTrack = MediaStreamTrack::create(executionContex t(), component.get()); 154 RefPtr<MediaStreamTrack> newTrack = MediaStreamTrack::create(executionContex t(), component.get());
155 155
156 switch (component->source()->type()) { 156 switch (component->source()->type()) {
157 case MediaStreamSource::TypeAudio: 157 case MediaStreamSource::TypeAudio:
158 m_audioTracks.append(newTrack); 158 m_audioTracks.append(newTrack);
159 break; 159 break;
160 case MediaStreamSource::TypeVideo: 160 case MediaStreamSource::TypeVideo:
161 m_videoTracks.append(newTrack); 161 m_videoTracks.append(newTrack);
162 break; 162 break;
163 } 163 }
164 164
165 m_descriptor->addComponent(component.release()); 165 m_descriptor->addComponent(component.release());
166 166
167 MediaStreamCenter::instance().didAddMediaStreamTrack(m_descriptor.get(), new Track->component()); 167 MediaStreamCenter::instance().didAddMediaStreamTrack(m_descriptor.get(), new Track->component());
168 } 168 }
169 169
170 void MediaStream::removeTrack(PassRefPtr<MediaStreamTrack> prpTrack, ExceptionSt ate& es) 170 void MediaStream::removeTrack(PassRefPtr<MediaStreamTrack> prpTrack, ExceptionSt ate& exceptionState)
171 { 171 {
172 if (ended()) { 172 if (ended()) {
173 es.throwUninformativeAndGenericDOMException(InvalidStateError); 173 exceptionState.throwUninformativeAndGenericDOMException(InvalidStateErro r);
174 return; 174 return;
175 } 175 }
176 176
177 if (!prpTrack) { 177 if (!prpTrack) {
178 es.throwUninformativeAndGenericDOMException(TypeMismatchError); 178 exceptionState.throwUninformativeAndGenericDOMException(TypeMismatchErro r);
179 return; 179 return;
180 } 180 }
181 181
182 RefPtr<MediaStreamTrack> track = prpTrack; 182 RefPtr<MediaStreamTrack> track = prpTrack;
183 183
184 size_t pos = kNotFound; 184 size_t pos = kNotFound;
185 switch (track->component()->source()->type()) { 185 switch (track->component()->source()->type()) {
186 case MediaStreamSource::TypeAudio: 186 case MediaStreamSource::TypeAudio:
187 pos = m_audioTracks.find(track); 187 pos = m_audioTracks.find(track);
188 if (pos != kNotFound) 188 if (pos != kNotFound)
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 345
346 events.clear(); 346 events.clear();
347 } 347 }
348 348
349 URLRegistry& MediaStream::registry() const 349 URLRegistry& MediaStream::registry() const
350 { 350 {
351 return MediaStreamRegistry::registry(); 351 return MediaStreamRegistry::registry();
352 } 352 }
353 353
354 } // namespace WebCore 354 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/modules/mediastream/MediaConstraintsImpl.cpp ('k') | Source/modules/mediastream/MediaStreamTrack.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698