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

Side by Side Diff: third_party/WebKit/Source/modules/peerconnection/RTCPeerConnection.idl

Issue 2156063002: Preparation for new Promise-based RTCPeerConnection.getStats. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Replaced TODO /w comment what happens if function != 1 args Created 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 * 7 *
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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 97
98 // https://w3c.github.io/webrtc-pc/#legacy-interface-extensions 98 // https://w3c.github.io/webrtc-pc/#legacy-interface-extensions
99 // These methods return Promise<void> because having Promise-based versions requires that all overloads return Promises. 99 // These methods return Promise<void> because having Promise-based versions requires that all overloads return Promises.
100 [CallWith=ScriptState] Promise<void> createOffer(RTCSessionDescriptionCallba ck successCallback, RTCPeerConnectionErrorCallback failureCallback, optional Dic tionary rtcOfferOptions); 100 [CallWith=ScriptState] Promise<void> createOffer(RTCSessionDescriptionCallba ck successCallback, RTCPeerConnectionErrorCallback failureCallback, optional Dic tionary rtcOfferOptions);
101 // TODO(guidou): There should be no mediaConstraints argument. 101 // TODO(guidou): There should be no mediaConstraints argument.
102 [CallWith=ScriptState] Promise<void> createAnswer(RTCSessionDescriptionCallb ack successCallback, RTCPeerConnectionErrorCallback failureCallback, optional Di ctionary mediaConstraints); 102 [CallWith=ScriptState] Promise<void> createAnswer(RTCSessionDescriptionCallb ack successCallback, RTCPeerConnectionErrorCallback failureCallback, optional Di ctionary mediaConstraints);
103 [CallWith=ScriptState] Promise<void> setLocalDescription(RTCSessionDescripti onInit description, VoidCallback successCallback, [Default=Undefined] optional R TCPeerConnectionErrorCallback failureCallback); 103 [CallWith=ScriptState] Promise<void> setLocalDescription(RTCSessionDescripti onInit description, VoidCallback successCallback, [Default=Undefined] optional R TCPeerConnectionErrorCallback failureCallback);
104 // TODO(guidou): The failureCallback argument should be non-optional. 104 // TODO(guidou): The failureCallback argument should be non-optional.
105 [CallWith=ScriptState] Promise<void> setRemoteDescription(RTCSessionDescript ionInit description, VoidCallback successCallback, [Default=Undefined] optional RTCPeerConnectionErrorCallback failureCallback); 105 [CallWith=ScriptState] Promise<void> setRemoteDescription(RTCSessionDescript ionInit description, VoidCallback successCallback, [Default=Undefined] optional RTCPeerConnectionErrorCallback failureCallback);
106 [CallWith=ScriptState, MeasureAs=RTCPeerConnectionAddIceCandidateLegacy] Pro mise<void> addIceCandidate((RTCIceCandidateInit or RTCIceCandidate) candidate, V oidCallback successCallback, RTCPeerConnectionErrorCallback failureCallback); 106 [CallWith=ScriptState, MeasureAs=RTCPeerConnectionAddIceCandidateLegacy] Pro mise<void> addIceCandidate((RTCIceCandidateInit or RTCIceCandidate) candidate, V oidCallback successCallback, RTCPeerConnectionErrorCallback failureCallback);
107
107 // TODO(guidou): The selector argument should the first (nullable, 108 // TODO(guidou): The selector argument should the first (nullable,
108 // non-optional) argument, and there should be a third failureCallback 109 // non-optional) argument, and there should be a third failureCallback
109 // argument. 110 // argument.
110 [CallWith=ExecutionContext, LegacyInterfaceTypeChecking] void getStats(RTCSt atsCallback successCallback, [Default=Undefined] optional MediaStreamTrack selec tor); 111 // TODO(hbos): WebIDL is not able to distinguish between
112 // |getStats(RTCStatsCallback)| and |getStats(MediaStreamTrack)| because
113 // |RTCStatsCallback| is a callback interface and |MediaStreamTrack| is an
114 // interface, see https://heycam.github.io/webidl/#idl-overloading. In order
115 // to support both signatures, |getStats(optional any)| is used. In C++ we
116 // dispatch to the correct |getStats| function based on the value type.
hta - Chromium 2016/07/19 09:56:48 I read heycam to say that an interface is distingu
hbos_chromium 2016/07/19 13:59:35 I might have misinterpreted something. I'm not sur
hbos_chromium 2016/07/20 09:29:48 I've confirmed a second time (crbug.com/629068#c5)
117 //
118 // This is a workaround for the desired WebIDL which is:
119 // [CallWith=ScriptState] Promise<void> getStats(RTCStatsCallback successCa llback, optional MediaStreamTrack? selector);
120 // [CallWith=ScriptState] Promise<RTCStatsReport> getStats(optional MediaSt reamTrack? selector);
121 //
122 // The plan is to have the promise-based version replace the callback-based
123 // version and remove it, then we can use the desired WebIDL and not have to
124 // evaluate the value type ourselves in C++. crbug.com/629068, 627816.
hta - Chromium 2016/07/19 09:56:48 Can you add UMA counters here while you're at it?
hbos_chromium 2016/07/19 13:59:35 Good idea. I'd rather add and have that reviewed i
hbos_chromium 2016/07/20 11:28:44 I looked into it and the change is just a couple o
125 [CallWith=ScriptState] Promise getStats(optional any value);
126 [CallWith=ScriptState] Promise<void> getStats(RTCStatsCallback successCallba ck, MediaStreamTrack? selector);
111 127
112 // https://w3c.github.io/webrtc-pc/#peer-to-peer-data-api 128 // https://w3c.github.io/webrtc-pc/#peer-to-peer-data-api
113 // TODO(guidou): The label argument should have [TreatNullAs=EmptyString] 129 // TODO(guidou): The label argument should have [TreatNullAs=EmptyString]
114 // and be non-nullable. 130 // and be non-nullable.
115 [RaisesException] RTCDataChannel createDataChannel([TreatUndefinedAs=NullStr ing] DOMString? label, optional Dictionary options); 131 [RaisesException] RTCDataChannel createDataChannel([TreatUndefinedAs=NullStr ing] DOMString? label, optional Dictionary options);
116 attribute EventHandler ondatachannel; 132 attribute EventHandler ondatachannel;
117 133
118 // Non-standard or removed from the spec: 134 // Non-standard or removed from the spec:
119 [CallWith=ExecutionContext, RaisesException] void updateIce(optional Diction ary configuration, optional Dictionary mediaConstraints); 135 [CallWith=ExecutionContext, RaisesException] void updateIce(optional Diction ary configuration, optional Dictionary mediaConstraints);
120 sequence<MediaStream> getLocalStreams(); 136 sequence<MediaStream> getLocalStreams();
121 sequence<MediaStream> getRemoteStreams(); 137 sequence<MediaStream> getRemoteStreams();
122 MediaStream getStreamById(DOMString streamId); 138 MediaStream getStreamById(DOMString streamId);
123 [CallWith=ExecutionContext, RaisesException] void addStream(MediaStream? str eam, optional Dictionary mediaConstraints); 139 [CallWith=ExecutionContext, RaisesException] void addStream(MediaStream? str eam, optional Dictionary mediaConstraints);
124 [RaisesException] void removeStream(MediaStream? stream); 140 [RaisesException] void removeStream(MediaStream? stream);
125 [RaisesException] RTCDTMFSender createDTMFSender(MediaStreamTrack track); 141 [RaisesException] RTCDTMFSender createDTMFSender(MediaStreamTrack track);
126 attribute EventHandler onaddstream; 142 attribute EventHandler onaddstream;
127 attribute EventHandler onremovestream; 143 attribute EventHandler onremovestream;
128 144
129 // Certificate management 145 // Certificate management
130 // http://w3c.github.io/webrtc-pc/#sec.cert-mgmt 146 // http://w3c.github.io/webrtc-pc/#sec.cert-mgmt
131 [RaisesException, CallWith=ScriptState] static Promise<RTCCertificate> gener ateCertificate(AlgorithmIdentifier keygenAlgorithm); 147 [RaisesException, CallWith=ScriptState] static Promise<RTCCertificate> gener ateCertificate(AlgorithmIdentifier keygenAlgorithm);
132 }; 148 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698