Bug 1850713: remove duplicated setting of early hint preloader id in `ScriptLoader...
[gecko.git] / xpcom / reflect / xptcall / xptcall.cpp
blob0b28791b542e7dfbb4ee2aaa794d79f0c2c9993f
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;
12 NS_IMETHODIMP
13 nsXPTCStubBase::QueryInterface(REFNSIID aIID, void** aInstancePtr) {
14 if (aIID.Equals(mEntry->IID())) {
15 NS_ADDREF_THIS();
16 *aInstancePtr = static_cast<nsISupports*>(this);
17 return NS_OK;
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);
40 return NS_OK;
43 EXPORT_XPCOM_API(void)
44 NS_DestroyXPTCallStub(nsISomeInterface* aStub) {
45 nsXPTCStubBase* stub = static_cast<nsXPTCStubBase*>(aStub);
46 delete (stub);
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);