AutoMarkingWrappedNativeProtoPtr proto(ccx); ClassInfo2WrappedNativeProtoMap* map; XPCLock* lock; JSBool shared;
const nsIID* iid; if(NS_FAILED(info->GetIIDShared(&iid)) || !iid) return nsnull;
XPCWrappedNativeProto::GetNewOrUsed(XPCCallContext& ccx,                                    XPCWrappedNativeScope* Scope,                                    nsIClassInfo* ClassInfo,                                    const XPCNativeScriptableCreateInfo* ScriptableCreateInfo,                                    JSBool ForceNoSharing){    NS_ASSERTION(Scope, "bad param");    NS_ASSERTION(ClassInfo, "bad param");    AutoMarkingWrappedNativeProtoPtr proto(ccx);    ClassInfo2WrappedNativeProtoMap* map;    XPCLock* lock;    JSBool shared;    JSUint32 ciFlags;    if(NS_FAILED(ClassInfo->GetFlags(&ciFlags)))        ciFlags = 0;    if(ciFlags & XPC_PROTO_DONT_SHARE)    {        NS_ERROR("reserved flag set!");        ciFlags &= ~XPC_PROTO_DONT_SHARE;    }    if(ForceNoSharing || (ciFlags & nsIClassInfo::PLUGIN_OBJECT) ||       (ScriptableCreateInfo &&        ScriptableCreateInfo->GetFlags().DontSharePrototype()))    {        ciFlags |= XPC_PROTO_DONT_SHARE;        shared = JS_FALSE;    }    else    {        shared = JS_TRUE;    }    if(shared)    {        map = Scope->GetWrappedNativeProtoMap();        lock = Scope->GetRuntime()->GetMapLock();        {   // scoped lock            XPCAutoLock al(lock);            proto = map->Find(ClassInfo);            if(proto)                return proto;        }    }    AutoMarkingNativeSetPtr set(ccx);    set = XPCNativeSet::GetNewOrUsed(ccx, ClassInfo);    if(!set)        return nsnull;    proto = new XPCWrappedNativeProto(Scope, ClassInfo, ciFlags, set);    if(!proto || !proto->Init(ccx, ScriptableCreateInfo))    {        delete proto.get();        return nsnull;    }    if(shared)    {   // scoped lock        XPCAutoLock al(lock);        map->Add(ClassInfo, proto);    }    return proto;}