Bug 1932613 - temporarily disable browser_ml_end_to_end.js for permanent failures...
[gecko.git] / xpcom / components / nsServiceManagerUtils.h
blob4bfbc804ccc0ad61fa06ab0bbc98417c99b0d0c6
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/. */
7 #ifndef nsServiceManagerUtils_h__
8 #define nsServiceManagerUtils_h__
10 #include "nsCOMPtr.h"
11 #include "nsString.h"
13 inline nsGetServiceByCID do_GetService(const nsCID& aCID) {
14 return nsGetServiceByCID(aCID);
17 inline nsGetServiceByCIDWithError do_GetService(const nsCID& aCID,
18 nsresult* aError) {
19 return nsGetServiceByCIDWithError(aCID, aError);
22 inline nsGetServiceByContractID do_GetService(const char* aContractID) {
23 return nsGetServiceByContractID(aContractID);
26 inline nsGetServiceByContractIDWithError do_GetService(const char* aContractID,
27 nsresult* aError) {
28 return nsGetServiceByContractIDWithError(aContractID, aError);
31 nsresult CallGetService(const nsCID& aClass, const nsIID& aIID, void** aResult);
33 nsresult CallGetService(const char* aContractID, const nsIID& aIID,
34 void** aResult);
36 // type-safe shortcuts for calling |GetService|
37 template <class DestinationType>
38 inline nsresult CallGetService(const nsCID& aClass,
39 DestinationType** aDestination) {
40 MOZ_ASSERT(aDestination, "null parameter");
42 return CallGetService(aClass, NS_GET_TEMPLATE_IID(DestinationType),
43 reinterpret_cast<void**>(aDestination));
46 template <class DestinationType>
47 inline nsresult CallGetService(const char* aContractID,
48 DestinationType** aDestination) {
49 MOZ_ASSERT(aContractID, "null parameter");
50 MOZ_ASSERT(aDestination, "null parameter");
52 return CallGetService(aContractID, NS_GET_TEMPLATE_IID(DestinationType),
53 reinterpret_cast<void**>(aDestination));
56 #endif