Line data Source code
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 : #include "nsIInterfaceRequestor.h"
8 : #include "nsIInterfaceRequestorUtils.h"
9 :
10 : nsresult
11 676 : nsGetInterface::operator()(const nsIID& aIID, void** aInstancePtr) const
12 : {
13 : nsresult status;
14 :
15 676 : if (mSource) {
16 1324 : nsCOMPtr<nsIInterfaceRequestor> factoryPtr = do_QueryInterface(mSource);
17 662 : if (factoryPtr) {
18 657 : status = factoryPtr->GetInterface(aIID, aInstancePtr);
19 : } else {
20 5 : status = NS_ERROR_NO_INTERFACE;
21 : }
22 : } else {
23 14 : status = NS_ERROR_NULL_POINTER;
24 : }
25 :
26 676 : if (NS_FAILED(status)) {
27 54 : *aInstancePtr = 0;
28 : }
29 676 : if (mErrorPtr) {
30 8 : *mErrorPtr = status;
31 : }
32 676 : return status;
33 : }
|