summaryrefslogtreecommitdiffstats
path: root/netwerk/base/nsLoadGroup.h
blob: 9b5e70868c5da7eca83a7ebf4855056c05bf3e38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* 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 "nsPILoadGroupInternal.h"
#include "nsAgg.h"
#include "nsCOMPtr.h"
#include "nsWeakPtr.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 nsISupportsPriority,
                    public nsSupportsWeakReference,
                    public nsPILoadGroupInternal
{
public:
    NS_DECL_AGGREGATED

    ////////////////////////////////////////////////////////////////////////////
    // nsIRequest methods:
    NS_DECL_NSIREQUEST

    ////////////////////////////////////////////////////////////////////////////
    // nsILoadGroup methods:
    NS_DECL_NSILOADGROUP
    NS_DECL_NSPILOADGROUPINTERNAL

    ////////////////////////////////////////////////////////////////////////////
    // nsILoadGroupChild methods:
    NS_DECL_NSILOADGROUPCHILD

    ////////////////////////////////////////////////////////////////////////////
    // nsISupportsPriority methods:
    NS_DECL_NSISUPPORTSPRIORITY

    ////////////////////////////////////////////////////////////////////////////
    // nsLoadGroup methods:

    explicit nsLoadGroup(nsISupports* outer);
    virtual ~nsLoadGroup();

    nsresult Init();

protected:
    nsresult MergeLoadFlags(nsIRequest *aRequest, nsLoadFlags& flags);
    nsresult MergeDefaultLoadFlags(nsIRequest *aRequest, nsLoadFlags& flags);

protected:
    uint32_t                        mForegroundCount;
    uint32_t                        mLoadFlags;
    uint32_t                        mDefaultLoadFlags;

    nsCOMPtr<nsILoadGroup>          mLoadGroup; // load groups can contain load groups
    nsCOMPtr<nsIInterfaceRequestor> mCallbacks;
    nsCOMPtr<nsIRequestContext>  mRequestContext;
    nsCOMPtr<nsIRequestContextService> mRequestContextService;

    nsCOMPtr<nsIRequest>            mDefaultLoadRequest;
    PLDHashTable                    mRequests;

    nsWeakPtr                       mObserver;
    nsWeakPtr                       mParentLoadGroup;

    nsresult                        mStatus;
    int32_t                         mPriority;
    bool                            mIsCanceling;

    /* For nsPILoadGroupInternal */
    uint32_t                        mTimedNonCachedRequestsUntilOnEndPageLoad;
};

} // namespace net
} // namespace mozilla

#endif // nsLoadGroup_h__