2018-11-30 22:52:05 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* 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/. */
|
1999-06-25 02:58:42 +04:00
|
|
|
|
|
|
|
#ifndef nsLoadGroup_h__
|
|
|
|
#define nsLoadGroup_h__
|
|
|
|
|
|
|
|
#include "nsILoadGroup.h"
|
2013-04-09 21:38:48 +04:00
|
|
|
#include "nsILoadGroupChild.h"
|
2020-03-19 19:24:21 +03:00
|
|
|
#include "nsIObserver.h"
|
1999-08-27 02:45:55 +04:00
|
|
|
#include "nsCOMPtr.h"
|
1999-09-20 09:27:50 +04:00
|
|
|
#include "nsWeakReference.h"
|
2005-02-21 23:58:01 +03:00
|
|
|
#include "nsISupportsPriority.h"
|
2015-09-16 06:49:53 +03:00
|
|
|
#include "PLDHashTable.h"
|
2011-07-02 00:22:18 +04:00
|
|
|
#include "mozilla/TimeStamp.h"
|
1999-06-25 02:58:42 +04:00
|
|
|
|
2016-04-21 17:59:17 +03:00
|
|
|
class nsIRequestContext;
|
|
|
|
class nsIRequestContextService;
|
2013-09-22 07:04:57 +04:00
|
|
|
class nsITimedChannel;
|
1999-06-25 02:58:42 +04:00
|
|
|
|
2016-05-19 05:02:57 +03:00
|
|
|
namespace mozilla {
|
|
|
|
namespace net {
|
|
|
|
|
1999-09-20 09:27:50 +04:00
|
|
|
class nsLoadGroup : public nsILoadGroup,
|
2013-04-09 21:38:48 +04:00
|
|
|
public nsILoadGroupChild,
|
2020-03-19 19:24:21 +03:00
|
|
|
public nsIObserver,
|
2005-02-21 23:58:01 +03:00
|
|
|
public nsISupportsPriority,
|
2018-12-19 18:08:28 +03:00
|
|
|
public nsSupportsWeakReference {
|
1999-06-25 02:58:42 +04:00
|
|
|
public:
|
2018-12-19 18:08:28 +03:00
|
|
|
NS_DECL_ISUPPORTS
|
2016-02-10 00:33:34 +03:00
|
|
|
|
1999-06-25 02:58:42 +04:00
|
|
|
////////////////////////////////////////////////////////////////////////////
|
|
|
|
// nsIRequest methods:
|
1999-08-22 17:26:18 +04:00
|
|
|
NS_DECL_NSIREQUEST
|
1999-06-25 02:58:42 +04:00
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////
|
|
|
|
// nsILoadGroup methods:
|
1999-08-22 17:26:18 +04:00
|
|
|
NS_DECL_NSILOADGROUP
|
1999-11-22 08:46:03 +03:00
|
|
|
|
2013-04-09 21:38:48 +04:00
|
|
|
////////////////////////////////////////////////////////////////////////////
|
|
|
|
// nsILoadGroupChild methods:
|
|
|
|
NS_DECL_NSILOADGROUPCHILD
|
|
|
|
|
2005-02-21 23:58:01 +03:00
|
|
|
////////////////////////////////////////////////////////////////////////////
|
|
|
|
// nsISupportsPriority methods:
|
|
|
|
NS_DECL_NSISUPPORTSPRIORITY
|
|
|
|
|
2020-03-19 19:24:21 +03:00
|
|
|
////////////////////////////////////////////////////////////////////////////
|
|
|
|
// nsIObserver methods:
|
|
|
|
NS_DECL_NSIOBSERVER
|
|
|
|
|
1999-06-25 02:58:42 +04:00
|
|
|
////////////////////////////////////////////////////////////////////////////
|
|
|
|
// nsLoadGroup methods:
|
|
|
|
|
2018-12-19 18:08:28 +03:00
|
|
|
nsLoadGroup();
|
1999-06-25 02:58:42 +04:00
|
|
|
|
2015-07-31 23:50:08 +03:00
|
|
|
nsresult Init();
|
|
|
|
|
2015-05-13 03:33:44 +03:00
|
|
|
protected:
|
2018-12-19 18:08:28 +03:00
|
|
|
virtual ~nsLoadGroup();
|
|
|
|
|
2001-04-10 10:01:08 +04:00
|
|
|
nsresult MergeLoadFlags(nsIRequest* aRequest, nsLoadFlags& flags);
|
2015-07-21 16:23:00 +03:00
|
|
|
nsresult MergeDefaultLoadFlags(nsIRequest* aRequest, nsLoadFlags& flags);
|
1999-08-27 02:45:55 +04:00
|
|
|
|
2011-07-02 00:22:18 +04:00
|
|
|
private:
|
|
|
|
void TelemetryReport();
|
|
|
|
void TelemetryReportChannel(nsITimedChannel* timedChannel,
|
|
|
|
bool defaultRequest);
|
|
|
|
|
2019-10-08 23:21:42 +03:00
|
|
|
nsresult RemoveRequestFromHashtable(nsIRequest* aRequest, nsresult aStatus);
|
|
|
|
nsresult NotifyRemovalObservers(nsIRequest* aRequest, nsresult aStatus);
|
|
|
|
|
1999-06-25 02:58:42 +04:00
|
|
|
protected:
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mForegroundCount;
|
|
|
|
uint32_t mLoadFlags;
|
2013-09-06 10:33:29 +04:00
|
|
|
uint32_t mDefaultLoadFlags;
|
2018-12-19 18:08:28 +03:00
|
|
|
int32_t mPriority;
|
1999-08-27 02:45:55 +04:00
|
|
|
|
2001-04-10 10:01:08 +04:00
|
|
|
nsCOMPtr<nsILoadGroup> mLoadGroup; // load groups can contain load groups
|
|
|
|
nsCOMPtr<nsIInterfaceRequestor> mCallbacks;
|
2016-04-21 17:59:17 +03:00
|
|
|
nsCOMPtr<nsIRequestContext> mRequestContext;
|
|
|
|
nsCOMPtr<nsIRequestContextService> mRequestContextService;
|
1999-11-22 08:46:03 +03:00
|
|
|
|
2001-04-10 10:01:08 +04:00
|
|
|
nsCOMPtr<nsIRequest> mDefaultLoadRequest;
|
2015-05-20 02:46:17 +03:00
|
|
|
PLDHashTable mRequests;
|
2001-04-10 10:01:08 +04:00
|
|
|
|
|
|
|
nsWeakPtr mObserver;
|
2013-04-09 21:38:48 +04:00
|
|
|
nsWeakPtr mParentLoadGroup;
|
2016-02-10 00:33:34 +03:00
|
|
|
|
2001-04-10 10:01:08 +04:00
|
|
|
nsresult mStatus;
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mIsCanceling;
|
2018-12-19 18:08:28 +03:00
|
|
|
bool mDefaultLoadIsTimed;
|
2020-03-19 19:24:21 +03:00
|
|
|
bool mBrowsingContextDiscarded;
|
2011-07-02 00:22:18 +04:00
|
|
|
|
|
|
|
/* Telemetry */
|
|
|
|
mozilla::TimeStamp mDefaultRequestCreationTime;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mTimedRequests;
|
|
|
|
uint32_t mCachedRequests;
|
1999-06-25 02:58:42 +04:00
|
|
|
};
|
|
|
|
|
2016-05-19 05:02:57 +03:00
|
|
|
} // namespace net
|
|
|
|
} // namespace mozilla
|
|
|
|
|
1999-06-25 02:58:42 +04:00
|
|
|
#endif // nsLoadGroup_h__
|