From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- netwerk/base/nsLoadGroup.h | 111 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 netwerk/base/nsLoadGroup.h (limited to 'netwerk/base/nsLoadGroup.h') diff --git a/netwerk/base/nsLoadGroup.h b/netwerk/base/nsLoadGroup.h new file mode 100644 index 0000000000..055e1804d6 --- /dev/null +++ b/netwerk/base/nsLoadGroup.h @@ -0,0 +1,111 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* 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 nsLoadGroup_h__ +#define nsLoadGroup_h__ + +#include "nsILoadGroup.h" +#include "nsILoadGroupChild.h" +#include "nsIObserver.h" +#include "nsCOMPtr.h" +#include "nsWeakReference.h" +#include "nsISupportsPriority.h" +#include "PLDHashTable.h" +#include "mozilla/TimeStamp.h" + +class nsIRequestContext; +class nsIRequestContextService; +class nsITimedChannel; + +namespace mozilla { +namespace net { + +class nsLoadGroup : public nsILoadGroup, + public nsILoadGroupChild, + public nsIObserver, + public nsISupportsPriority, + public nsSupportsWeakReference { + public: + NS_DECL_ISUPPORTS + + //////////////////////////////////////////////////////////////////////////// + // nsIRequest methods: + NS_DECL_NSIREQUEST + + //////////////////////////////////////////////////////////////////////////// + // nsILoadGroup methods: + NS_DECL_NSILOADGROUP + + //////////////////////////////////////////////////////////////////////////// + // nsILoadGroupChild methods: + NS_DECL_NSILOADGROUPCHILD + + //////////////////////////////////////////////////////////////////////////// + // nsISupportsPriority methods: + NS_DECL_NSISUPPORTSPRIORITY + + //////////////////////////////////////////////////////////////////////////// + // nsIObserver methods: + NS_DECL_NSIOBSERVER + + //////////////////////////////////////////////////////////////////////////// + // nsLoadGroup methods: + + nsLoadGroup(); + + nsresult Init(); + nsresult InitWithRequestContextId(const uint64_t& aRequestContextId); + + void SetGroupObserver(nsIRequestObserver* aObserver, + bool aIncludeBackgroundRequests); + + protected: + virtual ~nsLoadGroup(); + + nsresult MergeLoadFlags(nsIRequest* aRequest, nsLoadFlags& flags); + nsresult MergeDefaultLoadFlags(nsIRequest* aRequest, nsLoadFlags& flags); + + private: + void TelemetryReport(); + void TelemetryReportChannel(nsITimedChannel* timedChannel, + bool defaultRequest); + + nsresult RemoveRequestFromHashtable(nsIRequest* aRequest, nsresult aStatus); + nsresult NotifyRemovalObservers(nsIRequest* aRequest, nsresult aStatus); + + protected: + uint32_t mForegroundCount{0}; + uint32_t mLoadFlags{LOAD_NORMAL}; + uint32_t mDefaultLoadFlags{0}; + int32_t mPriority{PRIORITY_NORMAL}; + + nsCOMPtr mLoadGroup; // load groups can contain load groups + nsCOMPtr mCallbacks; + nsCOMPtr mRequestContext; + nsCOMPtr mRequestContextService; + + nsCOMPtr mDefaultLoadRequest; + PLDHashTable mRequests; + + nsWeakPtr mObserver; + nsWeakPtr mParentLoadGroup; + + nsresult mStatus{NS_OK}; + bool mIsCanceling{false}; + bool mDefaultLoadIsTimed{false}; + bool mBrowsingContextDiscarded{false}; + bool mExternalRequestContext{false}; + bool mNotifyObserverAboutBackgroundRequests{false}; + + /* Telemetry */ + mozilla::TimeStamp mDefaultRequestCreationTime; + uint32_t mTimedRequests{0}; + uint32_t mCachedRequests{0}; +}; + +} // namespace net +} // namespace mozilla + +#endif // nsLoadGroup_h__ -- cgit v1.2.3