mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset e713ce8013eb (bug 1127618) for suspicion of causing semi-frequent B2G crashes.
CLOSED TREE
This commit is contained in:
parent
70d3f9a09a
commit
74ece90249
@ -1,193 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 ;*; */
|
||||
/* vim: set sw=2 ts=8 et tw=80 : */
|
||||
/* 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 "nsAutoPtr.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsIUUIDGenerator.h"
|
||||
#include "SchedulingContextService.h"
|
||||
|
||||
#include "mozilla/Atomics.h"
|
||||
#include "mozilla/Services.h"
|
||||
|
||||
#include "mozilla/net/PSpdyPush.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
|
||||
// nsISchedulingContext
|
||||
class SchedulingContext final : public nsISchedulingContext
|
||||
, public nsSupportsWeakReference
|
||||
{
|
||||
public:
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
NS_DECL_NSISCHEDULINGCONTEXT
|
||||
|
||||
explicit SchedulingContext(const nsID& id);
|
||||
private:
|
||||
virtual ~SchedulingContext() {}
|
||||
|
||||
nsID mID;
|
||||
Atomic<uint32_t> mBlockingTransactionCount;
|
||||
nsAutoPtr<SpdyPushCache> mSpdyCache;
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS(SchedulingContext, nsISchedulingContext, nsISupportsWeakReference)
|
||||
|
||||
SchedulingContext::SchedulingContext(const nsID& aID)
|
||||
: mBlockingTransactionCount(0)
|
||||
{
|
||||
mID = aID;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
SchedulingContext::GetBlockingTransactionCount(uint32_t *aBlockingTransactionCount)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aBlockingTransactionCount);
|
||||
*aBlockingTransactionCount = mBlockingTransactionCount;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
SchedulingContext::AddBlockingTransaction()
|
||||
{
|
||||
mBlockingTransactionCount++;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
SchedulingContext::RemoveBlockingTransaction(uint32_t *outval)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(outval);
|
||||
mBlockingTransactionCount--;
|
||||
*outval = mBlockingTransactionCount;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* [noscript] attribute SpdyPushCachePtr spdyPushCache; */
|
||||
NS_IMETHODIMP
|
||||
SchedulingContext::GetSpdyPushCache(mozilla::net::SpdyPushCache **aSpdyPushCache)
|
||||
{
|
||||
*aSpdyPushCache = mSpdyCache.get();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
SchedulingContext::SetSpdyPushCache(mozilla::net::SpdyPushCache *aSpdyPushCache)
|
||||
{
|
||||
mSpdyCache = aSpdyPushCache;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* [noscript] readonly attribute nsID ID; */
|
||||
NS_IMETHODIMP
|
||||
SchedulingContext::GetID(nsID *outval)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(outval);
|
||||
*outval = mID;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//nsISchedulingContextService
|
||||
SchedulingContextService *SchedulingContextService::sSelf = nullptr;
|
||||
|
||||
NS_IMPL_ISUPPORTS(SchedulingContextService, nsISchedulingContextService, nsIObserver)
|
||||
|
||||
SchedulingContextService::SchedulingContextService()
|
||||
{
|
||||
MOZ_ASSERT(!sSelf, "multiple scs instances!");
|
||||
sSelf = this;
|
||||
}
|
||||
|
||||
SchedulingContextService::~SchedulingContextService()
|
||||
{
|
||||
Shutdown();
|
||||
sSelf = nullptr;
|
||||
}
|
||||
|
||||
nsresult
|
||||
SchedulingContextService::Init()
|
||||
{
|
||||
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
|
||||
if (!obs) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
return obs->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false);
|
||||
}
|
||||
|
||||
void
|
||||
SchedulingContextService::Shutdown()
|
||||
{
|
||||
mTable.Clear();
|
||||
}
|
||||
|
||||
/* static */ nsresult
|
||||
SchedulingContextService::Create(nsISupports *aOuter, const nsIID& aIID, void **aResult)
|
||||
{
|
||||
if (aOuter != nullptr) {
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
}
|
||||
|
||||
nsRefPtr<SchedulingContextService> svc = new SchedulingContextService();
|
||||
nsresult rv = svc->Init();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return svc->QueryInterface(aIID, aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
SchedulingContextService::GetSchedulingContext(const nsID& scID, nsISchedulingContext **sc)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(sc);
|
||||
*sc = nullptr;
|
||||
|
||||
nsWeakPtr weakSC;
|
||||
nsCOMPtr<nsISchedulingContext> strongSC;
|
||||
if (mTable.Get(scID, getter_AddRefs(weakSC))) {
|
||||
strongSC = do_QueryReferent(weakSC);
|
||||
}
|
||||
|
||||
if (!strongSC) {
|
||||
// Either this wasn't in the table to begin with, or the weak reference has
|
||||
// expired. Let's make a new one.
|
||||
strongSC = new SchedulingContext(scID);
|
||||
weakSC = do_GetWeakReference(strongSC);
|
||||
if (!weakSC) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
mTable.Put(scID, weakSC);
|
||||
}
|
||||
|
||||
strongSC.swap(*sc);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
SchedulingContextService::NewSchedulingContextID(nsID *scID)
|
||||
{
|
||||
if (!mUUIDGen) {
|
||||
nsresult rv;
|
||||
mUUIDGen = do_GetService("@mozilla.org/uuid-generator;1", &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
return mUUIDGen->GenerateUUIDInPlace(scID);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
SchedulingContextService::Observe(nsISupports *subject, const char *topic,
|
||||
const char16_t *data_unicode)
|
||||
{
|
||||
if (!strcmp(NS_XPCOM_SHUTDOWN_OBSERVER_ID, topic)) {
|
||||
Shutdown();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
} // ::mozilla::net
|
||||
} // ::mozilla
|
@ -1,47 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 ;*; */
|
||||
/* vim: set sw=2 ts=8 et tw=80 : */
|
||||
/* 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/. */
|
||||
|
||||
#ifndef mozilla__net__SchedulingContextService_h
|
||||
#define mozilla__net__SchedulingContextService_h
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsInterfaceHashtable.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsISchedulingContext.h"
|
||||
#include "nsWeakReference.h"
|
||||
|
||||
class nsIUUIDGenerator;
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
|
||||
class SchedulingContextService final : public nsISchedulingContextService
|
||||
, public nsIObserver
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSISCHEDULINGCONTEXTSERVICE
|
||||
NS_DECL_NSIOBSERVER
|
||||
|
||||
SchedulingContextService();
|
||||
|
||||
nsresult Init();
|
||||
void Shutdown();
|
||||
static nsresult Create(nsISupports *outer, const nsIID& iid, void **result);
|
||||
|
||||
private:
|
||||
virtual ~SchedulingContextService();
|
||||
|
||||
static SchedulingContextService *sSelf;
|
||||
|
||||
nsInterfaceHashtable<nsIDHashKey, nsIWeakReference> mTable;
|
||||
nsCOMPtr<nsIUUIDGenerator> mUUIDGen;
|
||||
};
|
||||
|
||||
} // ::mozilla::net
|
||||
} // ::mozilla
|
||||
|
||||
#endif // mozilla__net__SchedulingContextService_h
|
@ -91,7 +91,6 @@ XPIDL_SOURCES += [
|
||||
'nsIRequestObserverProxy.idl',
|
||||
'nsIResponseHeadProvider.idl',
|
||||
'nsIResumableChannel.idl',
|
||||
'nsISchedulingContext.idl',
|
||||
'nsISecretDecoderRing.idl',
|
||||
'nsISecureBrowserUI.idl',
|
||||
'nsISecurityEventSink.idl',
|
||||
@ -238,7 +237,6 @@ UNIFIED_SOURCES += [
|
||||
'Predictor.cpp',
|
||||
'ProxyAutoConfig.cpp',
|
||||
'RedirectChannelRegistrar.cpp',
|
||||
'SchedulingContextService.cpp',
|
||||
'StreamingProtocolService.cpp',
|
||||
'Tickler.cpp',
|
||||
'TLSServerSocket.cpp',
|
||||
|
@ -8,14 +8,14 @@
|
||||
interface nsISimpleEnumerator;
|
||||
interface nsIRequestObserver;
|
||||
interface nsIInterfaceRequestor;
|
||||
interface nsISchedulingContext;
|
||||
interface nsILoadGroupConnectionInfo;
|
||||
|
||||
typedef unsigned long nsLoadFlags;
|
||||
|
||||
/**
|
||||
* A load group maintains a collection of nsIRequest objects.
|
||||
*/
|
||||
[scriptable, uuid(ff6a41f9-0bbf-44ca-9c71-f76c1da2b114)]
|
||||
[scriptable, uuid(afb57ac2-bce5-4ee3-bb34-385089a9ba5c)]
|
||||
interface nsILoadGroup : nsIRequest
|
||||
{
|
||||
/**
|
||||
@ -76,10 +76,10 @@ interface nsILoadGroup : nsIRequest
|
||||
attribute nsIInterfaceRequestor notificationCallbacks;
|
||||
|
||||
/**
|
||||
* Context for managing things like js/css connection blocking,
|
||||
* and per-tab connection grouping.
|
||||
* Connection information for managing things like js/css
|
||||
* connection blocking, and per-tab connection grouping
|
||||
*/
|
||||
readonly attribute nsID schedulingContextID;
|
||||
readonly attribute nsILoadGroupConnectionInfo connectionInfo;
|
||||
|
||||
/**
|
||||
* The set of load flags that will be added to all new requests added to
|
||||
@ -94,3 +94,48 @@ interface nsILoadGroup : nsIRequest
|
||||
*/
|
||||
attribute nsLoadFlags defaultLoadFlags;
|
||||
};
|
||||
|
||||
%{C++
|
||||
// Forward-declare mozilla::net::SpdyPushCache
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
class SpdyPushCache;
|
||||
}
|
||||
}
|
||||
%}
|
||||
|
||||
[ptr] native SpdyPushCachePtr(mozilla::net::SpdyPushCache);
|
||||
|
||||
/**
|
||||
* Used to maintain state about the connections of a load group and
|
||||
* how they interact with blocking items like HEAD css/js loads.
|
||||
*/
|
||||
|
||||
[uuid(fdc9659c-b597-4ac0-9c9e-14b04dbb682f)]
|
||||
interface nsILoadGroupConnectionInfo : nsISupports
|
||||
{
|
||||
/**
|
||||
* Number of active blocking transactions associated with this load group
|
||||
*/
|
||||
readonly attribute unsigned long blockingTransactionCount;
|
||||
|
||||
/**
|
||||
* Increase the number of active blocking transactions associated
|
||||
* with this load group by one.
|
||||
*/
|
||||
void addBlockingTransaction();
|
||||
|
||||
/**
|
||||
* Decrease the number of active blocking transactions associated
|
||||
* with this load group by one. The return value is the number of remaining
|
||||
* blockers.
|
||||
*/
|
||||
unsigned long removeBlockingTransaction();
|
||||
|
||||
/* reading this attribute gives out weak pointers to the push
|
||||
* cache. The nsILoadGroupConnectionInfo implemenation owns the cache
|
||||
* and will destroy it when overwritten or when the load group
|
||||
* ends.
|
||||
*/
|
||||
[noscript] attribute SpdyPushCachePtr spdyPushCache;
|
||||
};
|
||||
|
@ -1,85 +0,0 @@
|
||||
/* -*- Mode: C++; 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"
|
||||
|
||||
%{C++
|
||||
// Forward-declare mozilla::net::SpdyPushCache
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
class SpdyPushCache;
|
||||
}
|
||||
}
|
||||
%}
|
||||
|
||||
[ptr] native SpdyPushCachePtr(mozilla::net::SpdyPushCache);
|
||||
|
||||
/**
|
||||
* The nsISchedulingContext is used to maintain state about connections
|
||||
* that are in some way associated with each other (often by being part
|
||||
* of the same load group) and how they interact with blocking items like
|
||||
* HEAD css/js loads.
|
||||
*
|
||||
* This used to be known as nsILoadGroupConnectionInfo.
|
||||
*/
|
||||
[scriptable, uuid(658e3e6e-8633-4b1a-8d66-fa9f72293e63)]
|
||||
interface nsISchedulingContext : nsISupports
|
||||
{
|
||||
/**
|
||||
* A unique identifier for this scheduling context
|
||||
*/
|
||||
[noscript] readonly attribute nsID ID;
|
||||
|
||||
/**
|
||||
* Number of active blocking transactions associated with this context
|
||||
*/
|
||||
readonly attribute unsigned long blockingTransactionCount;
|
||||
|
||||
/**
|
||||
* Increase the number of active blocking transactions associated
|
||||
* with this context by one.
|
||||
*/
|
||||
void addBlockingTransaction();
|
||||
|
||||
/**
|
||||
* Decrease the number of active blocking transactions associated
|
||||
* with this context by one. The return value is the number of remaining
|
||||
* blockers.
|
||||
*/
|
||||
unsigned long removeBlockingTransaction();
|
||||
|
||||
/**
|
||||
* This gives out a weak pointer to the push cache.
|
||||
* The nsISchedulingContext implementation owns the cache
|
||||
* and will destroy it when overwritten or when the context
|
||||
* ends.
|
||||
*/
|
||||
[noscript] attribute SpdyPushCachePtr spdyPushCache;
|
||||
};
|
||||
|
||||
/**
|
||||
* The nsISchedulingContextService is how anyone gets access to a scheduling
|
||||
* context when they haven't been explicitly given a strong reference to an
|
||||
* existing one. It is responsible for creating and handing out strong
|
||||
* references to nsISchedulingContexts, but only keeps weak references itself.
|
||||
* The shared scheduling context will go away once no one else is keeping a
|
||||
* reference to it. If you ask for a scheduling context that has no one else
|
||||
* holding a reference to it, you'll get a brand new scheduling context. Anyone
|
||||
* who asks for the same scheduling context while you're holding a reference
|
||||
* will get a reference to the same scheduling context you have.
|
||||
*/
|
||||
[uuid(7fcbf4da-d828-4acc-b144-e5435198f727)]
|
||||
interface nsISchedulingContextService : nsISupports
|
||||
{
|
||||
/**
|
||||
* Get an existing scheduling context from its ID
|
||||
*/
|
||||
nsISchedulingContext getSchedulingContext(in nsIDRef id);
|
||||
|
||||
/**
|
||||
* Create a new scheduling context identifier
|
||||
*/
|
||||
nsID newSchedulingContextID();
|
||||
};
|
@ -14,11 +14,13 @@
|
||||
#include "prlog.h"
|
||||
#include "nsString.h"
|
||||
#include "nsTArray.h"
|
||||
#include "mozilla/Atomics.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "mozilla/net/PSpdyPush.h"
|
||||
#include "nsITimedChannel.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
#include "nsIRequestObserver.h"
|
||||
#include "nsISchedulingContext.h"
|
||||
#include "CacheObserver.h"
|
||||
#include "MainThreadUtils.h"
|
||||
|
||||
@ -739,12 +741,12 @@ nsLoadGroup::SetNotificationCallbacks(nsIInterfaceRequestor *aCallbacks)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoadGroup::GetSchedulingContextID(nsID *aSCID)
|
||||
nsLoadGroup::GetConnectionInfo(nsILoadGroupConnectionInfo **aCI)
|
||||
{
|
||||
if (!mSchedulingContext) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
return mSchedulingContext->GetID(aSCID);
|
||||
NS_ENSURE_ARG_POINTER(aCI);
|
||||
*aCI = mConnectionInfo;
|
||||
NS_IF_ADDREF(*aCI);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -1066,6 +1068,68 @@ nsresult nsLoadGroup::MergeLoadFlags(nsIRequest *aRequest, nsLoadFlags& outFlags
|
||||
return rv;
|
||||
}
|
||||
|
||||
// nsLoadGroupConnectionInfo
|
||||
|
||||
class nsLoadGroupConnectionInfo final : public nsILoadGroupConnectionInfo
|
||||
{
|
||||
~nsLoadGroupConnectionInfo() {}
|
||||
|
||||
public:
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
NS_DECL_NSILOADGROUPCONNECTIONINFO
|
||||
|
||||
nsLoadGroupConnectionInfo();
|
||||
private:
|
||||
Atomic<uint32_t> mBlockingTransactionCount;
|
||||
nsAutoPtr<mozilla::net::SpdyPushCache> mSpdyCache;
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsLoadGroupConnectionInfo, nsILoadGroupConnectionInfo)
|
||||
|
||||
nsLoadGroupConnectionInfo::nsLoadGroupConnectionInfo()
|
||||
: mBlockingTransactionCount(0)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoadGroupConnectionInfo::GetBlockingTransactionCount(uint32_t *aBlockingTransactionCount)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aBlockingTransactionCount);
|
||||
*aBlockingTransactionCount = mBlockingTransactionCount;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoadGroupConnectionInfo::AddBlockingTransaction()
|
||||
{
|
||||
mBlockingTransactionCount++;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoadGroupConnectionInfo::RemoveBlockingTransaction(uint32_t *_retval)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
mBlockingTransactionCount--;
|
||||
*_retval = mBlockingTransactionCount;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* [noscript] attribute SpdyPushCachePtr spdyPushCache; */
|
||||
NS_IMETHODIMP
|
||||
nsLoadGroupConnectionInfo::GetSpdyPushCache(mozilla::net::SpdyPushCache **aSpdyPushCache)
|
||||
{
|
||||
*aSpdyPushCache = mSpdyCache.get();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoadGroupConnectionInfo::SetSpdyPushCache(mozilla::net::SpdyPushCache *aSpdyPushCache)
|
||||
{
|
||||
mSpdyCache = aSpdyPushCache;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsLoadGroup::Init()
|
||||
{
|
||||
static const PLDHashTableOps hash_table_ops =
|
||||
@ -1080,14 +1144,7 @@ nsresult nsLoadGroup::Init()
|
||||
PL_DHashTableInit(&mRequests, &hash_table_ops,
|
||||
sizeof(RequestMapEntry));
|
||||
|
||||
nsCOMPtr<nsISchedulingContextService> scsvc = do_GetService("@mozilla.org/network/scheduling-context-service;1");
|
||||
if (scsvc) {
|
||||
nsID schedulingContextID;
|
||||
if (NS_SUCCEEDED(scsvc->NewSchedulingContextID(&schedulingContextID))) {
|
||||
scsvc->GetSchedulingContext(schedulingContextID,
|
||||
getter_AddRefs(mSchedulingContext));
|
||||
}
|
||||
}
|
||||
mConnectionInfo = new nsLoadGroupConnectionInfo();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include "pldhash.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
|
||||
class nsISchedulingContext;
|
||||
class nsILoadGroupConnectionInfo;
|
||||
class nsITimedChannel;
|
||||
|
||||
class nsLoadGroup : public nsILoadGroup,
|
||||
@ -70,7 +70,7 @@ protected:
|
||||
|
||||
nsCOMPtr<nsILoadGroup> mLoadGroup; // load groups can contain load groups
|
||||
nsCOMPtr<nsIInterfaceRequestor> mCallbacks;
|
||||
nsCOMPtr<nsISchedulingContext> mSchedulingContext;
|
||||
nsCOMPtr<nsILoadGroupConnectionInfo> mConnectionInfo;
|
||||
|
||||
nsCOMPtr<nsIRequest> mDefaultLoadRequest;
|
||||
PLDHashTable mRequests;
|
||||
|
@ -468,17 +468,6 @@
|
||||
{ 0xae, 0xcf, 0x05, 0xf8, 0xfa, 0xf0, 0x0c, 0x9b } \
|
||||
}
|
||||
|
||||
// service implementing nsISchedulingContextService
|
||||
#define NS_SCHEDULINGCONTEXTSERVICE_CONTRACTID \
|
||||
"@mozilla.org/network/scheduling-context-service;1"
|
||||
#define NS_SCHEDULINGCONTEXTSERVICE_CID \
|
||||
{ /* d5499fa7-7ba8-49ff-9e30-1858b99ace69 */ \
|
||||
0xd5499fa7, \
|
||||
0x7ba8, \
|
||||
0x49ff, \
|
||||
{0x93, 0x30, 0x18, 0x58, 0xb9, 0x9a, 0xce, 0x69} \
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* netwerk/cache/ classes
|
||||
*/
|
||||
|
@ -132,10 +132,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(RedirectChannelRegistrar)
|
||||
typedef mozilla::net::CacheStorageService CacheStorageService;
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(CacheStorageService)
|
||||
|
||||
#include "SchedulingContextService.h"
|
||||
typedef mozilla::net::SchedulingContextService SchedulingContextService;
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(SchedulingContextService, Init)
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
extern nsresult
|
||||
@ -805,7 +801,6 @@ NS_DEFINE_NAMED_CID(NS_SERIALIZATION_HELPER_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_REDIRECTCHANNELREGISTRAR_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_CACHE_STORAGE_SERVICE_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_NETWORKPREDICTOR_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_SCHEDULINGCONTEXTSERVICE_CID);
|
||||
|
||||
static const mozilla::Module::CIDEntry kNeckoCIDs[] = {
|
||||
{ &kNS_IOSERVICE_CID, false, nullptr, nsIOServiceConstructor },
|
||||
@ -952,7 +947,6 @@ static const mozilla::Module::CIDEntry kNeckoCIDs[] = {
|
||||
{ &kNS_REDIRECTCHANNELREGISTRAR_CID, false, nullptr, RedirectChannelRegistrarConstructor },
|
||||
{ &kNS_CACHE_STORAGE_SERVICE_CID, false, nullptr, CacheStorageServiceConstructor },
|
||||
{ &kNS_NETWORKPREDICTOR_CID, false, nullptr, mozilla::net::Predictor::Create },
|
||||
{ &kNS_SCHEDULINGCONTEXTSERVICE_CID, false, nullptr, SchedulingContextServiceConstructor },
|
||||
{ nullptr }
|
||||
};
|
||||
|
||||
@ -1103,7 +1097,6 @@ static const mozilla::Module::ContractIDEntry kNeckoContracts[] = {
|
||||
{ NS_CACHE_STORAGE_SERVICE_CONTRACTID, &kNS_CACHE_STORAGE_SERVICE_CID },
|
||||
{ NS_CACHE_STORAGE_SERVICE_CONTRACTID2, &kNS_CACHE_STORAGE_SERVICE_CID },
|
||||
{ NS_NETWORKPREDICTOR_CONTRACTID, &kNS_NETWORKPREDICTOR_CID },
|
||||
{ NS_SCHEDULINGCONTEXTSERVICE_CONTRACTID, &kNS_SCHEDULINGCONTEXTSERVICE_CID },
|
||||
{ nullptr }
|
||||
};
|
||||
|
||||
|
@ -58,7 +58,6 @@ struct HttpChannelOpenArgs
|
||||
uint32_t securityFlags;
|
||||
uint32_t contentPolicyType;
|
||||
uint32_t innerWindowID;
|
||||
nsCString schedulingContextID;
|
||||
};
|
||||
|
||||
struct HttpChannelConnectArgs
|
||||
|
@ -77,7 +77,7 @@ Http2PushedStream::Http2PushedStream(Http2PushTransactionBuffer *aTransaction,
|
||||
mStreamID = aID;
|
||||
MOZ_ASSERT(!(aID & 1)); // must be even to be a pushed stream
|
||||
mBufferedPush->SetPushStream(this);
|
||||
mSchedulingContext = aAssociatedStream->SchedulingContext();
|
||||
mLoadGroupCI = aAssociatedStream->LoadGroupConnectionInfo();
|
||||
mLastRead = TimeStamp::Now();
|
||||
SetPriority(aAssociatedStream->Priority() + 1);
|
||||
}
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "nsHttpRequestHead.h"
|
||||
#include "nsILoadGroup.h"
|
||||
#include "nsISchedulingContext.h"
|
||||
#include "nsString.h"
|
||||
#include "PSpdyPush.h"
|
||||
|
||||
@ -43,7 +42,7 @@ public:
|
||||
nsresult ReadSegments(nsAHttpSegmentReader *, uint32_t, uint32_t *) override;
|
||||
nsresult WriteSegments(nsAHttpSegmentWriter *, uint32_t, uint32_t *) override;
|
||||
|
||||
nsISchedulingContext *SchedulingContext() override { return mSchedulingContext; };
|
||||
nsILoadGroupConnectionInfo *LoadGroupConnectionInfo() override { return mLoadGroupCI; };
|
||||
void ConnectPushedStream(Http2Stream *consumer);
|
||||
|
||||
bool TryOnPush();
|
||||
@ -66,7 +65,7 @@ private:
|
||||
Http2Stream *mConsumerStream; // paired request stream that consumes from
|
||||
// real http/2 one.. null until a match is made.
|
||||
|
||||
nsCOMPtr<nsISchedulingContext> mSchedulingContext;
|
||||
nsCOMPtr<nsILoadGroupConnectionInfo> mLoadGroupCI;
|
||||
|
||||
nsAHttpTransaction *mAssociatedTransaction;
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include "nsHttp.h"
|
||||
#include "nsHttpHandler.h"
|
||||
#include "nsHttpConnection.h"
|
||||
#include "nsISchedulingContext.h"
|
||||
#include "nsILoadGroup.h"
|
||||
#include "nsISSLSocketControl.h"
|
||||
#include "nsISSLStatus.h"
|
||||
#include "nsISSLStatusProvider.h"
|
||||
@ -1077,10 +1077,10 @@ Http2Session::CleanupStream(Http2Stream *aStream, nsresult aResult,
|
||||
Http2PushedStream *pushStream = static_cast<Http2PushedStream *>(aStream);
|
||||
nsAutoCString hashKey;
|
||||
pushStream->GetHashKey(hashKey);
|
||||
nsISchedulingContext *schedulingContext = aStream->SchedulingContext();
|
||||
if (schedulingContext) {
|
||||
nsILoadGroupConnectionInfo *loadGroupCI = aStream->LoadGroupConnectionInfo();
|
||||
if (loadGroupCI) {
|
||||
SpdyPushCache *cache = nullptr;
|
||||
schedulingContext->GetSpdyPushCache(&cache);
|
||||
loadGroupCI->GetSpdyPushCache(&cache);
|
||||
if (cache) {
|
||||
Http2PushedStream *trash = cache->RemovePushedStreamHttp2(hashKey);
|
||||
LOG3(("Http2Session::CleanupStream %p aStream=%p pushStream=%p trash=%p",
|
||||
@ -1638,12 +1638,12 @@ Http2Session::RecvPushPromise(Http2Session *self)
|
||||
LOG3(("Http2Session::RecvPushPromise %p lookup associated ID failed.\n", self));
|
||||
self->GenerateRstStream(PROTOCOL_ERROR, promisedID);
|
||||
} else {
|
||||
nsISchedulingContext *schedulingContext = associatedStream->SchedulingContext();
|
||||
if (schedulingContext) {
|
||||
schedulingContext->GetSpdyPushCache(&cache);
|
||||
nsILoadGroupConnectionInfo *loadGroupCI = associatedStream->LoadGroupConnectionInfo();
|
||||
if (loadGroupCI) {
|
||||
loadGroupCI->GetSpdyPushCache(&cache);
|
||||
if (!cache) {
|
||||
cache = new SpdyPushCache();
|
||||
if (!cache || NS_FAILED(schedulingContext->SetSpdyPushCache(cache))) {
|
||||
if (!cache || NS_FAILED(loadGroupCI->SetSpdyPushCache(cache))) {
|
||||
delete cache;
|
||||
cache = nullptr;
|
||||
}
|
||||
@ -1651,7 +1651,7 @@ Http2Session::RecvPushPromise(Http2Session *self)
|
||||
}
|
||||
if (!cache) {
|
||||
// this is unexpected, but we can handle it just by refusing the push
|
||||
LOG3(("Http2Session::RecvPushPromise Push Recevied without push cache\n"));
|
||||
LOG3(("Http2Session::RecvPushPromise Push Recevied without loadgroup cache\n"));
|
||||
self->GenerateRstStream(REFUSED_STREAM_ERROR, promisedID);
|
||||
} else {
|
||||
resetStream = false;
|
||||
|
@ -363,10 +363,10 @@ Http2Stream::ParseHttpRequestHeaders(const char *buf,
|
||||
// check the push cache for GET
|
||||
if (head->IsGet()) {
|
||||
// from :scheme, :authority, :path
|
||||
nsISchedulingContext *schedulingContext = mTransaction->SchedulingContext();
|
||||
nsILoadGroupConnectionInfo *loadGroupCI = mTransaction->LoadGroupConnectionInfo();
|
||||
SpdyPushCache *cache = nullptr;
|
||||
if (schedulingContext) {
|
||||
schedulingContext->GetSpdyPushCache(&cache);
|
||||
if (loadGroupCI) {
|
||||
loadGroupCI->GetSpdyPushCache(&cache);
|
||||
}
|
||||
|
||||
Http2PushedStream *pushedStream = nullptr;
|
||||
@ -393,8 +393,8 @@ Http2Stream::ParseHttpRequestHeaders(const char *buf,
|
||||
}
|
||||
|
||||
LOG3(("Pushed Stream Lookup "
|
||||
"session=%p key=%s schedulingcontext=%p cache=%p hit=%p\n",
|
||||
mSession, hashkey.get(), schedulingContext, cache, pushedStream));
|
||||
"session=%p key=%s loadgroupci=%p cache=%p hit=%p\n",
|
||||
mSession, hashkey.get(), loadGroupCI, cache, pushedStream));
|
||||
|
||||
if (pushedStream) {
|
||||
LOG3(("Pushed Stream Match located id=0x%X key=%s\n",
|
||||
|
@ -67,9 +67,9 @@ public:
|
||||
bool HasRegisteredID() { return mStreamID != 0; }
|
||||
|
||||
nsAHttpTransaction *Transaction() { return mTransaction; }
|
||||
virtual nsISchedulingContext *SchedulingContext()
|
||||
virtual nsILoadGroupConnectionInfo *LoadGroupConnectionInfo()
|
||||
{
|
||||
return mTransaction ? mTransaction->SchedulingContext() : nullptr;
|
||||
return mTransaction ? mTransaction->LoadGroupConnectionInfo() : nullptr;
|
||||
}
|
||||
|
||||
void Close(nsresult reason);
|
||||
|
@ -37,7 +37,6 @@
|
||||
#include "nsPerformance.h"
|
||||
#include "nsINetworkInterceptController.h"
|
||||
#include "mozIThirdPartyUtil.h"
|
||||
#include "nsILoadGroupChild.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
@ -96,7 +95,6 @@ HttpBaseChannel::HttpBaseChannel()
|
||||
#endif
|
||||
mSelfAddr.raw.family = PR_AF_UNSPEC;
|
||||
mPeerAddr.raw.family = PR_AF_UNSPEC;
|
||||
mSchedulingContextID.Clear();
|
||||
}
|
||||
|
||||
HttpBaseChannel::~HttpBaseChannel()
|
||||
@ -1460,21 +1458,6 @@ HttpBaseChannel::RedirectTo(nsIURI *newURI)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HttpBaseChannel::GetSchedulingContextID(nsID *aSCID)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aSCID);
|
||||
*aSCID = mSchedulingContextID;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HttpBaseChannel::SetSchedulingContextID(const nsID aSCID)
|
||||
{
|
||||
mSchedulingContextID = aSCID;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// HttpBaseChannel::nsIHttpChannelInternal
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -2688,35 +2671,6 @@ HttpBaseChannel::GetPerformance()
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
bool
|
||||
HttpBaseChannel::EnsureSchedulingContextID()
|
||||
{
|
||||
nsID nullID;
|
||||
nullID.Clear();
|
||||
if (!mSchedulingContextID.Equals(nullID)) {
|
||||
// Already have a scheduling context ID, no need to do the rest of this work
|
||||
return true;
|
||||
}
|
||||
|
||||
// Find the loadgroup at the end of the chain in order
|
||||
// to make sure all channels derived from the load group
|
||||
// use the same connection scope.
|
||||
nsCOMPtr<nsILoadGroupChild> childLoadGroup = do_QueryInterface(mLoadGroup);
|
||||
if (!childLoadGroup) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsILoadGroup> rootLoadGroup;
|
||||
childLoadGroup->GetRootLoadGroup(getter_AddRefs(rootLoadGroup));
|
||||
if (!rootLoadGroup) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set the load group connection scope on the transaction
|
||||
rootLoadGroup->GetSchedulingContextID(&mSchedulingContextID);
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace net
|
||||
} // namespace mozilla
|
||||
|
||||
|
@ -158,8 +158,6 @@ public:
|
||||
NS_IMETHOD GetResponseStatusText(nsACString& aValue) override;
|
||||
NS_IMETHOD GetRequestSucceeded(bool *aValue) override;
|
||||
NS_IMETHOD RedirectTo(nsIURI *newURI) override;
|
||||
NS_IMETHOD GetSchedulingContextID(nsID *aSCID) override;
|
||||
NS_IMETHOD SetSchedulingContextID(const nsID aSCID) override;
|
||||
|
||||
// nsIHttpChannelInternal
|
||||
NS_IMETHOD GetDocumentURI(nsIURI **aDocumentURI) override;
|
||||
@ -435,9 +433,6 @@ protected:
|
||||
|
||||
// The network interface id that's associated with this channel.
|
||||
nsCString mNetworkInterfaceId;
|
||||
|
||||
nsID mSchedulingContextID;
|
||||
bool EnsureSchedulingContextID();
|
||||
};
|
||||
|
||||
// Share some code while working around C++'s absurd inability to handle casting
|
||||
|
@ -1634,11 +1634,6 @@ HttpChannelChild::ContinueAsyncOpen()
|
||||
|
||||
propagateLoadInfo(mLoadInfo, openArgs);
|
||||
|
||||
EnsureSchedulingContextID();
|
||||
char scid[NSID_LENGTH];
|
||||
mSchedulingContextID.ToProvidedString(scid);
|
||||
openArgs.schedulingContextID().AssignASCII(scid);
|
||||
|
||||
// The socket transport in the chrome process now holds a logical ref to us
|
||||
// until OnStopRequest, or we do a redirect, or we hit an IPDL error.
|
||||
AddIPDLReference();
|
||||
|
@ -110,8 +110,7 @@ HttpChannelParent::Init(const HttpChannelCreationArgs& aArgs)
|
||||
a.entityID(), a.chooseApplicationCache(),
|
||||
a.appCacheClientID(), a.allowSpdy(), a.fds(),
|
||||
a.requestingPrincipalInfo(), a.triggeringPrincipalInfo(),
|
||||
a.securityFlags(), a.contentPolicyType(), a.innerWindowID(),
|
||||
a.schedulingContextID());
|
||||
a.securityFlags(), a.contentPolicyType(), a.innerWindowID());
|
||||
}
|
||||
case HttpChannelCreationArgs::THttpChannelConnectArgs:
|
||||
{
|
||||
@ -202,8 +201,7 @@ HttpChannelParent::DoAsyncOpen( const URIParams& aURI,
|
||||
const ipc::PrincipalInfo& aTriggeringPrincipalInfo,
|
||||
const uint32_t& aSecurityFlags,
|
||||
const uint32_t& aContentPolicyType,
|
||||
const uint32_t& aInnerWindowID,
|
||||
const nsCString& aSchedulingContextID)
|
||||
const uint32_t& aInnerWindowID)
|
||||
{
|
||||
nsCOMPtr<nsIURI> uri = DeserializeURI(aURI);
|
||||
if (!uri) {
|
||||
@ -375,10 +373,6 @@ HttpChannelParent::DoAsyncOpen( const URIParams& aURI,
|
||||
}
|
||||
}
|
||||
|
||||
nsID schedulingContextID;
|
||||
schedulingContextID.Parse(aSchedulingContextID.BeginReading());
|
||||
mChannel->SetSchedulingContextID(schedulingContextID);
|
||||
|
||||
rv = mChannel->AsyncOpen(mParentListener, nullptr);
|
||||
if (NS_FAILED(rv))
|
||||
return SendFailedAsyncOpen(rv);
|
||||
|
@ -115,8 +115,7 @@ protected:
|
||||
const ipc::PrincipalInfo& aTriggeringPrincipalInfo,
|
||||
const uint32_t& aSecurityFlags,
|
||||
const uint32_t& aContentPolicyType,
|
||||
const uint32_t& aInnerWindowID,
|
||||
const nsCString& aSchedulingContextID);
|
||||
const uint32_t& aInnerWindowID);
|
||||
|
||||
virtual bool RecvSetPriority(const uint16_t& priority) override;
|
||||
virtual bool RecvSetClassOfService(const uint32_t& cos) override;
|
||||
|
@ -205,18 +205,6 @@ NullHttpChannel::RedirectTo(nsIURI *aNewURI)
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NullHttpChannel::GetSchedulingContextID(nsID *_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NullHttpChannel::SetSchedulingContextID(const nsID scID)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// NullHttpChannel::nsIChannel
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -40,7 +40,7 @@ SpdyPushedStream31::SpdyPushedStream31(SpdyPush31TransactionBuffer *aTransaction
|
||||
LOG3(("SpdyPushedStream31 ctor this=%p id=0x%X\n", this, aID));
|
||||
mStreamID = aID;
|
||||
mBufferedPush->SetPushStream(this);
|
||||
mSchedulingContext = aAssociatedStream->SchedulingContext();
|
||||
mLoadGroupCI = aAssociatedStream->LoadGroupConnectionInfo();
|
||||
mLastRead = TimeStamp::Now();
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "nsHttpRequestHead.h"
|
||||
#include "nsISchedulingContext.h"
|
||||
#include "nsILoadGroup.h"
|
||||
#include "nsString.h"
|
||||
#include "PSpdyPush.h"
|
||||
#include "SpdySession31.h"
|
||||
@ -40,7 +40,7 @@ public:
|
||||
nsresult ReadSegments(nsAHttpSegmentReader *, uint32_t, uint32_t *);
|
||||
nsresult WriteSegments(nsAHttpSegmentWriter *, uint32_t, uint32_t *);
|
||||
|
||||
nsISchedulingContext *SchedulingContext() { return mSchedulingContext; };
|
||||
nsILoadGroupConnectionInfo *LoadGroupConnectionInfo() { return mLoadGroupCI; };
|
||||
void ConnectPushedStream(SpdyStream31 *consumer);
|
||||
|
||||
bool DeferCleanupOnSuccess() { return mDeferCleanupOnSuccess; }
|
||||
@ -58,7 +58,7 @@ private:
|
||||
SpdyStream31 *mConsumerStream; // paired request stream that consumes from
|
||||
// real spdy one.. null until a match is made.
|
||||
|
||||
nsCOMPtr<nsISchedulingContext> mSchedulingContext;
|
||||
nsCOMPtr<nsILoadGroupConnectionInfo> mLoadGroupCI;
|
||||
|
||||
SpdyPush31TransactionBuffer *mBufferedPush;
|
||||
TimeStamp mLastRead;
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include "nsHttp.h"
|
||||
#include "nsHttpHandler.h"
|
||||
#include "nsHttpConnection.h"
|
||||
#include "nsISchedulingContext.h"
|
||||
#include "nsILoadGroup.h"
|
||||
#include "nsISupportsPriority.h"
|
||||
#include "prprf.h"
|
||||
#include "prnetdb.h"
|
||||
@ -1081,12 +1081,12 @@ SpdySession31::HandleSynStream(SpdySession31 *self)
|
||||
self->GenerateRstStream(RST_INVALID_STREAM, streamID);
|
||||
|
||||
} else {
|
||||
nsISchedulingContext *schedulingContext = associatedStream->SchedulingContext();
|
||||
if (schedulingContext) {
|
||||
schedulingContext->GetSpdyPushCache(&cache);
|
||||
nsILoadGroupConnectionInfo *loadGroupCI = associatedStream->LoadGroupConnectionInfo();
|
||||
if (loadGroupCI) {
|
||||
loadGroupCI->GetSpdyPushCache(&cache);
|
||||
if (!cache) {
|
||||
cache = new SpdyPushCache();
|
||||
if (!cache || NS_FAILED(schedulingContext->SetSpdyPushCache(cache))) {
|
||||
if (!cache || NS_FAILED(loadGroupCI->SetSpdyPushCache(cache))) {
|
||||
delete cache;
|
||||
cache = nullptr;
|
||||
}
|
||||
@ -1094,7 +1094,7 @@ SpdySession31::HandleSynStream(SpdySession31 *self)
|
||||
}
|
||||
if (!cache) {
|
||||
// this is unexpected, but we can handle it just be refusing the push
|
||||
LOG3(("SpdySession31::HandleSynStream Push Recevied without push cache\n"));
|
||||
LOG3(("SpdySession31::HandleSynStream Push Recevied without loadgroup cache\n"));
|
||||
self->GenerateRstStream(RST_REFUSED_STREAM, streamID);
|
||||
}
|
||||
else {
|
||||
|
@ -316,10 +316,10 @@ SpdyStream31::ParseHttpRequestHeaders(const char *buf,
|
||||
// check the push cache for GET
|
||||
if (mTransaction->RequestHead()->IsGet()) {
|
||||
// from :scheme, :host, :path
|
||||
nsISchedulingContext *schedulingContext = mTransaction->SchedulingContext();
|
||||
nsILoadGroupConnectionInfo *loadGroupCI = mTransaction->LoadGroupConnectionInfo();
|
||||
SpdyPushCache *cache = nullptr;
|
||||
if (schedulingContext)
|
||||
schedulingContext->GetSpdyPushCache(&cache);
|
||||
if (loadGroupCI)
|
||||
loadGroupCI->GetSpdyPushCache(&cache);
|
||||
|
||||
SpdyPushedStream31 *pushedStream = nullptr;
|
||||
// we remove the pushedstream from the push cache so that
|
||||
|
@ -42,9 +42,9 @@ public:
|
||||
bool HasRegisteredID() { return mStreamID != 0; }
|
||||
|
||||
nsAHttpTransaction *Transaction() { return mTransaction; }
|
||||
virtual nsISchedulingContext *SchedulingContext()
|
||||
virtual nsILoadGroupConnectionInfo *LoadGroupConnectionInfo()
|
||||
{
|
||||
return mTransaction ? mTransaction->SchedulingContext() : nullptr;
|
||||
return mTransaction ? mTransaction->LoadGroupConnectionInfo() : nullptr;
|
||||
}
|
||||
|
||||
void Close(nsresult reason);
|
||||
|
@ -12,7 +12,7 @@
|
||||
class nsIInterfaceRequestor;
|
||||
class nsIEventTarget;
|
||||
class nsITransport;
|
||||
class nsISchedulingContext;
|
||||
class nsILoadGroupConnectionInfo;
|
||||
|
||||
namespace mozilla { namespace net {
|
||||
|
||||
@ -145,8 +145,8 @@ public:
|
||||
// other types
|
||||
virtual SpdyConnectTransaction *QuerySpdyConnectTransaction() { return nullptr; }
|
||||
|
||||
// return the scheduling context associated with the transaction
|
||||
virtual nsISchedulingContext *SchedulingContext() { return nullptr; }
|
||||
// return the load group connection information associated with the transaction
|
||||
virtual nsILoadGroupConnectionInfo *LoadGroupConnectionInfo() { return nullptr; }
|
||||
|
||||
// return the connection information associated with the transaction
|
||||
virtual nsHttpConnectionInfo *ConnectionInfo() = 0;
|
||||
|
@ -604,27 +604,25 @@ nsHttpChannel::ContinueHandleAsyncFallback(nsresult rv)
|
||||
}
|
||||
|
||||
void
|
||||
nsHttpChannel::SetupTransactionSchedulingContext()
|
||||
nsHttpChannel::SetupTransactionLoadGroupInfo()
|
||||
{
|
||||
if (!EnsureSchedulingContextID()) {
|
||||
// Find the loadgroup at the end of the chain in order
|
||||
// to make sure all channels derived from the load group
|
||||
// use the same connection scope.
|
||||
nsCOMPtr<nsILoadGroupChild> childLoadGroup = do_QueryInterface(mLoadGroup);
|
||||
if (!childLoadGroup)
|
||||
return;
|
||||
}
|
||||
|
||||
nsISchedulingContextService *scsvc =
|
||||
gHttpHandler->GetSchedulingContextService();
|
||||
if (!scsvc) {
|
||||
nsCOMPtr<nsILoadGroup> rootLoadGroup;
|
||||
childLoadGroup->GetRootLoadGroup(getter_AddRefs(rootLoadGroup));
|
||||
if (!rootLoadGroup)
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISchedulingContext> sc;
|
||||
nsresult rv = scsvc->GetSchedulingContext(mSchedulingContextID,
|
||||
getter_AddRefs(sc));
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
return;
|
||||
}
|
||||
|
||||
mTransaction->SetSchedulingContext(sc);
|
||||
// Set the load group connection scope on the transaction
|
||||
nsCOMPtr<nsILoadGroupConnectionInfo> ci;
|
||||
rootLoadGroup->GetConnectionInfo(getter_AddRefs(ci));
|
||||
if (ci)
|
||||
mTransaction->SetLoadGroupConnectionInfo(ci);
|
||||
}
|
||||
|
||||
static bool
|
||||
@ -841,7 +839,7 @@ nsHttpChannel::SetupTransaction()
|
||||
}
|
||||
|
||||
mTransaction->SetClassOfService(mClassOfService);
|
||||
SetupTransactionSchedulingContext();
|
||||
SetupTransactionLoadGroupInfo();
|
||||
|
||||
rv = nsInputStreamPump::Create(getter_AddRefs(mTransactionPump),
|
||||
responseStream);
|
||||
|
@ -231,7 +231,7 @@ private:
|
||||
nsresult Connect();
|
||||
void SpeculativeConnect();
|
||||
nsresult SetupTransaction();
|
||||
void SetupTransactionSchedulingContext();
|
||||
void SetupTransactionLoadGroupInfo();
|
||||
nsresult CallOnStartRequest();
|
||||
nsresult ProcessResponse();
|
||||
nsresult ContinueProcessResponse(nsresult);
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include "NullHttpTransaction.h"
|
||||
#include "nsIDNSRecord.h"
|
||||
#include "nsITransport.h"
|
||||
#include "nsISchedulingContext.h"
|
||||
#include "nsISocketTransportService.h"
|
||||
#include <algorithm>
|
||||
#include "Http2Compression.h"
|
||||
@ -1783,20 +1782,20 @@ nsHttpConnectionMgr::TryDispatchTransaction(nsConnectionEntry *ent,
|
||||
}
|
||||
}
|
||||
|
||||
// If this is not a blocking transaction and the scheduling context for it is
|
||||
// If this is not a blocking transaction and the loadgroup for it is
|
||||
// currently processing one or more blocking transactions then we
|
||||
// need to just leave it in the queue until those are complete unless it is
|
||||
// explicitly marked as unblocked.
|
||||
if (!(caps & NS_HTTP_LOAD_AS_BLOCKING)) {
|
||||
if (!(caps & NS_HTTP_LOAD_UNBLOCKED)) {
|
||||
nsISchedulingContext *schedulingContext = trans->SchedulingContext();
|
||||
if (schedulingContext) {
|
||||
nsILoadGroupConnectionInfo *loadGroupCI = trans->LoadGroupConnectionInfo();
|
||||
if (loadGroupCI) {
|
||||
uint32_t blockers = 0;
|
||||
if (NS_SUCCEEDED(schedulingContext->GetBlockingTransactionCount(&blockers)) &&
|
||||
if (NS_SUCCEEDED(loadGroupCI->GetBlockingTransactionCount(&blockers)) &&
|
||||
blockers) {
|
||||
// need to wait for blockers to clear
|
||||
LOG((" blocked by scheduling context: [sc=%p trans=%p blockers=%d]\n",
|
||||
schedulingContext, trans, blockers));
|
||||
LOG((" blocked by load group: [lgci=%p trans=%p blockers=%d]\n",
|
||||
loadGroupCI, trans, blockers));
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
}
|
||||
|
@ -321,9 +321,6 @@ nsHttpHandler::Init()
|
||||
rv = InitConnectionMgr();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
mSchedulingContextService =
|
||||
do_GetService("@mozilla.org/network/scheduling-context-service;1");
|
||||
|
||||
#ifdef ANDROID
|
||||
mProductSub.AssignLiteral(MOZILLA_UAVERSION);
|
||||
#else
|
||||
|
@ -25,7 +25,6 @@ class nsICancelable;
|
||||
class nsICookieService;
|
||||
class nsIIOService;
|
||||
class nsIObserverService;
|
||||
class nsISchedulingContextService;
|
||||
class nsISiteSecurityService;
|
||||
class nsIStreamConverterService;
|
||||
class nsITimer;
|
||||
@ -338,11 +337,6 @@ public:
|
||||
void SetCacheSkippedUntil(TimeStamp arg) { mCacheSkippedUntil = arg; }
|
||||
void ClearCacheSkippedUntil() { mCacheSkippedUntil = TimeStamp(); }
|
||||
|
||||
nsISchedulingContextService *GetSchedulingContextService()
|
||||
{
|
||||
return mSchedulingContextService.get();
|
||||
}
|
||||
|
||||
private:
|
||||
virtual ~nsHttpHandler();
|
||||
|
||||
@ -546,8 +540,6 @@ private:
|
||||
// incorrect content lengths or malformed chunked encodings
|
||||
FrameCheckLevel mEnforceH1Framing;
|
||||
|
||||
nsCOMPtr<nsISchedulingContextService> mSchedulingContextService;
|
||||
|
||||
private:
|
||||
// For Rate Pacing Certain Network Events. Only assign this pointer on
|
||||
// socket thread.
|
||||
|
@ -33,7 +33,6 @@
|
||||
#include "nsIInputStream.h"
|
||||
#include "nsITransport.h"
|
||||
#include "nsIOService.h"
|
||||
#include "nsISchedulingContext.h"
|
||||
#include <algorithm>
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
@ -1785,10 +1784,10 @@ nsHttpTransaction::CancelPipeline(uint32_t reason)
|
||||
|
||||
|
||||
void
|
||||
nsHttpTransaction::SetSchedulingContext(nsISchedulingContext *aSchedulingContext)
|
||||
nsHttpTransaction::SetLoadGroupConnectionInfo(nsILoadGroupConnectionInfo *aLoadGroupCI)
|
||||
{
|
||||
LOG(("nsHttpTransaction %p SetSchedulingContext %p\n", this, aSchedulingContext));
|
||||
mSchedulingContext = aSchedulingContext;
|
||||
LOG(("nsHttpTransaction %p SetLoadGroupConnectionInfo %p\n", this, aLoadGroupCI));
|
||||
mLoadGroupCI = aLoadGroupCI;
|
||||
}
|
||||
|
||||
// Called when the transaction marked for blocking is associated with a connection
|
||||
@ -1803,32 +1802,32 @@ nsHttpTransaction::DispatchedAsBlocking()
|
||||
|
||||
LOG(("nsHttpTransaction %p dispatched as blocking\n", this));
|
||||
|
||||
if (!mSchedulingContext)
|
||||
if (!mLoadGroupCI)
|
||||
return;
|
||||
|
||||
LOG(("nsHttpTransaction adding blocking transaction %p from "
|
||||
"scheduling context %p\n", this, mSchedulingContext.get()));
|
||||
"loadgroup %p\n", this, mLoadGroupCI.get()));
|
||||
|
||||
mSchedulingContext->AddBlockingTransaction();
|
||||
mLoadGroupCI->AddBlockingTransaction();
|
||||
mDispatchedAsBlocking = true;
|
||||
}
|
||||
|
||||
void
|
||||
nsHttpTransaction::RemoveDispatchedAsBlocking()
|
||||
{
|
||||
if (!mSchedulingContext || !mDispatchedAsBlocking)
|
||||
if (!mLoadGroupCI || !mDispatchedAsBlocking)
|
||||
return;
|
||||
|
||||
uint32_t blockers = 0;
|
||||
nsresult rv = mSchedulingContext->RemoveBlockingTransaction(&blockers);
|
||||
nsresult rv = mLoadGroupCI->RemoveBlockingTransaction(&blockers);
|
||||
|
||||
LOG(("nsHttpTransaction removing blocking transaction %p from "
|
||||
"scheduling context %p. %d blockers remain.\n", this,
|
||||
mSchedulingContext.get(), blockers));
|
||||
"loadgroup %p. %d blockers remain.\n", this,
|
||||
mLoadGroupCI.get(), blockers));
|
||||
|
||||
if (NS_SUCCEEDED(rv) && !blockers) {
|
||||
LOG(("nsHttpTransaction %p triggering release of blocked channels "
|
||||
" with scheduling context=%p\n", this, mSchedulingContext.get()));
|
||||
" with loadgroupci=%p\n", this, mLoadGroupCI.get()));
|
||||
gHttpHandler->ConnMgr()->ProcessPendingQ();
|
||||
}
|
||||
|
||||
@ -1839,9 +1838,9 @@ void
|
||||
nsHttpTransaction::ReleaseBlockingTransaction()
|
||||
{
|
||||
RemoveDispatchedAsBlocking();
|
||||
LOG(("nsHttpTransaction %p scheduling context set to null "
|
||||
"in ReleaseBlockingTransaction() - was %p\n", this, mSchedulingContext.get()));
|
||||
mSchedulingContext = nullptr;
|
||||
LOG(("nsHttpTransaction %p loadgroupci set to null "
|
||||
"in ReleaseBlockingTransaction() - was %p\n", this, mLoadGroupCI.get()));
|
||||
mLoadGroupCI = nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "EventTokenBucket.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsILoadGroup.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
#include "TimingStruct.h"
|
||||
#include "Http2Push.h"
|
||||
@ -27,7 +28,6 @@ class nsIHttpActivityObserver;
|
||||
class nsIEventTarget;
|
||||
class nsIInputStream;
|
||||
class nsIOutputStream;
|
||||
class nsISchedulingContext;
|
||||
|
||||
namespace mozilla { namespace net {
|
||||
|
||||
@ -123,9 +123,9 @@ public:
|
||||
const TimeStamp GetPendingTime() { return mPendingTime; }
|
||||
bool UsesPipelining() const { return mCaps & NS_HTTP_ALLOW_PIPELINING; }
|
||||
|
||||
// overload of nsAHttpTransaction::SchedulingContext()
|
||||
nsISchedulingContext *SchedulingContext() override { return mSchedulingContext.get(); }
|
||||
void SetSchedulingContext(nsISchedulingContext *aSchedulingContext);
|
||||
// overload of nsAHttpTransaction::LoadGroupConnectionInfo()
|
||||
nsILoadGroupConnectionInfo *LoadGroupConnectionInfo() override { return mLoadGroupCI.get(); }
|
||||
void SetLoadGroupConnectionInfo(nsILoadGroupConnectionInfo *aLoadGroupCI);
|
||||
void DispatchedAsBlocking();
|
||||
void RemoveDispatchedAsBlocking();
|
||||
|
||||
@ -217,7 +217,7 @@ private:
|
||||
nsCOMPtr<nsISupports> mSecurityInfo;
|
||||
nsCOMPtr<nsIAsyncInputStream> mPipeIn;
|
||||
nsCOMPtr<nsIAsyncOutputStream> mPipeOut;
|
||||
nsCOMPtr<nsISchedulingContext> mSchedulingContext;
|
||||
nsCOMPtr<nsILoadGroupConnectionInfo> mLoadGroupCI;
|
||||
|
||||
nsCOMPtr<nsISupports> mChannel;
|
||||
nsCOMPtr<nsIHttpActivityObserver> mActivityDistributor;
|
||||
|
@ -14,7 +14,7 @@ interface nsIHttpHeaderVisitor;
|
||||
* the inspection of the resulting HTTP response status and headers when they
|
||||
* become available.
|
||||
*/
|
||||
[scriptable, uuid(fdc70825-8ae1-4f81-bd9e-f1fd3f6307ad)]
|
||||
[scriptable, uuid(86ad7e1f-3a64-4e0f-a104-395ebecd7d5c)]
|
||||
interface nsIHttpChannel : nsIChannel
|
||||
{
|
||||
/**************************************************************************
|
||||
@ -321,9 +321,4 @@ interface nsIHttpChannel : nsIChannel
|
||||
* has been opened.
|
||||
*/
|
||||
void redirectTo(in nsIURI aNewURI);
|
||||
|
||||
/**
|
||||
* Identifies the scheduling context for this load.
|
||||
*/
|
||||
[noscript] attribute nsID schedulingContextID;
|
||||
};
|
||||
|
@ -798,16 +798,3 @@ nsViewSourceChannel::RedirectTo(nsIURI *uri)
|
||||
mHttpChannel->RedirectTo(uri);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsViewSourceChannel::GetSchedulingContextID(nsID *_retval)
|
||||
{
|
||||
return !mHttpChannel ? NS_ERROR_NULL_POINTER :
|
||||
mHttpChannel->GetSchedulingContextID(_retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsViewSourceChannel::SetSchedulingContextID(const nsID scid)
|
||||
{
|
||||
return !mHttpChannel ? NS_ERROR_NULL_POINTER :
|
||||
mHttpChannel->SetSchedulingContextID(scid);
|
||||
}
|
||||
|
@ -781,9 +781,8 @@ var tests = [ test_http2_post_big
|
||||
, test_http2_patch
|
||||
, test_http2_pushapi_1
|
||||
, test_http2_continuations
|
||||
// Add new tests above here - best to add new tests before h1
|
||||
// streams get too involved
|
||||
// These next two must always come in this order
|
||||
// best to add new tests before h1 streams get too involved
|
||||
, test_http2_h11required_stream
|
||||
, test_http2_h11required_session
|
||||
, test_http2_retry_rst
|
||||
|
@ -8,16 +8,6 @@
|
||||
#include "prprf.h"
|
||||
#include "nsMemory.h"
|
||||
|
||||
void nsID::Clear()
|
||||
{
|
||||
m0 = 0;
|
||||
m1 = 0;
|
||||
m2 = 0;
|
||||
for (int i = 0; i < 8; ++i) {
|
||||
m3[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Multiplies the_int_var with 16 (0x10) and adds the value of the
|
||||
* hexadecimal digit the_char. If it fails it returns false from
|
||||
|
@ -35,11 +35,6 @@ struct nsID
|
||||
*/
|
||||
|
||||
//@{
|
||||
/**
|
||||
* Ensures everything is zeroed out.
|
||||
*/
|
||||
void Clear();
|
||||
|
||||
/**
|
||||
* Equivalency method. Compares this nsID with another.
|
||||
* @return <b>true</b> if they are the same, <b>false</b> if not.
|
||||
|
Loading…
Reference in New Issue
Block a user