/src/mozilla-central/xpcom/base/nsIInterfaceRequestorUtils.cpp
Line | Count | Source (jump to first uncovered line) |
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 | | nsGetInterface::operator()(const nsIID& aIID, void** aInstancePtr) const |
12 | 0 | { |
13 | 0 | nsresult status; |
14 | 0 |
|
15 | 0 | if (mSource) { |
16 | 0 | nsCOMPtr<nsIInterfaceRequestor> factoryPtr = do_QueryInterface(mSource); |
17 | 0 | if (factoryPtr) { |
18 | 0 | status = factoryPtr->GetInterface(aIID, aInstancePtr); |
19 | 0 | } else { |
20 | 0 | status = NS_ERROR_NO_INTERFACE; |
21 | 0 | } |
22 | 0 | } else { |
23 | 0 | status = NS_ERROR_NULL_POINTER; |
24 | 0 | } |
25 | 0 |
|
26 | 0 | if (NS_FAILED(status)) { |
27 | 0 | *aInstancePtr = 0; |
28 | 0 | } |
29 | 0 | if (mErrorPtr) { |
30 | 0 | *mErrorPtr = status; |
31 | 0 | } |
32 | 0 | return status; |
33 | 0 | } |