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

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

Issue 397903003: Implement sequence<MediaStreamTrack> getTracks () This is to conform to the new spec- http://dev.w3… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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
« no previous file with comments | « Source/modules/mediastream/MediaStream.h ('k') | Source/modules/mediastream/MediaStream.idl » ('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
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 MediaStream::~MediaStream() 151 MediaStream::~MediaStream()
152 { 152 {
153 m_descriptor->setClient(0); 153 m_descriptor->setClient(0);
154 } 154 }
155 155
156 bool MediaStream::ended() const 156 bool MediaStream::ended() const
157 { 157 {
158 return m_stopped || m_descriptor->ended(); 158 return m_stopped || m_descriptor->ended();
159 } 159 }
160 160
161 MediaStreamTrackVector MediaStream::getTracks()
162 {
163 MediaStreamTrackVector tracks;
164 for (MediaStreamTrackVector::iterator iter = m_audioTracks.begin(); iter != m_audioTracks.end(); ++iter)
165 tracks.append(iter->get());
166 for (MediaStreamTrackVector::iterator iter = m_videoTracks.begin(); iter != m_videoTracks.end(); ++iter)
167 tracks.append(iter->get());
168 return tracks;
169 }
170
161 void MediaStream::addTrack(MediaStreamTrack* track, ExceptionState& exceptionSta te) 171 void MediaStream::addTrack(MediaStreamTrack* track, ExceptionState& exceptionSta te)
162 { 172 {
163 if (ended()) { 173 if (ended()) {
164 exceptionState.throwDOMException(InvalidStateError, "The MediaStream is finished."); 174 exceptionState.throwDOMException(InvalidStateError, "The MediaStream is finished.");
165 return; 175 return;
166 } 176 }
167 177
168 if (!track) { 178 if (!track) {
169 exceptionState.throwDOMException(TypeMismatchError, "The MediaStreamTrac k provided is invalid."); 179 exceptionState.throwDOMException(TypeMismatchError, "The MediaStreamTrac k provided is invalid.");
170 return; 180 return;
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 392
383 void MediaStream::trace(Visitor* visitor) 393 void MediaStream::trace(Visitor* visitor)
384 { 394 {
385 visitor->trace(m_audioTracks); 395 visitor->trace(m_audioTracks);
386 visitor->trace(m_videoTracks); 396 visitor->trace(m_videoTracks);
387 visitor->trace(m_scheduledEvents); 397 visitor->trace(m_scheduledEvents);
388 EventTargetWithInlineData::trace(visitor); 398 EventTargetWithInlineData::trace(visitor);
389 } 399 }
390 400
391 } // namespace WebCore 401 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/modules/mediastream/MediaStream.h ('k') | Source/modules/mediastream/MediaStream.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698