Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/xpcom/reflect/xptcall/xptcall.cpp
Line
Count
Source (jump to first uncovered line)
1
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/. */
5
6
/* entry point wrappers. */
7
8
#include "xptcprivate.h"
9
#include "nsPrintfCString.h"
10
11
using namespace mozilla;
12
13
NS_IMETHODIMP
14
nsXPTCStubBase::QueryInterface(REFNSIID aIID,
15
                               void **aInstancePtr)
16
1.62M
{
17
1.62M
    if (aIID.Equals(mEntry->IID())) {
18
1.62M
        NS_ADDREF_THIS();
19
1.62M
        *aInstancePtr = static_cast<nsISupports*>(this);
20
1.62M
        return NS_OK;
21
1.62M
    }
22
0
23
0
    return mOuter->QueryInterface(aIID, aInstancePtr);
24
0
}
25
26
NS_IMETHODIMP_(MozExternalRefCountType)
27
nsXPTCStubBase::AddRef()
28
1.62M
{
29
1.62M
    return mOuter->AddRef();
30
1.62M
}
31
32
NS_IMETHODIMP_(MozExternalRefCountType)
33
nsXPTCStubBase::Release()
34
1.62M
{
35
1.62M
    return mOuter->Release();
36
1.62M
}
37
38
EXPORT_XPCOM_API(nsresult)
39
NS_GetXPTCallStub(REFNSIID aIID, nsIXPTCProxy* aOuter,
40
                  nsISomeInterface* *aResult)
41
3
{
42
3
    if (NS_WARN_IF(!aOuter) || NS_WARN_IF(!aResult))
43
3
        return NS_ERROR_INVALID_ARG;
44
3
45
3
    const nsXPTInterfaceInfo* iie = nsXPTInterfaceInfo::ByIID(aIID);
46
3
    if (!iie || !iie->EnsureResolved() || iie->IsBuiltinClass())
47
0
        return NS_ERROR_FAILURE;
48
3
49
3
    *aResult = new nsXPTCStubBase(aOuter, iie);
50
3
    return NS_OK;
51
3
}
52
53
EXPORT_XPCOM_API(void)
54
NS_DestroyXPTCallStub(nsISomeInterface* aStub)
55
0
{
56
0
    nsXPTCStubBase* stub = static_cast<nsXPTCStubBase*>(aStub);
57
0
    delete(stub);
58
0
}
59
60
EXPORT_XPCOM_API(size_t)
61
NS_SizeOfIncludingThisXPTCallStub(const nsISomeInterface* aStub,
62
                                  mozilla::MallocSizeOf aMallocSizeOf)
63
0
{
64
0
    // We could cast aStub to nsXPTCStubBase, but that class doesn't seem to own anything,
65
0
    // so just measure the size of the object itself.
66
0
    return aMallocSizeOf(aStub);
67
0
}