Back to index

lightning-sunbird  0.9+nobinonly
Defines | Enumerations | Functions
xpcwrappednative.cpp File Reference
#include "xpcprivate.h"
#include "nsCRT.h"
#include "XPCNativeWrapper.h"

Go to the source code of this file.

Defines

#define DEBUG_CheckClassInfoClaims(wrapper)   ((void)0)
#define DEBUG_TrackNewWrapper(wrapper)   ((void)0)
#define DEBUG_TrackDeleteWrapper(wrapper)   ((void)0)
#define DEBUG_TrackWrapperCall(wrapper, mode)   ((void)0)
#define DEBUG_TrackShutdownWrapper(wrapper)   ((void)0)
#define IS_WRAPPER_CLASS(clazz)
#define IS_TEAROFF_CLASS(clazz)   ((clazz) == &XPC_WN_Tearoff_JSClass)
#define PARAM_BUFFER_COUNT   8
#define PARAM_AUTOSTRING_COUNT   1
#define FMT_ADDR   ""
#define FMT_STR(str)
#define PARAM_ADDR(w)

Enumerations

enum  SizeMode { GET_SIZE, GET_LENGTH }

Functions

static JSBool Throw (uintN errNum, XPCCallContext &ccx)
static JSBool GetArraySizeFromParam (XPCCallContext &ccx, nsIInterfaceInfo *ifaceInfo, const nsXPTMethodInfo *methodInfo, const nsXPTParamInfo &paramInfo, uint16 vtblIndex, uint8 paramIndex, SizeMode mode, nsXPTCVariant *dispatchParams, JSUint32 *result)
static JSBool GetInterfaceTypeFromParam (XPCCallContext &ccx, nsIInterfaceInfo *ifaceInfo, const nsXPTMethodInfo *methodInfo, const nsXPTParamInfo &paramInfo, uint16 vtblIndex, uint8 paramIndex, const nsXPTType &datum_type, nsXPTCVariant *dispatchParams, nsID *result)
nsresult UnexpectedFailure (nsresult rv)

Define Documentation

#define DEBUG_CheckClassInfoClaims (   wrapper)    ((void)0)

Definition at line 53 of file xpcwrappednative.cpp.

#define DEBUG_TrackDeleteWrapper (   wrapper)    ((void)0)

Definition at line 199 of file xpcwrappednative.cpp.

#define DEBUG_TrackNewWrapper (   wrapper)    ((void)0)

Definition at line 198 of file xpcwrappednative.cpp.

#define DEBUG_TrackShutdownWrapper (   wrapper)    ((void)0)

Definition at line 201 of file xpcwrappednative.cpp.

#define DEBUG_TrackWrapperCall (   wrapper,
  mode 
)    ((void)0)

Definition at line 200 of file xpcwrappednative.cpp.

#define FMT_ADDR   ""
#define FMT_STR (   str)
#define IS_TEAROFF_CLASS (   clazz)    ((clazz) == &XPC_WN_Tearoff_JSClass)

Definition at line 1161 of file xpcwrappednative.cpp.

#define IS_WRAPPER_CLASS (   clazz)
Value:
((clazz) == &XPC_WN_NoHelper_JSClass.base ||                        \
           (clazz)->getObjectOps == XPC_WN_GetObjectOpsNoCall ||              \
           (clazz)->getObjectOps == XPC_WN_GetObjectOpsWithCall)

Definition at line 1156 of file xpcwrappednative.cpp.

#define PARAM_ADDR (   w)

Enumeration Type Documentation

enum SizeMode
Enumerator:
GET_SIZE 
GET_LENGTH 

Definition at line 1636 of file xpcwrappednative.cpp.


Function Documentation

static JSBool GetArraySizeFromParam ( XPCCallContext ccx,
nsIInterfaceInfo ifaceInfo,
const nsXPTMethodInfo methodInfo,
const nsXPTParamInfo paramInfo,
uint16  vtblIndex,
uint8  paramIndex,
SizeMode  mode,
nsXPTCVariant dispatchParams,
JSUint32 *  result 
) [static]

Definition at line 1641 of file xpcwrappednative.cpp.

{
    uint8 argnum;
    nsresult rv;

    // XXX fixup the various exceptions that are thrown

    if(mode == GET_SIZE)
        rv = ifaceInfo->GetSizeIsArgNumberForParam(vtblIndex, &paramInfo, 0, &argnum);
    else
        rv = ifaceInfo->GetLengthIsArgNumberForParam(vtblIndex, &paramInfo, 0, &argnum);
    if(NS_FAILED(rv))
        return Throw(NS_ERROR_XPC_CANT_GET_ARRAY_INFO, ccx);

    const nsXPTParamInfo& arg_param = methodInfo->GetParam(argnum);
    const nsXPTType& arg_type = arg_param.GetType();

    // The xpidl compiler ensures this. We reaffirm it for safety.
    if(arg_type.IsPointer() || arg_type.TagPart() != nsXPTType::T_U32)
        return Throw(NS_ERROR_XPC_CANT_GET_ARRAY_INFO, ccx);

    *result = dispatchParams[argnum].val.u32;

    return JS_TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static JSBool GetInterfaceTypeFromParam ( XPCCallContext ccx,
nsIInterfaceInfo ifaceInfo,
const nsXPTMethodInfo methodInfo,
const nsXPTParamInfo paramInfo,
uint16  vtblIndex,
uint8  paramIndex,
const nsXPTType datum_type,
nsXPTCVariant dispatchParams,
nsID result 
) [static]

Definition at line 1677 of file xpcwrappednative.cpp.

{
    uint8 argnum;
    nsresult rv;
    uint8 type_tag = datum_type.TagPart();

    // XXX fixup the various exceptions that are thrown

    if(type_tag == nsXPTType::T_INTERFACE)
    {
        rv = ifaceInfo->GetIIDForParamNoAlloc(vtblIndex, &paramInfo, result);
        if(NS_FAILED(rv))
            return ThrowBadParam(NS_ERROR_XPC_CANT_GET_PARAM_IFACE_INFO, paramIndex, ccx);
    }
    else if(type_tag == nsXPTType::T_INTERFACE_IS)
    {
        rv = ifaceInfo->GetInterfaceIsArgNumberForParam(vtblIndex, &paramInfo, &argnum);
        if(NS_FAILED(rv))
            return Throw(NS_ERROR_XPC_CANT_GET_ARRAY_INFO, ccx);

        const nsXPTParamInfo& arg_param = methodInfo->GetParam(argnum);
        const nsXPTType& arg_type = arg_param.GetType();
        
        // The xpidl compiler ensures this. We reaffirm it for safety.
        if(!arg_type.IsPointer() || arg_type.TagPart() != nsXPTType::T_IID)
            return ThrowBadParam(NS_ERROR_XPC_CANT_GET_PARAM_IFACE_INFO, paramIndex, ccx);

        nsID* p = (nsID*) dispatchParams[argnum].val.p;
        if(!p)
            return ThrowBadParam(NS_ERROR_XPC_CANT_GET_PARAM_IFACE_INFO, paramIndex, ccx);
        *result = *p;
    }
    return JS_TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static JSBool Throw ( uintN  errNum,
XPCCallContext ccx 
) [static]

Definition at line 1630 of file xpcwrappednative.cpp.

{
    XPCThrower::Throw(errNum, ccx);
    return JS_FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 2440 of file xpcwrappednative.cpp.

{
    NS_ERROR("This is not supposed to fail!");
    return rv;
}