1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 /* entry point wrappers. */
8 #include "xptcprivate.h"
10 using namespace mozilla
;
13 nsXPTCStubBase::QueryInterface(REFNSIID aIID
, void** aInstancePtr
) {
14 if (aIID
.Equals(mEntry
->IID())) {
16 *aInstancePtr
= static_cast<nsISupports
*>(this);
20 return mOuter
->QueryInterface(aIID
, aInstancePtr
);
23 NS_IMETHODIMP_(MozExternalRefCountType
)
24 nsXPTCStubBase::AddRef() { return mOuter
->AddRef(); }
26 NS_IMETHODIMP_(MozExternalRefCountType
)
27 nsXPTCStubBase::Release() { return mOuter
->Release(); }
29 EXPORT_XPCOM_API(nsresult
)
30 NS_GetXPTCallStub(REFNSIID aIID
, nsIXPTCProxy
* aOuter
,
31 nsISomeInterface
** aResult
) {
32 if (NS_WARN_IF(!aOuter
) || NS_WARN_IF(!aResult
)) return NS_ERROR_INVALID_ARG
;
34 const nsXPTInterfaceInfo
* iie
= nsXPTInterfaceInfo::ByIID(aIID
);
35 if (!iie
|| iie
->IsBuiltinClass()) {
36 return NS_ERROR_FAILURE
;
39 *aResult
= new nsXPTCStubBase(aOuter
, iie
);
43 EXPORT_XPCOM_API(void)
44 NS_DestroyXPTCallStub(nsISomeInterface
* aStub
) {
45 nsXPTCStubBase
* stub
= static_cast<nsXPTCStubBase
*>(aStub
);
49 EXPORT_XPCOM_API(size_t)
50 NS_SizeOfIncludingThisXPTCallStub(const nsISomeInterface
* aStub
,
51 mozilla::MallocSizeOf aMallocSizeOf
) {
52 // We could cast aStub to nsXPTCStubBase, but that class doesn't seem to own
53 // anything, so just measure the size of the object itself.
54 return aMallocSizeOf(aStub
);