1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4  * License, v. 2.0. If a copy of the MPL was not distributed with this
5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 
7 #ifndef nsInterfaceRequestorAgg_h__
8 #define nsInterfaceRequestorAgg_h__
9 
10 #include "nsError.h"
11 
12 class nsIEventTarget;
13 class nsIInterfaceRequestor;
14 
15 /**
16  * This function returns an instance of nsIInterfaceRequestor that aggregates
17  * two nsIInterfaceRequestor instances.  Its GetInterface method queries
18  * aFirst for the requested interface and will query aSecond only if aFirst
19  * failed to supply the requested interface.  Both aFirst and aSecond may
20  * be null, and will be released on the main thread when the aggregator is
21  * destroyed.
22  */
23 extern nsresult NS_NewInterfaceRequestorAggregation(
24     nsIInterfaceRequestor* aFirst, nsIInterfaceRequestor* aSecond,
25     nsIInterfaceRequestor** aResult);
26 
27 /**
28  * Like the previous method, but aFirst and aSecond will be released on the
29  * provided target thread.
30  */
31 extern nsresult NS_NewInterfaceRequestorAggregation(
32     nsIInterfaceRequestor* aFirst, nsIInterfaceRequestor* aSecond,
33     nsIEventTarget* aTarget, nsIInterfaceRequestor** aResult);
34 
35 #endif  // !defined( nsInterfaceRequestorAgg_h__ )
36