Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #include "nsIRequest.idl" |
michael@0 | 7 | |
michael@0 | 8 | interface nsISimpleEnumerator; |
michael@0 | 9 | interface nsIRequestObserver; |
michael@0 | 10 | interface nsIInterfaceRequestor; |
michael@0 | 11 | interface nsILoadGroupConnectionInfo; |
michael@0 | 12 | |
michael@0 | 13 | typedef unsigned long nsLoadFlags; |
michael@0 | 14 | |
michael@0 | 15 | /** |
michael@0 | 16 | * A load group maintains a collection of nsIRequest objects. |
michael@0 | 17 | */ |
michael@0 | 18 | [scriptable, uuid(afb57ac2-bce5-4ee3-bb34-385089a9ba5c)] |
michael@0 | 19 | interface nsILoadGroup : nsIRequest |
michael@0 | 20 | { |
michael@0 | 21 | /** |
michael@0 | 22 | * The group observer is notified when requests are added to and removed |
michael@0 | 23 | * from this load group. The groupObserver is weak referenced. |
michael@0 | 24 | */ |
michael@0 | 25 | attribute nsIRequestObserver groupObserver; |
michael@0 | 26 | |
michael@0 | 27 | /** |
michael@0 | 28 | * Accesses the default load request for the group. Each time a number |
michael@0 | 29 | * of requests are added to a group, the defaultLoadRequest may be set |
michael@0 | 30 | * to indicate that all of the requests are related to a base request. |
michael@0 | 31 | * |
michael@0 | 32 | * The load group inherits its load flags from the default load request. |
michael@0 | 33 | * If the default load request is NULL, then the group's load flags are |
michael@0 | 34 | * not changed. |
michael@0 | 35 | */ |
michael@0 | 36 | attribute nsIRequest defaultLoadRequest; |
michael@0 | 37 | |
michael@0 | 38 | /** |
michael@0 | 39 | * Adds a new request to the group. This will cause the default load |
michael@0 | 40 | * flags to be applied to the request. If this is a foreground |
michael@0 | 41 | * request then the groupObserver's onStartRequest will be called. |
michael@0 | 42 | * |
michael@0 | 43 | * If the request is the default load request or if the default load |
michael@0 | 44 | * request is null, then the load group will inherit its load flags from |
michael@0 | 45 | * the request. |
michael@0 | 46 | */ |
michael@0 | 47 | void addRequest(in nsIRequest aRequest, |
michael@0 | 48 | in nsISupports aContext); |
michael@0 | 49 | |
michael@0 | 50 | /** |
michael@0 | 51 | * Removes a request from the group. If this is a foreground request |
michael@0 | 52 | * then the groupObserver's onStopRequest will be called. |
michael@0 | 53 | * |
michael@0 | 54 | * By the time this call ends, aRequest will have been removed from the |
michael@0 | 55 | * loadgroup, even if this function throws an exception. |
michael@0 | 56 | */ |
michael@0 | 57 | void removeRequest(in nsIRequest aRequest, |
michael@0 | 58 | in nsISupports aContext, |
michael@0 | 59 | in nsresult aStatus); |
michael@0 | 60 | |
michael@0 | 61 | /** |
michael@0 | 62 | * Returns the requests contained directly in this group. |
michael@0 | 63 | * Enumerator element type: nsIRequest. |
michael@0 | 64 | */ |
michael@0 | 65 | readonly attribute nsISimpleEnumerator requests; |
michael@0 | 66 | |
michael@0 | 67 | /** |
michael@0 | 68 | * Returns the count of "active" requests (ie. requests without the |
michael@0 | 69 | * LOAD_BACKGROUND bit set). |
michael@0 | 70 | */ |
michael@0 | 71 | readonly attribute unsigned long activeCount; |
michael@0 | 72 | |
michael@0 | 73 | /** |
michael@0 | 74 | * Notification callbacks for the load group. |
michael@0 | 75 | */ |
michael@0 | 76 | attribute nsIInterfaceRequestor notificationCallbacks; |
michael@0 | 77 | |
michael@0 | 78 | /** |
michael@0 | 79 | * Connection information for managing things like js/css |
michael@0 | 80 | * connection blocking, and per-tab connection grouping |
michael@0 | 81 | */ |
michael@0 | 82 | readonly attribute nsILoadGroupConnectionInfo connectionInfo; |
michael@0 | 83 | |
michael@0 | 84 | /** |
michael@0 | 85 | * The set of load flags that will be added to all new requests added to |
michael@0 | 86 | * this group. Any existing requests in the load group are not modified, |
michael@0 | 87 | * so it is expected these flags will be added before requests are added |
michael@0 | 88 | * to the group - typically via nsIDocShell::defaultLoadFlags on a new |
michael@0 | 89 | * docShell. |
michael@0 | 90 | * Note that these flags are *not* added to the default request for the |
michael@0 | 91 | * load group; it is expected the default request will already have these |
michael@0 | 92 | * flags (again, courtesy of setting nsIDocShell::defaultLoadFlags before |
michael@0 | 93 | * the docShell has created the default request.) |
michael@0 | 94 | */ |
michael@0 | 95 | attribute nsLoadFlags defaultLoadFlags; |
michael@0 | 96 | }; |
michael@0 | 97 | |
michael@0 | 98 | %{C++ |
michael@0 | 99 | // Forward-declare mozilla::net::SpdyPushCache |
michael@0 | 100 | namespace mozilla { |
michael@0 | 101 | namespace net { |
michael@0 | 102 | class SpdyPushCache; |
michael@0 | 103 | } |
michael@0 | 104 | } |
michael@0 | 105 | %} |
michael@0 | 106 | |
michael@0 | 107 | [ptr] native SpdyPushCachePtr(mozilla::net::SpdyPushCache); |
michael@0 | 108 | |
michael@0 | 109 | /** |
michael@0 | 110 | * Used to maintain state about the connections of a load group and |
michael@0 | 111 | * how they interact with blocking items like HEAD css/js loads. |
michael@0 | 112 | */ |
michael@0 | 113 | |
michael@0 | 114 | [uuid(fdc9659c-b597-4ac0-9c9e-14b04dbb682f)] |
michael@0 | 115 | interface nsILoadGroupConnectionInfo : nsISupports |
michael@0 | 116 | { |
michael@0 | 117 | /** |
michael@0 | 118 | * Number of active blocking transactions associated with this load group |
michael@0 | 119 | */ |
michael@0 | 120 | readonly attribute unsigned long blockingTransactionCount; |
michael@0 | 121 | |
michael@0 | 122 | /** |
michael@0 | 123 | * Increase the number of active blocking transactions associated |
michael@0 | 124 | * with this load group by one. |
michael@0 | 125 | */ |
michael@0 | 126 | void addBlockingTransaction(); |
michael@0 | 127 | |
michael@0 | 128 | /** |
michael@0 | 129 | * Decrease the number of active blocking transactions associated |
michael@0 | 130 | * with this load group by one. The return value is the number of remaining |
michael@0 | 131 | * blockers. |
michael@0 | 132 | */ |
michael@0 | 133 | unsigned long removeBlockingTransaction(); |
michael@0 | 134 | |
michael@0 | 135 | /* reading this attribute gives out weak pointers to the push |
michael@0 | 136 | * cache. The nsILoadGroupConnectionInfo implemenation owns the cache |
michael@0 | 137 | * and will destroy it when overwritten or when the load group |
michael@0 | 138 | * ends. |
michael@0 | 139 | */ |
michael@0 | 140 | [noscript] attribute SpdyPushCachePtr spdyPushCache; |
michael@0 | 141 | }; |