Bug 1535046 - Part 3 - use native Maybe syntax in place of OptionalTransportProvider in IDPL; r=valentin
authorAlex Gaynor <agaynor@mozilla.com>
Wed, 13 Mar 2019 18:48:55 +0000
changeset 521769 5774650e27cc
parent 521768 ff63b7bac2eb
child 521770 011f952132f0
push id10867
push userdvarga@mozilla.com
push dateThu, 14 Mar 2019 15:20:45 +0000
treeherdermozilla-beta@abad13547875 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvalentin
bugs1535046
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1535046 - Part 3 - use native Maybe syntax in place of OptionalTransportProvider in IDPL; r=valentin Depends on D23345 Differential Revision: https://phabricator.services.mozilla.com/D23346
netwerk/protocol/websocket/PWebSocket.ipdl
netwerk/protocol/websocket/WebSocketChannelChild.cpp
netwerk/protocol/websocket/WebSocketChannelParent.cpp
netwerk/protocol/websocket/WebSocketChannelParent.h
--- a/netwerk/protocol/websocket/PWebSocket.ipdl
+++ b/netwerk/protocol/websocket/PWebSocket.ipdl
@@ -17,22 +17,16 @@ include protocol PChildToParentStream; /
 include protocol PParentToChildStream; //FIXME: bug #792908
 
 using class IPC::SerializedLoadContext from "SerializedLoadContext.h";
 using struct mozilla::void_t from "ipc/IPCMessageUtils.h";
 
 namespace mozilla {
 namespace net {
 
-union OptionalTransportProvider
-{
-  PTransportProvider;
-  void_t;
-};
-
 async protocol PWebSocket
 {
   manager PNecko;
 
 parent:
   // Forwarded methods corresponding to methods on nsIWebSocketChannel
   async AsyncOpen(URIParams? aURI,
                   nsCString aOrigin,
@@ -40,17 +34,17 @@ parent:
                   nsCString aProtocol,
                   bool aSecure,
                   // ping values only meaningful if client set them
                   uint32_t aPingInterval,
                   bool aClientSetPingInterval,
                   uint32_t aPingTimeout,
                   bool aClientSetPingTimeout,
                   LoadInfoArgs? aLoadInfoArgs,
-                  OptionalTransportProvider aProvider,
+                  PTransportProvider? aProvider,
                   nsCString aNegotiatedExtensions);
   async Close(uint16_t code, nsCString reason);
   async SendMsg(nsCString aMsg);
   async SendBinaryMsg(nsCString aMsg);
   async SendBinaryStream(IPCStream aStream, uint32_t aLength);
 
   async DeleteSelf();
 
--- a/netwerk/protocol/websocket/WebSocketChannelChild.cpp
+++ b/netwerk/protocol/websocket/WebSocketChannelChild.cpp
@@ -441,32 +441,32 @@ WebSocketChannelChild::AsyncOpen(nsIURI*
     return NS_ERROR_FAILURE;
   }
 
   // Corresponding release in DeallocPWebSocket
   AddIPDLReference();
 
   Maybe<URIParams> uri;
   Maybe<LoadInfoArgs> loadInfoArgs;
-  OptionalTransportProvider transportProvider;
+  Maybe<PTransportProviderChild*> transportProvider;
 
   if (!mIsServerSide) {
     uri.emplace(URIParams());
     SerializeURI(aURI, uri.ref());
     nsresult rv = LoadInfoToLoadInfoArgs(mLoadInfo, &loadInfoArgs);
     NS_ENSURE_SUCCESS(rv, rv);
 
-    transportProvider = void_t();
+    transportProvider = Nothing();
   } else {
     MOZ_ASSERT(mServerTransportProvider);
     PTransportProviderChild* ipcChild;
     nsresult rv = mServerTransportProvider->GetIPCChild(&ipcChild);
     NS_ENSURE_SUCCESS(rv, rv);
 
-    transportProvider = ipcChild;
+    transportProvider = Some(ipcChild);
   }
 
   // This must be called before sending constructor message.
   SetupNeckoTarget();
 
   gNeckoChild->SendPWebSocketConstructor(
       this, tabChild, IPC::SerializedLoadContext(this), mSerial);
   if (!SendAsyncOpen(uri, nsCString(aOrigin), aInnerWindowID, mProtocol,
--- a/netwerk/protocol/websocket/WebSocketChannelParent.cpp
+++ b/netwerk/protocol/websocket/WebSocketChannelParent.cpp
@@ -48,17 +48,17 @@ mozilla::ipc::IPCResult WebSocketChannel
 }
 
 mozilla::ipc::IPCResult WebSocketChannelParent::RecvAsyncOpen(
     const Maybe<URIParams>& aURI, const nsCString& aOrigin,
     const uint64_t& aInnerWindowID, const nsCString& aProtocol,
     const bool& aSecure, const uint32_t& aPingInterval,
     const bool& aClientSetPingInterval, const uint32_t& aPingTimeout,
     const bool& aClientSetPingTimeout, const Maybe<LoadInfoArgs>& aLoadInfoArgs,
-    const OptionalTransportProvider& aTransportProvider,
+    const Maybe<PTransportProviderParent*>& aTransportProvider,
     const nsCString& aNegotiatedExtensions) {
   LOG(("WebSocketChannelParent::RecvAsyncOpen() %p\n", this));
 
   nsresult rv;
   nsCOMPtr<nsIURI> uri;
   nsCOMPtr<nsILoadInfo> loadInfo;
 
   rv = LoadInfoArgsToLoadInfo(aLoadInfoArgs, getter_AddRefs(loadInfo));
@@ -86,20 +86,19 @@ mozilla::ipc::IPCResult WebSocketChannel
   }
 
   rv = mChannel->SetNotificationCallbacks(this);
   if (NS_FAILED(rv)) goto fail;
 
   rv = mChannel->SetProtocol(aProtocol);
   if (NS_FAILED(rv)) goto fail;
 
-  if (aTransportProvider.type() != OptionalTransportProvider::Tvoid_t) {
+  if (aTransportProvider.isSome()) {
     RefPtr<TransportProviderParent> provider =
-        static_cast<TransportProviderParent*>(
-            aTransportProvider.get_PTransportProviderParent());
+        static_cast<TransportProviderParent*>(aTransportProvider.value());
     rv = mChannel->SetServerParameters(provider, aNegotiatedExtensions);
     if (NS_FAILED(rv)) {
       goto fail;
     }
   } else {
     uri = DeserializeURI(aURI);
     if (!uri) {
       rv = NS_ERROR_FAILURE;
--- a/netwerk/protocol/websocket/WebSocketChannelParent.h
+++ b/netwerk/protocol/websocket/WebSocketChannelParent.h
@@ -40,17 +40,17 @@ class WebSocketChannelParent : public PW
  private:
   mozilla::ipc::IPCResult RecvAsyncOpen(
       const Maybe<URIParams>& aURI, const nsCString& aOrigin,
       const uint64_t& aInnerWindowID, const nsCString& aProtocol,
       const bool& aSecure, const uint32_t& aPingInterval,
       const bool& aClientSetPingInterval, const uint32_t& aPingTimeout,
       const bool& aClientSetPingTimeout,
       const Maybe<LoadInfoArgs>& aLoadInfoArgs,
-      const OptionalTransportProvider& aTransportProvider,
+      const Maybe<PTransportProviderParent*>& aTransportProvider,
       const nsCString& aNegotiatedExtensions);
   mozilla::ipc::IPCResult RecvClose(const uint16_t& code,
                                     const nsCString& reason);
   mozilla::ipc::IPCResult RecvSendMsg(const nsCString& aMsg);
   mozilla::ipc::IPCResult RecvSendBinaryMsg(const nsCString& aMsg);
   mozilla::ipc::IPCResult RecvSendBinaryStream(const IPCStream& aStream,
                                                const uint32_t& aLength);
   mozilla::ipc::IPCResult RecvDeleteSelf();