Source code

Revision control

Other Tools

1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
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 "nsCOMPtr.h"
12
#include "nsWeakReference.h"
13
#include "nsISupportsPriority.h"
14
#include "PLDHashTable.h"
15
#include "mozilla/TimeStamp.h"
16
17
class nsIRequestContext;
18
class nsIRequestContextService;
19
class nsITimedChannel;
20
21
namespace mozilla {
22
namespace net {
23
24
class nsLoadGroup : public nsILoadGroup,
25
public nsILoadGroupChild,
26
public nsISupportsPriority,
27
public nsSupportsWeakReference {
28
public:
29
NS_DECL_ISUPPORTS
30
31
////////////////////////////////////////////////////////////////////////////
32
// nsIRequest methods:
33
NS_DECL_NSIREQUEST
34
35
////////////////////////////////////////////////////////////////////////////
36
// nsILoadGroup methods:
37
NS_DECL_NSILOADGROUP
38
39
////////////////////////////////////////////////////////////////////////////
40
// nsILoadGroupChild methods:
41
NS_DECL_NSILOADGROUPCHILD
42
43
////////////////////////////////////////////////////////////////////////////
44
// nsISupportsPriority methods:
45
NS_DECL_NSISUPPORTSPRIORITY
46
47
////////////////////////////////////////////////////////////////////////////
48
// nsLoadGroup methods:
49
50
nsLoadGroup();
51
52
nsresult Init();
53
54
protected:
55
virtual ~nsLoadGroup();
56
57
nsresult MergeLoadFlags(nsIRequest* aRequest, nsLoadFlags& flags);
58
nsresult MergeDefaultLoadFlags(nsIRequest* aRequest, nsLoadFlags& flags);
59
60
private:
61
void TelemetryReport();
62
void TelemetryReportChannel(nsITimedChannel* timedChannel,
63
bool defaultRequest);
64
65
protected:
66
uint32_t mForegroundCount;
67
uint32_t mLoadFlags;
68
uint32_t mDefaultLoadFlags;
69
int32_t mPriority;
70
71
nsCOMPtr<nsILoadGroup> mLoadGroup; // load groups can contain load groups
72
nsCOMPtr<nsIInterfaceRequestor> mCallbacks;
73
nsCOMPtr<nsIRequestContext> mRequestContext;
74
nsCOMPtr<nsIRequestContextService> mRequestContextService;
75
76
nsCOMPtr<nsIRequest> mDefaultLoadRequest;
77
PLDHashTable mRequests;
78
79
nsWeakPtr mObserver;
80
nsWeakPtr mParentLoadGroup;
81
82
nsresult mStatus;
83
bool mIsCanceling;
84
bool mDefaultLoadIsTimed;
85
86
/* Telemetry */
87
mozilla::TimeStamp mDefaultRequestCreationTime;
88
uint32_t mTimedRequests;
89
uint32_t mCachedRequests;
90
91
nsCString mUserAgentOverrideCache;
92
};
93
94
} // namespace net
95
} // namespace mozilla
96
97
#endif // nsLoadGroup_h__