RESOLVED FIXED 169664
Flatten RTC enum naming
https://bugs.webkit.org/show_bug.cgi?id=169664
Summary Flatten RTC enum naming
Jon Lee
Reported 2017-03-15 00:17:07 PDT
RTC enums are often used as subtypes of classes. Unify them to use the same naming throughout.
Attachments
Patch (92.53 KB, patch)
2017-03-15 00:44 PDT, Jon Lee
no flags
Patch (91.33 KB, patch)
2017-03-15 13:36 PDT, Jon Lee
no flags
Patch (92.89 KB, patch)
2017-03-15 15:19 PDT, Jon Lee
youennf: review+
Jon Lee
Comment 1 2017-03-15 00:44:53 PDT
Jon Lee
Comment 2 2017-03-15 00:45:15 PDT
Patch is built on top of 169660.
youenn fablet
Comment 3 2017-03-15 08:56:48 PDT
Comment on attachment 304486 [details] Patch LGTM! Some comments below. Will r+ once rebased. View in context: https://bugs.webkit.org/attachment.cgi?id=304486&action=review > Source/WebCore/Modules/mediastream/MediaEndpointPeerConnection.cpp:333 > + if (m_peerConnection.signalingState() == RTCSignalingState::Closed) Nice! > Source/WebCore/Modules/mediastream/MediaEndpointPeerConnection.cpp:821 > + case RTCIceTransportState::New: ++newCount; break; This does not match WebKit style. > Source/WebCore/Modules/mediastream/MediaEndpointPeerConnection.cpp:865 > + Vector<RTCIceTransportState> transportStates; I know this is untouched code. Would you be able to use reserveInitialCapacity/uncheckedAppend > Source/WebCore/Modules/mediastream/MediaEndpointPeerConnection.cpp:870 > + m_peerConnection.updateIceConnectionState(static_cast<RTCIceConnectionState>(derivedState)); This looks bad, deriveAggregatedIceConnectionState should really be changed to return RTCIceConnectionState. > Source/WebCore/Modules/mediastream/RTCConfiguration.idl:29 > + ImplementedAs=RTCIceTransportPolicy Out of curiosity why do you need to add ImplementedAs? Is it because otherwise it would be named RTCConfiguration::RTCIceTransportPolicy? > Source/WebCore/Modules/mediastream/RTCConfiguration.idl:39 > +] enum RTCBundlePolicy { Given the direction, I guess we should put RTCBundlePolicy and RTCIceTransportPolicy enum class definitions in RTCConfiguration.h It is not very clear why this enum does not have its own IDL file and others will. I guess it is ok anyway. > Source/WebCore/Modules/mediastream/RTCIceConnectionState.h:28 > +#include "PeerConnectionStates.h" That seems a bit strange, could we not move connection state enum here and include this file in PeerConnectionStates.h? Ditto for the other files.
Jon Lee
Comment 4 2017-03-15 11:31:33 PDT
Comment on attachment 304486 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=304486&action=review >> Source/WebCore/Modules/mediastream/MediaEndpointPeerConnection.cpp:821 >> + case RTCIceTransportState::New: ++newCount; break; > > This does not match WebKit style. I can split these out into separate lines. >> Source/WebCore/Modules/mediastream/MediaEndpointPeerConnection.cpp:865 >> + Vector<RTCIceTransportState> transportStates; > > I know this is untouched code. > Would you be able to use reserveInitialCapacity/uncheckedAppend I prefer not doing fly-by fixes in these kinds of patches; it'll be confusing during blaming. >> Source/WebCore/Modules/mediastream/MediaEndpointPeerConnection.cpp:870 >> + m_peerConnection.updateIceConnectionState(static_cast<RTCIceConnectionState>(derivedState)); > > This looks bad, deriveAggregatedIceConnectionState should really be changed to return RTCIceConnectionState. Ditto. >> Source/WebCore/Modules/mediastream/RTCConfiguration.idl:29 >> + ImplementedAs=RTCIceTransportPolicy > > Out of curiosity why do you need to add ImplementedAs? Is it because otherwise it would be named RTCConfiguration::RTCIceTransportPolicy? Then it is generated as RTCIceTransportPolicy rather than RTCConfiguration::IceTransportPolicy (the script removes common prefixes). >> Source/WebCore/Modules/mediastream/RTCConfiguration.idl:39 >> +] enum RTCBundlePolicy { > > Given the direction, I guess we should put RTCBundlePolicy and RTCIceTransportPolicy enum class definitions in RTCConfiguration.h > It is not very clear why this enum does not have its own IDL file and others will. I guess it is ok anyway. I include enums in the same file as the main IDL definition if they are not used elsewhere in the spec. If they are used in multiple places, then the enum has to be declared separately. >> Source/WebCore/Modules/mediastream/RTCIceConnectionState.h:28 >> +#include "PeerConnectionStates.h" > > That seems a bit strange, could we not move connection state enum here and include this file in PeerConnectionStates.h? > Ditto for the other files. This would be a layering violation, no?
Jon Lee
Comment 5 2017-03-15 13:36:07 PDT
Radar WebKit Bug Importer
Comment 6 2017-03-15 13:37:12 PDT
Jon Lee
Comment 7 2017-03-15 15:19:06 PDT
Jon Lee
Comment 8 2017-03-15 15:44:14 PDT
(In reply to comment #3) > > > > Source/WebCore/Modules/mediastream/MediaEndpointPeerConnection.cpp:865 > > + Vector<RTCIceTransportState> transportStates; > > I know this is untouched code. > Would you be able to use reserveInitialCapacity/uncheckedAppend > > > Source/WebCore/Modules/mediastream/MediaEndpointPeerConnection.cpp:870 > > + m_peerConnection.updateIceConnectionState(static_cast<RTCIceConnectionState>(derivedState)); > > This looks bad, deriveAggregatedIceConnectionState should really be changed > to return RTCIceConnectionState. > For these two comments, filed bug 169709.
youenn fablet
Comment 9 2017-03-15 15:45:01 PDT
> > I know this is untouched code. > > Would you be able to use reserveInitialCapacity/uncheckedAppend > > I prefer not doing fly-by fixes in these kinds of patches; it'll be > confusing during blaming. This kind of refactoring is usual, like doing Ref/RefPtr things. > >> Source/WebCore/Modules/mediastream/MediaEndpointPeerConnection.cpp:870 > >> + m_peerConnection.updateIceConnectionState(static_cast<RTCIceConnectionState>(derivedState)); > > > > This looks bad, deriveAggregatedIceConnectionState should really be changed to return RTCIceConnectionState. > > Ditto. Put a FIXME then?
Jon Lee
Comment 10 2017-03-15 23:10:57 PDT
Note You need to log in before you can comment on or make changes to this bug.