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

Unified Diff: third_party/WebKit/Source/modules/peerconnection/RTCTrackEvent.cpp

Issue 2972003002: RTCPeerConnection.ontrack event added. (Closed)
Patch Set: Le merge Created 3 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/peerconnection/RTCTrackEvent.cpp
diff --git a/third_party/WebKit/Source/modules/peerconnection/RTCTrackEvent.cpp b/third_party/WebKit/Source/modules/peerconnection/RTCTrackEvent.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..7051581f6eec94dea5b1282d66a0b407b3fe3e56
--- /dev/null
+++ b/third_party/WebKit/Source/modules/peerconnection/RTCTrackEvent.cpp
@@ -0,0 +1,59 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "modules/peerconnection/RTCTrackEvent.h"
+
+#include "modules/mediastream/MediaStream.h"
+#include "modules/mediastream/MediaStreamTrack.h"
+#include "modules/peerconnection/RTCRtpReceiver.h"
+#include "modules/peerconnection/RTCTrackEventInit.h"
+
+namespace blink {
+
+RTCTrackEvent* RTCTrackEvent::Create(const AtomicString& type,
+ const RTCTrackEventInit& eventInitDict) {
+ return new RTCTrackEvent(type, eventInitDict);
+}
+
+RTCTrackEvent::RTCTrackEvent(const AtomicString& type,
+ const RTCTrackEventInit& eventInitDict)
+ : Event(type, eventInitDict),
+ receiver_(eventInitDict.receiver()),
+ track_(eventInitDict.track()),
+ streams_(eventInitDict.streams()) {
+ DCHECK(receiver_);
+ DCHECK(track_);
+}
+
+RTCTrackEvent::RTCTrackEvent(RTCRtpReceiver* receiver,
+ MediaStreamTrack* track,
+ const HeapVector<Member<MediaStream>>& streams)
+ : Event(EventTypeNames::track, false, false),
+ receiver_(receiver),
+ track_(track),
+ streams_(streams) {
+ DCHECK(receiver_);
+ DCHECK(track_);
+}
+
+RTCRtpReceiver* RTCTrackEvent::receiver() const {
+ return receiver_;
+}
+
+MediaStreamTrack* RTCTrackEvent::track() const {
+ return track_;
+}
+
+HeapVector<Member<MediaStream>> RTCTrackEvent::streams() const {
+ return streams_;
+}
+
+DEFINE_TRACE(RTCTrackEvent) {
+ visitor->Trace(receiver_);
+ visitor->Trace(track_);
+ visitor->Trace(streams_);
+ Event::Trace(visitor);
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698