Back to index

lightning-sunbird  0.9+nobinonly
Functions | Variables
XPCDispParamPropJSClass.cpp File Reference

Implementation for the XPCDispParamPropJSClass class This file contains the implementation of the XPCDispParamPropJSClass class. More...

#include "xpcprivate.h"

Go to the source code of this file.

Functions

XPCDispParamPropJSClassGetParamProp (JSContext *cx, JSObject *obj)
 Helper function to retrieve the parameterized property instance from the JS object's private slot.
 XPC_PP_GetProperty (JSContext *cx, JSObject *obj, jsval id, jsval *vp)
 Handles getting a property via a parameterized property.
 XPC_PP_SetProperty (JSContext *cx, JSObject *obj, jsval id, jsval *vp)
 Handles getting a property via a parameterized property.
 XPC_PP_Finalize (JSContext *cx, JSObject *obj)
 Handles getting a property via a parameterized property.
 XPC_PP_Mark (JSContext *cx, JSObject *obj, void *arg)
 Is called to mark during GC.

Variables

static JSClass ParamPropClass
 Our JSClass used by XPCDispParamPropClass.

Detailed Description

Implementation for the XPCDispParamPropJSClass class This file contains the implementation of the XPCDispParamPropJSClass class.

Definition in file XPCDispParamPropJSClass.cpp.


Function Documentation

XPCDispParamPropJSClass* GetParamProp ( JSContext cx,
JSObject obj 
) [inline]

Helper function to retrieve the parameterized property instance from the JS object's private slot.

Parameters:
cxa JS context
objthe JS object to retrieve the instance from
Returns:
the parameterized property class

Definition at line 53 of file XPCDispParamPropJSClass.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

XPC_PP_Finalize ( JSContext cx,
JSObject obj 
)

Handles getting a property via a parameterized property.

This object is used as part of the parameterized property mechanism. property get requests are forward to our owner and on to IDispatch's Invoke

Parameters:
cxA pointer to a JS context
objThe object to perform the get on
idID of the parameter to get
vpPointer to the return value
Returns:
JSBool JS_TRUE if property was retrieved

Definition at line 131 of file XPCDispParamPropJSClass.cpp.

{
    delete GetParamProp(cx, obj);
}

Here is the call graph for this function:

XPC_PP_GetProperty ( JSContext cx,
JSObject obj,
jsval  id,
jsval vp 
)

Handles getting a property via a parameterized property.

This object is used as part of the parameterized property mechanism. property get requests are forward to our owner and on to IDispatch's Invoke

Parameters:
cxA pointer to a JS context
objThe object to perform the get on
idID of the parameter to get
vpPointer to the return value
Returns:
JSBool JS_TRUE if property was retrieved

Definition at line 71 of file XPCDispParamPropJSClass.cpp.

{
    XPCDispParamPropJSClass* paramProp = GetParamProp(cx, obj);
    JSObject* originalObj = paramProp->GetWrapper()->GetFlatJSObject();
    XPCCallContext ccx(JS_CALLER, cx, originalObj, nsnull, id, 
                       paramProp->GetParams()->GetParamCount(), nsnull, vp);
    return paramProp->Invoke(ccx, XPCDispObject::CALL_GETTER, vp);
}

Here is the call graph for this function:

XPC_PP_Mark ( JSContext cx,
JSObject obj,
void arg 
)

Is called to mark during GC.

Parameters:
cxthe JS context
objthe object being marked
argwe just pass this on
Returns:
0

Definition at line 144 of file XPCDispParamPropJSClass.cpp.

{
    XPCDispParamPropJSClass* paramProp = GetParamProp(cx, obj);
    if(paramProp)
    {
        XPCWrappedNative* wrapper = paramProp->GetWrapper();
        if(wrapper && wrapper->IsValid())
            xpc_MarkForValidWrapper(cx, wrapper, arg);
    }
    return 0;
}

Here is the call graph for this function:

XPC_PP_SetProperty ( JSContext cx,
JSObject obj,
jsval  id,
jsval vp 
)

Handles getting a property via a parameterized property.

This object is used as part of the parameterized property mechanism. property get requests are forward to our owner and on to IDispatch's Invoke

Parameters:
cxA pointer to a JS context
objThe object to perform the get on
idID of the parameter to get
vpPointer to the return value
Returns:
JSBool JS_TRUE if property was retrieved

Definition at line 92 of file XPCDispParamPropJSClass.cpp.

{
    XPCDispParamPropJSClass* paramProp = GetParamProp(cx, obj);
    JSObject* originalObj = paramProp->GetWrapper()->GetFlatJSObject();
    XPCCallContext ccx(JS_CALLER, cx, originalObj, nsnull, id, 
                       paramProp->GetParams()->GetParamCount(), nsnull, vp);
    _variant_t var;
    uintN err;
    if(!XPCDispConvert::JSToCOM(ccx, *vp, var, err))
        return JS_FALSE;
    XPCDispParams* params = paramProp->GetParams();
    params->SetNamedPropID();
    // params will own var
    params->InsertParam(var);
    // Save off the value passed in so we can return it.
    // Invoke resets the value to what ever IDispatch returns, in this
    // case empty, converted to undefined
    jsval retJSVal = *vp;
    AUTO_MARK_JSVAL(ccx, retJSVal);
    if (paramProp->Invoke(ccx, XPCDispObject::CALL_SETTER, vp))
    {
        *vp = retJSVal;
        return JS_TRUE;
    }
    return JS_FALSE;
}

Here is the call graph for this function:


Variable Documentation

Initial value:

Our JSClass used by XPCDispParamPropClass.

See also:
XPCDispParamPropClass

Definition at line 160 of file XPCDispParamPropJSClass.cpp.