Bug 1575744 - P8. Remove no longer necessary interface. r=mayhemer
authorJean-Yves Avenard <jyavenard@mozilla.com>
Fri, 20 Sep 2019 04:09:48 +0000
changeset 494442 772f7e11c7e59031e4d12df2a39844918b180beb
parent 494441 2d175e2bf5b81f1c92f5d970f34ff608234e58f4
child 494443 4d81f578aa35b57062c58ceb058d8429dd619fd2
push id114118
push userrgurzau@mozilla.com
push dateSun, 22 Sep 2019 09:59:04 +0000
treeherdermozilla-inbound@772f7e11c7e5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmayhemer
bugs1575744
milestone71.0a1
first release with
nightly linux32
772f7e11c7e5 / 71.0a1 / 20190922095557 / files
nightly linux64
772f7e11c7e5 / 71.0a1 / 20190922095557 / files
nightly mac
772f7e11c7e5 / 71.0a1 / 20190922095557 / files
nightly win32
772f7e11c7e5 / 71.0a1 / 20190922095557 / files
nightly win64
772f7e11c7e5 / 71.0a1 / 20190922095557 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1575744 - P8. Remove no longer necessary interface. r=mayhemer Thanks to the promisifying of SendCrossProcessRedirect we no longer needs callback to DocumentChannelParent from nsHttpChannelParent. So we can remove the interface that allowed to do so. Differential Revision: https://phabricator.services.mozilla.com/D46174
netwerk/base/moz.build
netwerk/base/nsICrossProcessSwitchChannel.idl
netwerk/base/nsIProcessSwitchRequestor.idl
netwerk/ipc/DocumentChannelParent.cpp
netwerk/ipc/DocumentChannelParent.h
netwerk/protocol/http/HttpChannelParent.cpp
netwerk/protocol/http/HttpChannelParent.h
netwerk/protocol/http/nsHttpChannel.cpp
netwerk/protocol/http/nsHttpChannel.h
netwerk/protocol/http/nsHttpHandler.cpp
--- a/netwerk/base/moz.build
+++ b/netwerk/base/moz.build
@@ -30,17 +30,16 @@ XPIDL_SOURCES += [
     'nsICaptivePortalService.idl',
     'nsIChannel.idl',
     'nsIChannelEventSink.idl',
     'nsIChannelWithDivertableParentListener.idl',
     'nsIChildChannel.idl',
     'nsIClassifiedChannel.idl',
     'nsIClassOfService.idl',
     'nsIContentSniffer.idl',
-    'nsICrossProcessSwitchChannel.idl',
     'nsIDashboard.idl',
     'nsIDashboardEventNotifier.idl',
     'nsIDeprecationWarner.idl',
     'nsIDHCPClient.idl',
     'nsIDivertableChannel.idl',
     'nsIDownloader.idl',
     'nsIEncodedChannel.idl',
     'nsIExternalProtocolHandler.idl',
@@ -71,16 +70,17 @@ XPIDL_SOURCES += [
     'nsINetworkPredictor.idl',
     'nsINetworkPredictorVerifier.idl',
     'nsINullChannel.idl',
     'nsIParentChannel.idl',
     'nsIParentRedirectingChannel.idl',
     'nsIPermission.idl',
     'nsIPermissionManager.idl',
     'nsIPrivateBrowsingChannel.idl',
+    'nsIProcessSwitchRequestor.idl',
     'nsIProgressEventSink.idl',
     'nsIPrompt.idl',
     'nsIProtocolHandler.idl',
     'nsIProtocolProxyCallback.idl',
     'nsIProtocolProxyFilter.idl',
     'nsIProtocolProxyService.idl',
     'nsIProtocolProxyService2.idl',
     'nsIProxiedChannel.idl',
rename from netwerk/base/nsICrossProcessSwitchChannel.idl
rename to netwerk/base/nsIProcessSwitchRequestor.idl
--- a/netwerk/base/nsICrossProcessSwitchChannel.idl
+++ b/netwerk/base/nsIProcessSwitchRequestor.idl
@@ -1,34 +1,15 @@
 /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  *
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#include "nsISupports.idl"
-#include "nsIAsyncVerifyRedirectCallback.idl"
-#include "nsIHttpChannel.idl"
-
-[scriptable, uuid(d2471b64-0292-4cb5-b801-914e34b31af0)]
-interface nsICrossProcessSwitchChannel : nsISupports
-{
-  /**
-   *  When a process switch is about to start,
-   *  nsHttpChannel will call this method on DocumentChannelParent or
-   *  HttpChannelParent
-   *
-   *  @param channel
-   *         nsIHttpChannel caller.
-   *  @param identifier
-   *         identifier from SessionStore to be passed to the childChannel in
-   *         order to identify it.
-   */
-  void triggerCrossProcessSwitch(in nsIHttpChannel channel, in uint64_t identifier);
-};
+#include "nsIChannel.idl"
 
 /**
  * The nsIProcessSwitchRequestor interface allows clients to instruct
  * SessionStore.jsm that a channel setup has completed and a process switch
  * may be required. This works alongside the on-may-change-process observer
  * notification.
  * This interface must be used only from the XPCOM main thread.
  */
--- a/netwerk/ipc/DocumentChannelParent.cpp
+++ b/netwerk/ipc/DocumentChannelParent.cpp
@@ -34,17 +34,16 @@ NS_IMPL_RELEASE(DocumentChannelParent)
 
 NS_INTERFACE_MAP_BEGIN(DocumentChannelParent)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIInterfaceRequestor)
   NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
   NS_INTERFACE_MAP_ENTRY(nsIRequestObserver)
   NS_INTERFACE_MAP_ENTRY(nsIStreamListener)
   NS_INTERFACE_MAP_ENTRY(nsIParentChannel)
   NS_INTERFACE_MAP_ENTRY(nsIAsyncVerifyRedirectReadyCallback)
-  NS_INTERFACE_MAP_ENTRY(nsICrossProcessSwitchChannel)
   NS_INTERFACE_MAP_ENTRY(nsIChannelEventSink)
   NS_INTERFACE_MAP_ENTRY(nsIProcessSwitchRequestor)
   NS_INTERFACE_MAP_ENTRY_CONCRETE(DocumentChannelParent)
 NS_INTERFACE_MAP_END
 
 DocumentChannelParent::DocumentChannelParent(
     const PBrowserOrId& iframeEmbedding, nsILoadContext* aLoadContext,
     PBOverrideStatus aOverrideStatus)
@@ -354,24 +353,16 @@ void DocumentChannelParent::FinishReplac
     if (mStopRequestValue) {
       redirectChannel->OnStopRequest(mChannel, *mStopRequestValue);
     }
 
     mChannel->Resume();
   }
 }
 
