Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Functions | Variables
XPCDispPrivate.h File Reference

Contains all the private class declarations. More...

#include <atlbase.h>
#include <comdef.h>
#include "objsafe.h"
#include "nsIDispatchSupport.h"
#include "XPCDispInlines.h"

Go to the source code of this file.

Classes

class  XPCDispConvert
 JS<>COM Conversion functions. More...
class  XPCDispNameArray
 This class holds an array of names. More...
class  XPCDispIDArray
 This class represents an array of JSID's. More...
class  XPCDispTypeInfo
 Implements ITypeInfo interface for JSObjects. More...
class  XPCDispTypeInfo::FuncDescArray
 Manages an array of FUNCDESC structs. More...
class  XPCDispJSPropertyInfo
 Helper class that describes a JS function or property. More...
class  XPCDispatchTearOff
 Tearoff for nsXPCWrappedJS to use. More...
class  XPCDispInterface
 IDispatch interface information. More...
class  XPCDispInterface::Member
 Member information. More...
class  XPCDispInterface::Member::ParamInfo
 Parameter Information. More...
class  XPCDispInterface::Allocator
 Small utility to count members needed for XPConnect XPConnect has one entry for a property while IDispatch can have two Generally interfaces are small enough, that linear searching should be ok. More...
class  XPCDispObject
 Used to invoke IDispatch methods This has turned into kind of a catch all, and probably should be cleaned up. More...
class  XPCIDispatchExtension
class  XPCDispParams
 This is a helper class that factored out the parameter cleanup code. More...
class  XPCDispParamPropJSClass
 Parameterized property object JSClass This class is used to support parameterized properties for IDispatch. More...
class  nsDispatchSupport
 This class is a service that exposes some handy utility methods for IDispatch users. More...
class  XPCIDispatchClassInfo
 Provides class info for IDispatch based objects. More...

Defines

#define NS_DECL_IUNKNOWN
 Needed for CComPtr and friends.
#define NS_IMPL_COM_QUERY_HEAD(_class)
#define NS_IMPL_COM_QUERY_BODY(_interface)
#define NS_IMPL_COM_QUERY_TAIL_GUTS
#define NS_COM_MAP_BEGIN(_implClass)   NS_IMPL_COM_QUERY_HEAD(_implClass)
#define NS_COM_MAP_ENTRY(_interface)   NS_IMPL_COM_QUERY_BODY(_interface)
#define NS_COM_MAP_END   NS_IMPL_COM_QUERY_TAIL_GUTS
#define NS_COM_IMPL_ADDREF(_class)
#define NS_COM_IMPL_RELEASE(_class)

Functions

JSBool JS_DLL_CALLBACK XPC_IDispatch_CallMethod (JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *vp)
 JS callback function that is called when a function is invoked.
JSBool JS_DLL_CALLBACK XPC_IDispatch_GetterSetter (JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *vp)
 JS callback function that is called when a getter/setter is invoked.

Variables

const nsID NSID_IDISPATCH
 This is COM's IDispatch IID, but in XPCOM's nsID type.

Detailed Description

Contains all the private class declarations.

Definition in file XPCDispPrivate.h.


Define Documentation

