Bug 1599968 - Remove nsIChildProcessChannelListerner interface. r=farre

There's just no use for it, it was an unnecessary virtual interface, with a single concreate class and only ever used in C++.

Differential Revision: https://phabricator.services.mozilla.com/D55069

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jean-Yves Avenard 2019-11-29 15:14:07 +00:00
Родитель 28618c9230
Коммит 72d4a6a2a4
6 изменённых файлов: 17 добавлений и 73 удалений

Просмотреть файл

@ -30,10 +30,6 @@ void ChildProcessChannelListener::OnChannelReady(
}
}
ChildProcessChannelListener::ChildProcessChannelListener() = default;
ChildProcessChannelListener::~ChildProcessChannelListener() = default;
already_AddRefed<ChildProcessChannelListener>
ChildProcessChannelListener::GetSingleton() {
if (!sCPCLSingleton) {
@ -44,7 +40,5 @@ ChildProcessChannelListener::GetSingleton() {
return cpcl.forget();
}
NS_IMPL_ISUPPORTS(ChildProcessChannelListener, nsIChildProcessChannelListener);
} // namespace dom
} // namespace mozilla

Просмотреть файл

@ -8,36 +8,34 @@
#define mozilla_dom_ChildProcessChannelListener_h
#include <functional>
#include "nsCOMPtr.h"
#include "mozilla/net/NeckoChannelParams.h"
#include "nsDataHashtable.h"
#include "nsIChildProcessChannelListener.h"
#include "nsIChildChannel.h"
#include "mozilla/Variant.h"
namespace mozilla {
namespace dom {
class ChildProcessChannelListener final
: public nsIChildProcessChannelListener {
public:
class ChildProcessChannelListener final {
NS_INLINE_DECL_REFCOUNTING(ChildProcessChannelListener)
using Callback = std::function<void(
nsIChildChannel*, nsTArray<net::DocumentChannelRedirect>&&)>;
struct CallbackArgs {
nsCOMPtr<nsIChildChannel> mChannel;
nsTArray<net::DocumentChannelRedirect> mRedirects;
};
ChildProcessChannelListener();
NS_DECL_ISUPPORTS
NS_DECL_NSICHILDPROCESSCHANNELLISTENER
void RegisterCallback(uint64_t aIdentifier, Callback&& aCallback);
void OnChannelReady(nsIChildChannel* aChannel, uint64_t aIdentifier,
nsTArray<net::DocumentChannelRedirect>&& aRedirects);
static already_AddRefed<ChildProcessChannelListener> GetSingleton();
private:
virtual ~ChildProcessChannelListener();
ChildProcessChannelListener() = default;
~ChildProcessChannelListener() = default;
struct CallbackArgs {
nsCOMPtr<nsIChildChannel> mChannel;
nsTArray<net::DocumentChannelRedirect> mRedirects;
};
// TODO Backtrack.
nsDataHashtable<nsUint64HashKey, Callback> mCallbacks;

Просмотреть файл

@ -71,15 +71,6 @@ Classes = [
'init_method': 'Init',
'processes': ProcessSelector.ALLOW_IN_SOCKET_PROCESS,
},
{
'cid': '{397b43f3-1470-4542-8a40-c718f7753563}',
'contract_ids': ['@mozilla.org/network/childProcessChannelListener;1'],
'singleton': True,
'type': 'mozilla::dom::ChildProcessChannelListener',
'constructor': 'mozilla::dom::ChildProcessChannelListener::GetSingleton',
'headers': ['mozilla/dom/ChildProcessChannelListener.h'],
'processes': ProcessSelector.CONTENT_PROCESS_ONLY,
},
{
'cid': '{56ebedd4-6ccf-48e8-bdae-adc77f044567}',
'contract_ids': [

Просмотреть файл

@ -37,6 +37,7 @@
#include "mozilla/dom/BrowserBridgeHost.h"
#include "mozilla/dom/ClientManager.h"
#include "mozilla/dom/ClientOpenWindowOpActors.h"
#include "mozilla/dom/ChildProcessChannelListener.h"
#include "mozilla/dom/ChildProcessMessageManager.h"
#include "mozilla/dom/ContentProcessMessageManager.h"
#include "mozilla/dom/ContentParent.h"
@ -102,7 +103,6 @@
#include "mozilla/HangDetails.h"
#include "mozilla/LoadInfo.h"
#include "mozilla/UnderrunHandler.h"
#include "nsIChildProcessChannelListener.h"
#include "mozilla/net/HttpChannelChild.h"
#include "nsQueryObject.h"
#include "imgLoader.h"
@ -3740,8 +3740,8 @@ mozilla::ipc::IPCResult ContentChild::RecvCrossProcessRedirect(
nsHashPropertyBag::CopyFrom(bag, aArgs.properties());
}
nsCOMPtr<nsIChildProcessChannelListener> processListener =
do_GetService("@mozilla.org/network/childProcessChannelListener;1");
RefPtr<ChildProcessChannelListener> processListener =
ChildProcessChannelListener::GetSingleton();
// The listener will call completeRedirectSetup on the channel.
processListener->OnChannelReady(childChannel, aArgs.redirectIdentifier(),
std::move(aArgs.redirects()));

Просмотреть файл

@ -9,7 +9,6 @@ with Files('**'):
XPIDL_SOURCES += [
'nsIBackgroundChannelRegistrar.idl',
'nsIChildProcessChannelListener.idl',
'nsIHttpActivityObserver.idl',
'nsIHttpAuthenticableChannel.idl',
'nsIHttpAuthenticator.idl',

Просмотреть файл

@ -1,38 +0,0 @@
/* 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"
interface nsIChildChannel;
%{ C++
#include "mozilla/net/NeckoChannelParams.h"
#include "nsTArray.h"
%}
native DocumentChannelRedirectArrayMove(nsTArray<mozilla::net::DocumentChannelRedirect>&&);
[scriptable, builtinclass, uuid(50af805f-e4db-40d9-9dd8-1ae9ab12bdc2)]
interface nsIChildProcessChannelListener : nsISupports
{
/**
* @param aChildChannel - new child channel
* @param aIdentifier - returned by call to getChannelRedirectTarget. Used to
* identify the new channel.
* @param aRedirects - DocumentChannel only reports a single redirect via the
* normal confirmation mechanism (when they replace
* themselves with a real channel), but can have had an
* arbitrary number of redirects handled in the parent
* process. aRedirects contains the list of all redirects
* encountered.
*
* This method has to call aChildChannel->completeRedirectSetup(listener, context)
* in order to be ready for content; listener is a class that implements
* nsIStreamListener.
*/
[noscript, nostdcall, notxpcom]
void OnChannelReady(
in nsIChildChannel aChildChannel, in unsigned long long aIdentifier,
in DocumentChannelRedirectArrayMove aRedirects);
};