예제 #1
0
def WrapObject(ob, iid, policy=None, bWrapClient=1):
    """Called by the framework to attempt to wrap
    an object in a policy.
    If iid is None, it will use the first interface the object indicates it supports.
    """
    if policy is None:
        policy = DefaultPolicy
    if tracer is not None:
        ob = tracer(ob)
    return _xpcom.WrapObject(policy(ob, iid), iid, bWrapClient)
예제 #2
0
    def createInstance(self, outer, iid):
        if self.klass is TimelineComponentLoader:
            # short circuit for loader
            ret = factory.Factory.createInstance(self, outer, iid)
            ret = _xpcom.WrapObject(DefaultPolicy(ret, iid), iid, 0)
            timeline.mark("PyXPCOM component loader ready to rock")
            return ret

        klass = self.klass
        this_name = "%s.%s" % (klass.__module__, klass.__name__)
        enter_name = "constructing " + this_name
        timer_name = "PyXPCOM component creation"
        timeline.enter(enter_name)
        timeline.startTimer(timer_name)
        try:
            return factory.Factory.createInstance(self, outer, iid)
        finally:
            timeline.stopTimer(timer_name)
            timeline.leave(enter_name)
            timeline.markTimer(timer_name, this_name)
예제 #3
0
def NS_GetModule(serviceManager, nsIFile):
    mod = Module([TimelineComponentLoader])
    # wrap it manually to avoid our tracer
    iid = _xpcom.IID_nsIModule
    mod = _xpcom.WrapObject(DefaultPolicy(mod, iid), iid, 0)
    return mod
예제 #4
0
 def getClassObject(self, compMgr, clsid, iid):
     ret = module.Module.getClassObject(self, compMgr, clsid, iid)
     ret = _xpcom.WrapObject(DefaultPolicy(ret, iid), iid, 0)
     return ret