-nsresult DocumentChannelParent::TriggerCrossProcessSwitch(
-    nsIHttpChannel* aChannel, uint64_t aIdentifier) {
-  MOZ_ASSERT_UNREACHABLE(
-      "We can no longer be called from nsHttpChannel, this interface will be "
-      "removed in a follow-up patch");
-  return NS_OK;
-}
-
 void DocumentChannelParent::TriggerCrossProcessSwitch() {
   MOZ_ASSERT(mRedirectContentProcessIdPromise);
   CancelChildForProcessSwitch();
   RefPtr<DocumentChannelParent> self = this;
   mRedirectContentProcessIdPromise->Then(
       GetMainThreadSerialEventTarget(), __func__,
       [self, this](uint64_t aCpId) {
         MOZ_ASSERT(mChannel, "Something went wrong, channel got cancelled");
--- a/netwerk/ipc/DocumentChannelParent.h
+++ b/netwerk/ipc/DocumentChannelParent.h
@@ -8,21 +8,21 @@
 #define mozilla_net_DocumentChannelParent_h
 
 #include "mozilla/MozPromise.h"
 #include "mozilla/Variant.h"
 #include "mozilla/net/NeckoCommon.h"
 #include "mozilla/net/NeckoParent.h"
 #include "mozilla/net/PDocumentChannelParent.h"
 #include "mozilla/net/ParentChannelListener.h"
-#include "nsICrossProcessSwitchChannel.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsIObserver.h"
 #include "nsIParentChannel.h"
 #include "nsIParentRedirectingChannel.h"
+#include "nsIProcessSwitchRequestor.h"
 #include "nsIRedirectResultListener.h"
 
 #define DOCUMENT_CHANNEL_PARENT_IID                  \
   {                                                  \
     0x3b393c56, 0x9e01, 0x11e9, {                    \
       0xa2, 0xa3, 0x2a, 0x2a, 0xe2, 0xdb, 0xcc, 0xe4 \
     }                                                \
   }
@@ -32,34 +32,32 @@ namespace net {
 
 // TODO: We currently don't implement nsIProgressEventSink and forward those
 // to the child. Should we? We get the interface requested.
 class DocumentChannelParent : public nsIInterfaceRequestor,
                               public PDocumentChannelParent,
                               public nsIAsyncVerifyRedirectReadyCallback,
                               public nsIParentChannel,
                               public nsIChannelEventSink,
-                              public nsICrossProcessSwitchChannel,
                               public HttpChannelSecurityWarningReporter,
                               public nsIProcessSwitchRequestor {
  public:
   explicit DocumentChannelParent(const dom::PBrowserOrId& iframeEmbedding,
                                  nsILoadContext* aLoadContext,
                                  PBOverrideStatus aOverrideStatus);
 
   bool Init(const DocumentChannelCreationArgs& aArgs);
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSIREQUESTOBSERVER
   NS_DECL_NSISTREAMLISTENER
   NS_DECL_NSIPARENTCHANNEL
   NS_DECL_NSIINTERFACEREQUESTOR
   NS_DECL_NSIASYNCVERIFYREDIRECTREADYCALLBACK
   NS_DECL_NSICHANNELEVENTSINK
-  NS_DECL_NSICROSSPROCESSSWITCHCHANNEL
   NS_DECL_NSIPROCESSSWITCHREQUESTOR
 
   NS_DECLARE_STATIC_IID_ACCESSOR(DOCUMENT_CHANNEL_PARENT_IID)
 
   bool RecvCancel(const nsresult& status);
   bool RecvSuspend();
   bool RecvResume();
 
--- a/netwerk/protocol/http/HttpChannelParent.cpp
+++ b/netwerk/protocol/http/HttpChannelParent.cpp
@@ -284,17 +284,16 @@ NS_INTERFACE_MAP_BEGIN(HttpChannelParent
   NS_INTERFACE_MAP_ENTRY(nsIStreamListener)
   NS_INTERFACE_MAP_ENTRY(nsIParentChannel)
   NS_INTERFACE_MAP_ENTRY(nsIAuthPromptProvider)
   NS_INTERFACE_MAP_ENTRY(nsIParentRedirectingChannel)
   NS_INTERFACE_MAP_ENTRY(nsIDeprecationWarner)
   NS_INTERFACE_MAP_ENTRY(nsIAsyncVerifyRedirectReadyCallback)
   NS_INTERFACE_MAP_ENTRY(nsIChannelEventSink)
   NS_INTERFACE_MAP_ENTRY(nsIRedirectResultListener)
-  NS_INTERFACE_MAP_ENTRY(nsICrossProcessSwitchChannel)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIParentRedirectingChannel)
   NS_INTERFACE_MAP_ENTRY_CONCRETE(HttpChannelParent)
 NS_INTERFACE_MAP_END
 
 //-----------------------------------------------------------------------------
 // HttpChannelParent::nsIInterfaceRequestor
 //-----------------------------------------------------------------------------
 
--- a/netwerk/protocol/http/HttpChannelParent.h
+++ b/netwerk/protocol/http/HttpChannelParent.h
@@ -9,17 +9,16 @@
 #define mozilla_net_HttpChannelParent_h
 
 #include "ADivertableParentChannel.h"
 #include "nsHttp.h"
 #include "mozilla/net/PHttpChannelParent.h"
 #include "mozilla/net/NeckoCommon.h"
 #include "mozilla/net/NeckoParent.h"
 #include "mozilla/MozPromise.h"
-#include "nsICrossProcessSwitchChannel.h"
 #include "nsIObserver.h"
 #include "nsIParentRedirectingChannel.h"
 #include "nsIProgressEventSink.h"
 #include "nsIChannelEventSink.h"
 #include "nsIRedirectResultListener.h"
 #include "nsHttpChannel.h"
 #include "nsIAuthPromptProvider.h"
 #include "mozilla/dom/ipc/IdType.h"
@@ -56,34 +55,32 @@ class HttpChannelParent final : public n
                                 public nsIParentRedirectingChannel,
                                 public nsIProgressEventSink,
                                 public ADivertableParentChannel,
                                 public nsIAuthPromptProvider,
                                 public nsIDeprecationWarner,
                                 public HttpChannelSecurityWarningReporter,
                                 public nsIAsyncVerifyRedirectReadyCallback,
                                 public nsIChannelEventSink,
-                                public nsIRedirectResultListener,
-                                public nsICrossProcessSwitchChannel {
+                                public nsIRedirectResultListener {
   virtual ~HttpChannelParent();
 
  public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIREQUESTOBSERVER
   NS_DECL_NSISTREAMLISTENER
   NS_DECL_NSIPARENTCHANNEL
   NS_DECL_NSIPARENTREDIRECTINGCHANNEL
   NS_DECL_NSIPROGRESSEVENTSINK
   NS_DECL_NSIINTERFACEREQUESTOR
   NS_DECL_NSIAUTHPROMPTPROVIDER
   NS_DECL_NSIDEPRECATIONWARNER
   NS_DECL_NSIASYNCVERIFYREDIRECTREADYCALLBACK
   NS_DECL_NSICHANNELEVENTSINK
   NS_DECL_NSIREDIRECTRESULTLISTENER
-  NS_DECL_NSICROSSPROCESSSWITCHCHANNEL
 
   NS_DECLARE_STATIC_IID_ACCESSOR(HTTP_CHANNEL_PARENT_IID)
 
   HttpChannelParent(const dom::PBrowserOrId& iframeEmbedding,
                     nsILoadContext* aLoadContext, PBOverrideStatus aStatus);
 
   MOZ_MUST_USE bool Init(const HttpChannelCreationArgs& aOpenArgs);
 
@@ -127,16 +124,23 @@ class HttpChannelParent final : public n
 
   // Callback while background channel is ready.
   void OnBackgroundParentReady(HttpBackgroundChannelParent* aBgParent);
   // Callback while background channel is destroyed.
   void OnBackgroundParentDestroyed();
 
   base::ProcessId OtherPid() const;
 
+  // Called by nsHttpChannel when a process switch is about to start.
+  // aChannel: nsIHttpChannel caller.
+  // aIdentifier: identifier from SessionStore to be passed to the childChannel
+  //              in order to identify it.
+  nsresult TriggerCrossProcessSwitch(nsIHttpChannel* aChannel,
+                                     uint64_t aIdentifier);
+
   // Calling this method will cancel the HttpChannelChild because the consumer
   // needs to be relocated to another process.
   // Any OnStart/Stop/DataAvailable calls that follow will not be sent to the
   // child channel.
   void CancelChildCrossProcessRedirect();
 
  protected:
   // used to connect redirected-to channel in parent with just created
--- a/netwerk/protocol/http/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/nsHttpChannel.cpp
@@ -7293,18 +7293,17 @@ nsresult nsHttpChannel::StartCrossProces
 
   LOG(("nsHttpChannel::StartCrossProcessRedirect [this=%p]", this));
 
   rv = CheckRedirectLimit(nsIChannelEventSink::REDIRECT_INTERNAL);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<nsIParentChannel> parentChannel;
   NS_QueryNotificationCallbacks(this, parentChannel);
-  nsCOMPtr<nsICrossProcessSwitchChannel> httpParent =
-      do_QueryInterface(parentChannel);
+  RefPtr<HttpChannelParent> httpParent = do_QueryObject(parentChannel);
   MOZ_ASSERT(httpParent);
   NS_ENSURE_TRUE(httpParent, NS_ERROR_UNEXPECTED);
 
   httpParent->TriggerCrossProcessSwitch(this, mCrossProcessRedirectIdentifier);
 
   // This will suspend the channel
   rv = WaitForRedirectCallback();
 
--- a/netwerk/protocol/http/nsHttpChannel.h
+++ b/netwerk/protocol/http/nsHttpChannel.h
@@ -28,18 +28,18 @@
 #include "AutoClose.h"
 #include "nsIStreamListener.h"
 #include "nsISupportsPrimitives.h"
 #include "nsICorsPreflightCallback.h"
 #include "AlternateServices.h"
 #include "nsIRaceCacheWithNetwork.h"
 #include "mozilla/extensions/PStreamFilterParent.h"
 #include "mozilla/Mutex.h"
+#include "nsIProcessSwitchRequestor.h"
 #include "nsIRemoteTab.h"
-#include "nsICrossProcessSwitchChannel.h"
 
 class nsDNSPrefetch;
 class nsICancelable;
 class nsIHttpChannelAuthProvider;
 class nsInputStreamPump;
 class nsITransportSecurityInfo;
 
 namespace mozilla {
--- a/netwerk/protocol/http/nsHttpHandler.cpp
+++ b/netwerk/protocol/http/nsHttpHandler.cpp
@@ -10,25 +10,25 @@
 #include "prsystem.h"
 
 #include "nsError.h"
 #include "nsHttp.h"
 #include "nsHttpHandler.h"
 #include "nsHttpChannel.h"
 #include "nsHttpAuthCache.h"
 #include "nsStandardURL.h"
-#include "nsICrossProcessSwitchChannel.h"
 #include "nsIDOMWindow.h"
 #include "nsIHttpChannel.h"
 #include "nsIStandardURL.h"
 #include "LoadContextInfo.h"
 #include "nsCategoryManagerUtils.h"
 #include "nsIPrefService.h"
 #include "nsIPrefBranch.h"
 #include "nsIPrefLocalizedString.h"
+#include "nsIProcessSwitchRequestor.h"
 #include "nsSocketProviderService.h"
 #include "nsISocketProvider.h"
 #include "nsPrintfCString.h"
 #include "nsCOMPtr.h"
 #include "nsNetCID.h"
 #include "mozilla/ClearOnShutdown.h"
 #include "mozilla/Printf.h"
 #include "mozilla/Sprintf.h"