Back to index

lightning-sunbird  0.9+nobinonly
Classes | Functions | Variables
xpcom.server.policy Namespace Reference

Classes

class  DefaultClassInfo
class  DefaultPolicy
class  SupportsPrimitive

Functions

def _GetNominatedInterfaces
def GetClassInfoForObject
def _shutdown

Variables

 IID_nsISupports = _xpcom.IID_nsISupports
 IID_nsIVariant = _xpcom.IID_nsIVariant
 XPT_MD_IS_GETTER = xpcom_consts.XPT_MD_IS_GETTER
 XPT_MD_IS_SETTER = xpcom_consts.XPT_MD_IS_SETTER
 VARIANT_INT_TYPES = xpcom_consts.VTYPE_INT8,xpcom_consts.VTYPE_INT16,xpcom_consts.VTYPE_INT32,\
 VARIANT_LONG_TYPES = xpcom_consts.VTYPE_INT64,xpcom_consts.VTYPE_UINT64
 VARIANT_FLOAT_TYPES = xpcom_consts.VTYPE_FLOAT,xpcom_consts.VTYPE_DOUBLE
 VARIANT_STRING_TYPES = xpcom_consts.VTYPE_CHAR,xpcom_consts.VTYPE_CHAR_STR,xpcom_consts.VTYPE_STRING_SIZE_IS,\
 VARIANT_UNICODE_TYPES = xpcom_consts.VTYPE_WCHAR,xpcom_consts.VTYPE_DOMSTRING,xpcom_consts.VTYPE_WSTRING_SIZE_IS,\
dictionary _supports_primitives_map_ = {}
 _interface_sequence_types_ = types.TupleType,types.ListType
 _string_types_ = types.StringType,types.UnicodeType
 XPTI_GetInterfaceInfoManager = _xpcom.XPTI_GetInterfaceInfoManager
dictionary class_info_cache = {}
 ClassInfo support.
list _supports_primitives_data_

Function Documentation

Definition at line 65 of file policy.py.

00065 
00066 def _GetNominatedInterfaces(obj):
00067     ret = getattr(obj, "_com_interfaces_", None)
00068     if ret is None: return None
00069     # See if the user only gave one.
00070     if type(ret) not in _interface_sequence_types_:
00071         ret = [ret]
00072     real_ret = []
00073     # For each interface, walk to the root of the interface tree.
00074     iim = XPTI_GetInterfaceInfoManager()
00075     for interface in ret:
00076         # Allow interface name or IID.
00077         interface_info = None
00078         if type(interface) in _string_types_:
00079             try:
00080                 interface_info = iim.GetInfoForName(interface)
00081             except COMException:
00082                 pass
00083         if interface_info is None:
00084             # Allow a real IID
00085             interface_info = iim.GetInfoForIID(interface)
00086         real_ret.append(interface_info.GetIID())
00087         parent = interface_info.GetParent()
00088         while parent is not None:
00089             parent_iid = parent.GetIID()
00090             if parent_iid == IID_nsISupports:
00091                 break
00092             real_ret.append(parent_iid)
00093             parent = parent.GetParent()
00094     return real_ret

Here is the caller graph for this function:

def xpcom.server.policy._shutdown ( ) [private]

Definition at line 352 of file policy.py.

00352 
00353 def _shutdown():
00354     class_info_cache.clear()

Definition at line 101 of file policy.py.

00101 
00102 def GetClassInfoForObject(ob):
00103     if xpcom.server.tracer_unwrap is not None:
00104         ob = xpcom.server.tracer_unwrap(ob)
00105     klass = ob.__class__
00106     ci = class_info_cache.get(klass)
00107     if ci is None:
00108         ci = DefaultClassInfo(klass)
00109         ci = xpcom.server.WrapObject(ci, _xpcom.IID_nsIClassInfo, bWrapClient = 0)
00110         class_info_cache[klass] = ci
00111     return ci

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

xpcom.server.policy._interface_sequence_types_ = types.TupleType,types.ListType

Definition at line 61 of file policy.py.

xpcom.server.policy._string_types_ = types.StringType,types.UnicodeType

Definition at line 62 of file policy.py.

Initial value:
00001 [
00002     ("nsISupportsCString", "__str__", str),
00003     ("nsISupportsString", "__str__", str),
00004     ("nsISupportsPRUint64", "__long__", long),
00005     ("nsISupportsPRInt64", "__long__", long),
00006     ("nsISupportsPRUint32", "__int__", int),
00007     ("nsISupportsPRInt32", "__int__", int),
00008     ("nsISupportsPRUint16", "__int__", int),
00009     ("nsISupportsPRInt16", "__int__", int),
00010     ("nsISupportsPRUint8", "__int__", int),
00011     ("nsISupportsPRBool", "__nonzero__", operator.truth),
00012     ("nsISupportsDouble", "__float__", float),
00013     ("nsISupportsFloat", "__float__", float),
00014 ]

Definition at line 316 of file policy.py.

Definition at line 59 of file policy.py.

ClassInfo support.

We cache class infos by class

Definition at line 99 of file policy.py.

xpcom.server.policy.IID_nsISupports = _xpcom.IID_nsISupports

Definition at line 45 of file policy.py.

xpcom.server.policy.IID_nsIVariant = _xpcom.IID_nsIVariant

Definition at line 46 of file policy.py.

Definition at line 53 of file policy.py.

Definition at line 50 of file policy.py.

Definition at line 52 of file policy.py.

Definition at line 54 of file policy.py.

Definition at line 56 of file policy.py.

Definition at line 47 of file policy.py.

Definition at line 48 of file policy.py.

Definition at line 63 of file policy.py.