Line data Source code
1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /* This Source Code Form is subject to the terms of the Mozilla Public
3 : * License, v. 2.0. If a copy of the MPL was not distributed with this
4 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 :
6 : #ifndef nsLoadGroup_h__
7 : #define nsLoadGroup_h__
8 :
9 : #include "nsILoadGroup.h"
10 : #include "nsILoadGroupChild.h"
11 : #include "nsPILoadGroupInternal.h"
12 : #include "nsAgg.h"
13 : #include "nsCOMPtr.h"
14 : #include "nsWeakPtr.h"
15 : #include "nsWeakReference.h"
16 : #include "nsISupportsPriority.h"
17 : #include "PLDHashTable.h"
18 : #include "mozilla/TimeStamp.h"
19 :
20 : class nsIRequestContext;
21 : class nsIRequestContextService;
22 : class nsITimedChannel;
23 :
24 : namespace mozilla {
25 : namespace net {
26 :
27 : class nsLoadGroup : public nsILoadGroup,
28 : public nsILoadGroupChild,
29 : public nsISupportsPriority,
30 : public nsSupportsWeakReference,
31 : public nsPILoadGroupInternal
32 : {
33 : public:
34 144 : NS_DECL_AGGREGATED
35 :
36 : ////////////////////////////////////////////////////////////////////////////
37 : // nsIRequest methods:
38 : NS_DECL_NSIREQUEST
39 :
40 : ////////////////////////////////////////////////////////////////////////////
41 : // nsILoadGroup methods:
42 : NS_DECL_NSILOADGROUP
43 : NS_DECL_NSPILOADGROUPINTERNAL
44 :
45 : ////////////////////////////////////////////////////////////////////////////
46 : // nsILoadGroupChild methods:
47 : NS_DECL_NSILOADGROUPCHILD
48 :
49 : ////////////////////////////////////////////////////////////////////////////
50 : // nsISupportsPriority methods:
51 : NS_DECL_NSISUPPORTSPRIORITY
52 :
53 : ////////////////////////////////////////////////////////////////////////////
54 : // nsLoadGroup methods:
55 :
56 : explicit nsLoadGroup(nsISupports* outer);
57 : virtual ~nsLoadGroup();
58 :
59 : nsresult Init();
60 :
61 : protected:
62 : nsresult MergeLoadFlags(nsIRequest *aRequest, nsLoadFlags& flags);
63 : nsresult MergeDefaultLoadFlags(nsIRequest *aRequest, nsLoadFlags& flags);
64 :
65 : private:
66 : void TelemetryReport();
67 : void TelemetryReportChannel(nsITimedChannel *timedChannel,
68 : bool defaultRequest);
69 :
70 : protected:
71 : uint32_t mForegroundCount;
72 : uint32_t mLoadFlags;
73 : uint32_t mDefaultLoadFlags;
74 :
75 : nsCOMPtr<nsILoadGroup> mLoadGroup; // load groups can contain load groups
76 : nsCOMPtr<nsIInterfaceRequestor> mCallbacks;
77 : nsCOMPtr<nsIRequestContext> mRequestContext;
78 : nsCOMPtr<nsIRequestContextService> mRequestContextService;
79 :
80 : nsCOMPtr<nsIRequest> mDefaultLoadRequest;
81 : PLDHashTable mRequests;
82 :
83 : nsWeakPtr mObserver;
84 : nsWeakPtr mParentLoadGroup;
85 :
86 : nsresult mStatus;
87 : int32_t mPriority;
88 : bool mIsCanceling;
89 :
90 : /* Telemetry */
91 : mozilla::TimeStamp mDefaultRequestCreationTime;
92 : bool mDefaultLoadIsTimed;
93 : uint32_t mTimedRequests;
94 : uint32_t mCachedRequests;
95 :
96 : /* For nsPILoadGroupInternal */
97 : uint32_t mTimedNonCachedRequestsUntilOnEndPageLoad;
98 :
99 : nsCString mUserAgentOverrideCache;
100 : };
101 :
102 : } // namespace net
103 : } // namespace mozilla
104 :
105 : #endif // nsLoadGroup_h__
|