Bug 1607984 - P9. Implement nsIThreadRetargetableStreamListener in ParentChannelListerner. r=valentin

The DocumentLoadListener is setting up a ParentChannelListener to go in between the normal listener->channel chain.
ParentChannelListener not implementing nsIThreadRetargetableStreamListener would prevent a nsHtml5StreamParser settings things up so that OnDataAvailable could be sent to a html parser thread off the main thread; improving performance.

Differential Revision: https://phabricator.services.mozilla.com/D70006
This commit is contained in:
Jean-Yves Avenard 2020-04-23 03:17:25 +00:00
Родитель 6f52ea6084
Коммит b9eb27d09b
2 изменённых файлов: 24 добавлений и 4 удалений

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

@ -70,6 +70,7 @@ NS_INTERFACE_MAP_BEGIN(ParentChannelListener)
NS_INTERFACE_MAP_ENTRY(nsIRequestObserver)
NS_INTERFACE_MAP_ENTRY(nsIMultiPartChannelListener)
NS_INTERFACE_MAP_ENTRY(nsINetworkInterceptController)
NS_INTERFACE_MAP_ENTRY(nsIThreadRetargetableStreamListener)
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIAuthPromptProvider, mBrowsingContext)
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIRemoteWindowContext, mBrowsingContext)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIInterfaceRequestor)
@ -446,5 +447,22 @@ ParentChannelListener::GetUsePrivateBrowsing(bool* aUsePrivateBrowsing) {
return NS_OK;
}
//-----------------------------------------------------------------------------
// ParentChannelListener::nsIThreadRetargetableStreamListener
//
NS_IMETHODIMP
ParentChannelListener::CheckListenerChain() {
MOZ_ASSERT(NS_IsMainThread());
nsCOMPtr<nsIThreadRetargetableStreamListener> listener =
do_QueryInterface(mNextListener);
if (!listener) {
return NS_ERROR_NO_INTERFACE;
}
return listener->CheckListenerChain();
}
} // namespace net
} // namespace mozilla

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

@ -8,14 +8,14 @@
#ifndef mozilla_net_ParentChannelListener_h
#define mozilla_net_ParentChannelListener_h
#include "mozilla/dom/CanonicalBrowsingContext.h"
#include "nsIAuthPromptProvider.h"
#include "nsIInterfaceRequestor.h"
#include "nsINetworkInterceptController.h"
#include "nsIStreamListener.h"
#include "nsIMultiPartChannel.h"
#include "nsINetworkInterceptController.h"
#include "nsIRemoteWindowContext.h"
#include "mozilla/dom/CanonicalBrowsingContext.h"
#include "mozilla/dom/CanonicalBrowsingContext.h"
#include "nsIStreamListener.h"
#include "nsIThreadRetargetableStreamListener.h"
namespace mozilla {
namespace net {
@ -35,6 +35,7 @@ class ParentChannelListener final : public nsIInterfaceRequestor,
public nsIStreamListener,
public nsIMultiPartChannelListener,
public nsINetworkInterceptController,
public nsIThreadRetargetableStreamListener,
private nsIAuthPromptProvider,
private nsIRemoteWindowContext {
public:
@ -46,6 +47,7 @@ class ParentChannelListener final : public nsIInterfaceRequestor,
NS_DECL_NSINETWORKINTERCEPTCONTROLLER
NS_DECL_NSIAUTHPROMPTPROVIDER
NS_DECL_NSIREMOTEWINDOWCONTEXT
NS_DECL_NSITHREADRETARGETABLESTREAMLISTENER
NS_DECLARE_STATIC_IID_ACCESSOR(PARENT_CHANNEL_LISTENER)