#define NS_COM_IMPL_ADDREF (   _class)
Value:
STDMETHODIMP_(ULONG) _class::AddRef(void)                                     \
{                                                                             \
  NS_PRECONDITION(PRInt32(mRefCnt) >= 0, "illegal refcnt");                   \
  NS_ASSERT_OWNINGTHREAD(_class);                                             \
  ++mRefCnt;                                                                  \
  NS_LOG_ADDREF(this, mRefCnt, #_class, sizeof(*this));                       \
  return mRefCnt;                                                             \
}

Definition at line 115 of file XPCDispPrivate.h.

#define NS_COM_IMPL_RELEASE (   _class)
Value:
STDMETHODIMP_(ULONG) _class::Release(void)                                    \
{                                                                             \
  NS_PRECONDITION(0 != mRefCnt, "dup release");                               \
  NS_ASSERT_OWNINGTHREAD(_class);                                             \
  --mRefCnt;                                                                  \
  NS_LOG_RELEASE(this, mRefCnt, #_class);                                     \
  if(mRefCnt == 0) {                                                         \
    mRefCnt = 1; /* stabilize */                                              \
    delete this;                                                              \
    return 0;                                                                 \
  }                                                                           \
  return mRefCnt;                                                             \
}

Definition at line 125 of file XPCDispPrivate.h.

#define NS_COM_MAP_BEGIN (   _implClass)    NS_IMPL_COM_QUERY_HEAD(_implClass)

Definition at line 111 of file XPCDispPrivate.h.

Definition at line 113 of file XPCDispPrivate.h.

#define NS_COM_MAP_ENTRY (   _interface)    NS_IMPL_COM_QUERY_BODY(_interface)

Definition at line 112 of file XPCDispPrivate.h.

Value:
public:                                                                       \
  STDMETHOD(QueryInterface)(REFIID aIID,                                      \
                            void** aInstancePtr);                             \
  STDMETHODIMP_(ULONG) AddRef(void);                                          \
  STDMETHODIMP_(ULONG) Release(void);                                         \
protected:                                                                    \
  ULONG mRefCnt;

Needed for CComPtr and friends.

Needed for _variant_t and _bstr_t IObjectSafety interface and friends

Definition at line 74 of file XPCDispPrivate.h.

#define NS_IMPL_COM_QUERY_BODY (   _interface)
Value:
if(IsEqualIID(aIID, __uuidof(_interface)) )                                 \
    foundInterface = NS_STATIC_CAST(_interface*, this);                       \
  else

Definition at line 92 of file XPCDispPrivate.h.

Value:
STDMETHODIMP _class::QueryInterface(REFIID aIID, void** aInstancePtr)         \
{                                                                             \
  NS_ASSERTION(aInstancePtr,                                                  \
               "QueryInterface requires a non-NULL destination!");            \
  if( !aInstancePtr )                                                         \
    return E_POINTER;                                                         \
  IUnknown* foundInterface;

Definition at line 83 of file XPCDispPrivate.h.

Value:
foundInterface = 0;                                                       \
  HRESULT status;                                                             \
  if( !foundInterface )                                                       \
    status = E_NOINTERFACE;                                                   \
  else                                                                        \
    {                                                                         \
      NS_ADDREF(foundInterface);                                              \
      status = S_OK;                                                          \
    }                                                                         \
  *aInstancePtr = foundInterface;                                             \
  return status;                                                              \
}

Definition at line 97 of file XPCDispPrivate.h.


Function Documentation

JSBool JS_DLL_CALLBACK XPC_IDispatch_CallMethod ( JSContext cx,
JSObject obj,
uintN  argc,
jsval argv,
jsval vp 
)

JS callback function that is called when a function is invoked.

Parameters:
cxthe JS context the function is invoked with
objthe object the function is invoked on
argcthe number of parameters passed to the function
argvthe array of parameters passed to the function
vpholds the result of the function
Returns:
true if the function completes without error

JS callback function that is called when a function is invoked.

Parameters:
cxA pointer to a JS context
objJS object that the parameterized property is on
argcNumber of arguments in this call
argvThe parameters passed in if any
vpThe return value
Returns:
Returns JS_TRUE if the operation succeeded

Definition at line 462 of file XPCDispObject.cpp.

{
    NS_ASSERTION(JS_TypeOfValue(cx, argv[-2]) == JSTYPE_FUNCTION, "bad function");
    JSObject* funobj = JSVAL_TO_OBJECT(argv[-2]);
    XPCCallContext ccx(JS_CALLER, cx, obj, funobj, 0, argc, argv, vp);
    XPCWrappedNative* wrapper = ccx.GetWrapper();
    THROW_AND_RETURN_IF_BAD_WRAPPER(cx, wrapper);
    ccx.SetArgsAndResultPtr(argc, argv, vp);

    XPCDispInterface::Member* member;
    XPCNativeInterface* iface;
#ifdef DEBUG
    PRBool ok =
#endif
    GetMember(ccx, funobj, iface, member);
    NS_ASSERTION(ok, "GetMember faild in XPC_IDispatch_CallMethod");
    ccx.SetIDispatchInfo(iface, member);

    return XPCDispObject::Invoke(ccx, XPCDispObject::CALL_METHOD);
}

Here is the call graph for this function:

Here is the caller graph for this function:

JSBool JS_DLL_CALLBACK XPC_IDispatch_GetterSetter ( JSContext cx,
JSObject obj,
uintN  argc,
jsval argv,
jsval vp 
)

JS callback function that is called when a getter/setter is invoked.

Parameters:
cxthe JS context the function is invoked with
objthe object the function is invoked on
argcthe number of parameters passed to the function
argvthe array of parameters passed to the function
vpholds the result of the function
Returns:
true if the function completes without error

JS callback function that is called when a getter/setter is invoked.

Parameters:
cxA pointer to a JS context
objJS object that the parameterized property is on
argcNumber of arguments in this call
argvThe parameters passed in if any
vpThe return value
Returns:
Returns JS_TRUE if the operation succeeded

Definition at line 496 of file XPCDispObject.cpp.

{
    NS_ASSERTION(JS_TypeOfValue(cx, argv[-2]) == JSTYPE_FUNCTION, "bad function");
    JSObject* funobj = JSVAL_TO_OBJECT(argv[-2]);

    XPCCallContext ccx(JS_CALLER, cx, obj, funobj);
    XPCWrappedNative* wrapper = ccx.GetWrapper();
    THROW_AND_RETURN_IF_BAD_WRAPPER(cx, wrapper);

    ccx.SetArgsAndResultPtr(argc, argv, vp);
    XPCDispInterface::Member* member;
    XPCNativeInterface* iface;
#ifdef DEBUG
    PRBool ok =
#endif
    GetMember(ccx, funobj, iface, member);
    NS_ASSERTION(ok, "GetMember faild in XPC_IDispatch_CallMethod");

    ccx.SetIDispatchInfo(iface, member);
    return XPCDispObject::Invoke(ccx, argc != 0 ? XPCDispObject::CALL_SETTER : XPCDispObject::CALL_GETTER);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

This is COM's IDispatch IID, but in XPCOM's nsID type.

Definition at line 49 of file XPCDispObject.cpp.