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
nsresult RemoveRequestFromHashtable(nsIRequest* aRequest, nsresult aStatus);
66
nsresult NotifyRemovalObservers(nsIRequest* aRequest, nsresult aStatus);
67
68
protected:
69
uint32_t mForegroundCount;
70
uint32_t mLoadFlags;
71
uint32_t mDefaultLoadFlags;
72
int32_t mPriority;
73
74
nsCOMPtr<nsILoadGroup> mLoadGroup; // load groups can contain load groups
75
nsCOMPtr<nsIInterfaceRequestor> mCallbacks;
76
nsCOMPtr<nsIRequestContext> mRequestContext;
77
nsCOMPtr<nsIRequestContextService> mRequestContextService;
78
79
nsCOMPtr<nsIRequest> mDefaultLoadRequest;
80
PLDHashTable mRequests;
81
82
nsWeakPtr mObserver;
83
nsWeakPtr mParentLoadGroup;
84
85
nsresult mStatus;
86
bool mIsCanceling;
87
bool mDefaultLoadIsTimed;
88
89
/* Telemetry */
90
mozilla::TimeStamp mDefaultRequestCreationTime;
91
uint32_t mTimedRequests;
92
uint32_t mCachedRequests;
93
};
94
95
} // namespace net
96
} // namespace mozilla
97
98
#endif // nsLoadGroup_h__