Bug 1867190 - Add prefs for PHC probablities r=glandium
[gecko.git] / xpcom / base / nsIInterfaceRequestorUtils.cpp
blob44dd51921ddc26877d365d059830f427ef7ae338
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 #include "nsIInterfaceRequestor.h"
8 #include "nsIInterfaceRequestorUtils.h"
10 nsresult nsGetInterface::operator()(const nsIID& aIID,
11 void** aInstancePtr) const {
12 nsresult status;
14 if (mSource) {
15 nsCOMPtr<nsIInterfaceRequestor> factoryPtr = do_QueryInterface(mSource);
16 if (factoryPtr) {
17 status = factoryPtr->GetInterface(aIID, aInstancePtr);
18 } else {
19 status = NS_ERROR_NO_INTERFACE;
21 } else {
22 status = NS_ERROR_NULL_POINTER;
25 if (NS_FAILED(status)) {
26 *aInstancePtr = 0;
28 if (mErrorPtr) {
29 *mErrorPtr = status;
31 return status;