michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsIRequest.idl" michael@0: michael@0: interface nsISimpleEnumerator; michael@0: interface nsIRequestObserver; michael@0: interface nsIInterfaceRequestor; michael@0: interface nsILoadGroupConnectionInfo; michael@0: michael@0: typedef unsigned long nsLoadFlags; michael@0: michael@0: /** michael@0: * A load group maintains a collection of nsIRequest objects. michael@0: */ michael@0: [scriptable, uuid(afb57ac2-bce5-4ee3-bb34-385089a9ba5c)] michael@0: interface nsILoadGroup : nsIRequest michael@0: { michael@0: /** michael@0: * The group observer is notified when requests are added to and removed michael@0: * from this load group. The groupObserver is weak referenced. michael@0: */ michael@0: attribute nsIRequestObserver groupObserver; michael@0: michael@0: /** michael@0: * Accesses the default load request for the group. Each time a number michael@0: * of requests are added to a group, the defaultLoadRequest may be set michael@0: * to indicate that all of the requests are related to a base request. michael@0: * michael@0: * The load group inherits its load flags from the default load request. michael@0: * If the default load request is NULL, then the group's load flags are michael@0: * not changed. michael@0: */ michael@0: attribute nsIRequest defaultLoadRequest; michael@0: michael@0: /** michael@0: * Adds a new request to the group. This will cause the default load michael@0: * flags to be applied to the request. If this is a foreground michael@0: * request then the groupObserver's onStartRequest will be called. michael@0: * michael@0: * If the request is the default load request or if the default load michael@0: * request is null, then the load group will inherit its load flags from michael@0: * the request. michael@0: */ michael@0: void addRequest(in nsIRequest aRequest, michael@0: in nsISupports aContext); michael@0: michael@0: /** michael@0: * Removes a request from the group. If this is a foreground request michael@0: * then the groupObserver's onStopRequest will be called. michael@0: * michael@0: * By the time this call ends, aRequest will have been removed from the michael@0: * loadgroup, even if this function throws an exception. michael@0: */ michael@0: void removeRequest(in nsIRequest aRequest, michael@0: in nsISupports aContext, michael@0: in nsresult aStatus); michael@0: michael@0: /** michael@0: * Returns the requests contained directly in this group. michael@0: * Enumerator element type: nsIRequest. michael@0: */ michael@0: readonly attribute nsISimpleEnumerator requests; michael@0: michael@0: /** michael@0: * Returns the count of "active" requests (ie. requests without the michael@0: * LOAD_BACKGROUND bit set). michael@0: */ michael@0: readonly attribute unsigned long activeCount; michael@0: michael@0: /** michael@0: * Notification callbacks for the load group. michael@0: */ michael@0: attribute nsIInterfaceRequestor notificationCallbacks; michael@0: michael@0: /** michael@0: * Connection information for managing things like js/css michael@0: * connection blocking, and per-tab connection grouping michael@0: */ michael@0: readonly attribute nsILoadGroupConnectionInfo connectionInfo; michael@0: michael@0: /** michael@0: * The set of load flags that will be added to all new requests added to michael@0: * this group. Any existing requests in the load group are not modified, michael@0: * so it is expected these flags will be added before requests are added michael@0: * to the group - typically via nsIDocShell::defaultLoadFlags on a new michael@0: * docShell. michael@0: * Note that these flags are *not* added to the default request for the michael@0: * load group; it is expected the default request will already have these michael@0: * flags (again, courtesy of setting nsIDocShell::defaultLoadFlags before michael@0: * the docShell has created the default request.) michael@0: */ michael@0: attribute nsLoadFlags defaultLoadFlags; michael@0: }; michael@0: michael@0: %{C++ michael@0: // Forward-declare mozilla::net::SpdyPushCache michael@0: namespace mozilla { michael@0: namespace net { michael@0: class SpdyPushCache; michael@0: } michael@0: } michael@0: %} michael@0: michael@0: [ptr] native SpdyPushCachePtr(mozilla::net::SpdyPushCache); michael@0: michael@0: /** michael@0: * Used to maintain state about the connections of a load group and michael@0: * how they interact with blocking items like HEAD css/js loads. michael@0: */ michael@0: michael@0: [uuid(fdc9659c-b597-4ac0-9c9e-14b04dbb682f)] michael@0: interface nsILoadGroupConnectionInfo : nsISupports michael@0: { michael@0: /** michael@0: * Number of active blocking transactions associated with this load group michael@0: */ michael@0: readonly attribute unsigned long blockingTransactionCount; michael@0: michael@0: /** michael@0: * Increase the number of active blocking transactions associated michael@0: * with this load group by one. michael@0: */ michael@0: void addBlockingTransaction(); michael@0: michael@0: /** michael@0: * Decrease the number of active blocking transactions associated michael@0: * with this load group by one. The return value is the number of remaining michael@0: * blockers. michael@0: */ michael@0: unsigned long removeBlockingTransaction(); michael@0: michael@0: /* reading this attribute gives out weak pointers to the push michael@0: * cache. The nsILoadGroupConnectionInfo implemenation owns the cache michael@0: * and will destroy it when overwritten or when the load group michael@0: * ends. michael@0: */ michael@0: [noscript] attribute SpdyPushCachePtr spdyPushCache; michael@0: };