Back to index

lightning-sunbird  0.9+nobinonly
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
xptiInterfaceEntry Class Reference

#include <xptiprivate.h>

Collaboration diagram for xptiInterfaceEntry:
Collaboration graph
[legend]

List of all members.

Public Types

enum  { NOT_RESOLVED = 0, PARTIALLY_RESOLVED = 1, FULLY_RESOLVED = 2, RESOLVE_FAILED = 3 }
enum  { SCRIPTABLE = 4 }

Public Member Functions

uint8 GetResolveState () const
PRBool IsFullyResolved () const
PRBool HasInterfaceRecord () const
const xptiTypelibGetTypelibRecord () const
xptiInterfaceGutsGetInterfaceGuts () const
void SetScriptableFlag (PRBool on)
PRBool GetScriptableFlag () const
const nsIDGetTheIID () const
const char * GetTheName () const
PRBool EnsureResolved (xptiWorkingSet *aWorkingSet=nsnull)
PRBool PartiallyResolveLocked (XPTInterfaceDescriptor *aDescriptor, xptiWorkingSet *aWorkingSet)
nsresult GetInterfaceInfo (xptiInterfaceInfo **info)
PRBool InterfaceInfoEquals (const xptiInterfaceInfo *info) const
void LockedInvalidateInterfaceInfo ()
void LockedInterfaceInfoDeathNotification ()
nsresult GetName (char **aName)
nsresult GetIID (nsIID **aIID)
nsresult IsScriptable (PRBool *_retval)
nsresult GetMethodCount (PRUint16 *aMethodCount)
nsresult GetConstantCount (PRUint16 *aConstantCount)
nsresult GetMethodInfo (PRUint16 index, const nsXPTMethodInfo **info)
nsresult GetMethodInfoForName (const char *methodName, PRUint16 *index, const nsXPTMethodInfo **info)
nsresult GetConstant (PRUint16 index, const nsXPTConstant **constant)
nsresult GetInfoForParam (PRUint16 methodIndex, const nsXPTParamInfo *param, nsIInterfaceInfo **_retval)
nsresult GetIIDForParam (PRUint16 methodIndex, const nsXPTParamInfo *param, nsIID **_retval)
nsresult GetTypeForParam (PRUint16 methodIndex, const nsXPTParamInfo *param, PRUint16 dimension, nsXPTType *_retval)
nsresult GetSizeIsArgNumberForParam (PRUint16 methodIndex, const nsXPTParamInfo *param, PRUint16 dimension, PRUint8 *_retval)
nsresult GetLengthIsArgNumberForParam (PRUint16 methodIndex, const nsXPTParamInfo *param, PRUint16 dimension, PRUint8 *_retval)
nsresult GetInterfaceIsArgNumberForParam (PRUint16 methodIndex, const nsXPTParamInfo *param, PRUint8 *_retval)
nsresult IsIID (const nsIID *IID, PRBool *_retval)
nsresult GetNameShared (const char **name)
nsresult GetIIDShared (const nsIID **iid)
nsresult IsFunction (PRBool *_retval)
nsresult HasAncestor (const nsIID *iid, PRBool *_retval)
nsresult GetIIDForParamNoAlloc (PRUint16 methodIndex, const nsXPTParamInfo *param, nsIID *iid)

Static Public Member Functions

static xptiInterfaceEntryNewEntry (const char *name, int nameLength, const nsID &iid, const xptiTypelib &typelib, xptiWorkingSet *aWorkingSet)
static xptiInterfaceEntryNewEntry (const xptiInterfaceEntry &r, const xptiTypelib &typelib, xptiWorkingSet *aWorkingSet)

Private Member Functions

 xptiInterfaceEntry ()
 xptiInterfaceEntry (const char *name, size_t nameLength, const nsID &iid, const xptiTypelib &typelib)
 xptiInterfaceEntry (const xptiInterfaceEntry &r, size_t nameLength, const xptiTypelib &typelib)
 ~xptiInterfaceEntry ()
voidoperator new (size_t, void *p) CPP_THROW_NEW
void SetResolvedState (int state)
PRBool Resolve (xptiWorkingSet *aWorkingSet=nsnull)
PRBool EnsureResolvedLocked (xptiWorkingSet *aWorkingSet=nsnull)
PRBool ResolveLocked (xptiWorkingSet *aWorkingSet=nsnull)
nsresult GetEntryForParam (PRUint16 methodIndex, const nsXPTParamInfo *param, xptiInterfaceEntry **entry)
nsresult GetTypeInArray (const nsXPTParamInfo *param, uint16 dimension, const XPTTypeDescriptor **type)

Private Attributes

nsID mIID
union {
xptiTypelib mTypelib
xptiInterfaceGutsmInterface
}; 
xptiInterfaceInfomInfo
xptiInfoFlags mFlags
char mName [1]

Detailed Description

Definition at line 530 of file xptiprivate.h.


Member Enumeration Documentation

anonymous enum
Enumerator:
NOT_RESOLVED 
PARTIALLY_RESOLVED 
FULLY_RESOLVED 
RESOLVE_FAILED 

Definition at line 543 of file xptiprivate.h.

anonymous enum
Enumerator:
SCRIPTABLE 

Definition at line 551 of file xptiprivate.h.

{SCRIPTABLE = 4};

Constructor & Destructor Documentation

Here is the caller graph for this function:

xptiInterfaceEntry::xptiInterfaceEntry ( const char *  name,
size_t  nameLength,
const nsID iid,
const xptiTypelib typelib 
) [private]

Definition at line 117 of file xptiInterfaceInfo.cpp.

    :   mIID(iid),
        mTypelib(typelib),
        mInfo(nsnull),
        mFlags(uint8(0))
{
    memcpy(mName, name, nameLength);
}

Here is the call graph for this function:

xptiInterfaceEntry::xptiInterfaceEntry ( const xptiInterfaceEntry r,
size_t  nameLength,
const xptiTypelib typelib 
) [private]

Definition at line 129 of file xptiInterfaceInfo.cpp.

Here is the call graph for this function:


Member Function Documentation

Definition at line 589 of file xptiprivate.h.

        {return IsFullyResolved() ? PR_TRUE : Resolve(aWorkingSet);}

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool xptiInterfaceEntry::EnsureResolvedLocked ( xptiWorkingSet aWorkingSet = nsnull) [inline, private]

Definition at line 654 of file xptiprivate.h.

        {return IsFullyResolved() ? PR_TRUE : ResolveLocked(aWorkingSet);}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 371 of file xptiInterfaceInfo.cpp.

{
    if(!EnsureResolved())
        return NS_ERROR_UNEXPECTED;

    if(index < mInterface->mConstantBaseIndex)
        return mInterface->mParent->GetConstant(index, constant);

    if(index >= mInterface->mConstantBaseIndex + 
                mInterface->mDescriptor->num_constants)
    {
        NS_PRECONDITION(0, "bad param");
        *constant = NULL;
        return NS_ERROR_INVALID_ARG;
    }

    // else...
    *constant =
        NS_REINTERPRET_CAST(nsXPTConstant*,
                            &mInterface->mDescriptor->
                                const_descriptors[index -
                                    mInterface->mConstantBaseIndex]);
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 304 of file xptiInterfaceInfo.cpp.

{
    if(!EnsureResolved())
        return NS_ERROR_UNEXPECTED;

    *count = mInterface->mConstantBaseIndex + 
             mInterface->mDescriptor->num_constants;
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult xptiInterfaceEntry::GetEntryForParam ( PRUint16  methodIndex,
const nsXPTParamInfo param,
xptiInterfaceEntry **  entry 
) [private]

Definition at line 399 of file xptiInterfaceInfo.cpp.

{
    if(!EnsureResolved())
        return NS_ERROR_UNEXPECTED;

    if(methodIndex < mInterface->mMethodBaseIndex)
        return mInterface->mParent->GetEntryForParam(methodIndex, param, entry);

    if(methodIndex >= mInterface->mMethodBaseIndex + 
                      mInterface->mDescriptor->num_methods)
    {
        NS_ERROR("bad param");
        return NS_ERROR_INVALID_ARG;
    }

    const XPTTypeDescriptor *td = &param->type;

    while (XPT_TDP_TAG(td->prefix) == TD_ARRAY) {
        td = &mInterface->mDescriptor->additional_types[td->type.additional_type];
    }

    if(XPT_TDP_TAG(td->prefix) != TD_INTERFACE_TYPE) {
        NS_ERROR("not an interface");
        return NS_ERROR_INVALID_ARG;
    }

    xptiInterfaceEntry* theEntry = 
            mInterface->mWorkingSet->GetTypelibGuts(mInterface->mTypelib)->
                GetEntryAt(td->type.iface - 1);
    
    // This can happen if a declared interface is not available at runtime.
    if(!theEntry)
    {
        NS_WARNING("Declared InterfaceInfo not found");
        *entry = nsnull;
        return NS_ERROR_FAILURE;
    }

    *entry = theEntry;
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 266 of file xptiInterfaceInfo.cpp.

{
    // It is not necessary to Resolve because this info is read from manifest.
    *iid = (nsIID*) nsMemory::Clone(&mIID, sizeof(nsIID));
    return *iid ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult xptiInterfaceEntry::GetIIDForParam ( PRUint16  methodIndex,
const nsXPTParamInfo param,
nsIID **  _retval 
)

Definition at line 463 of file xptiInterfaceInfo.cpp.

{
    xptiInterfaceEntry* entry;
    nsresult rv = GetEntryForParam(methodIndex, param, &entry);
    if(NS_FAILED(rv))
        return rv;
    return entry->GetIID(iid);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 474 of file xptiInterfaceInfo.cpp.

{
    xptiInterfaceEntry* entry;
    nsresult rv = GetEntryForParam(methodIndex, param, &entry);
    if(NS_FAILED(rv))
        return rv;
    *iid = entry->mIID;    
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 690 of file xptiInterfaceInfo.cpp.

{
    // It is not necessary to Resolve because this info is read from manifest.
    *iid = &mIID;
    return NS_OK;
}

Here is the caller graph for this function:

Definition at line 444 of file xptiInterfaceInfo.cpp.

{
    xptiInterfaceEntry* entry;
    nsresult rv = GetEntryForParam(methodIndex, param, &entry);
    if(NS_FAILED(rv))
        return rv;

    xptiInterfaceInfo* theInfo;
    rv = entry->GetInterfaceInfo(&theInfo);    
    if(NS_FAILED(rv))
        return rv;

    *info = NS_STATIC_CAST(nsIInterfaceInfo*, theInfo);
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 565 of file xptiprivate.h.

        {return HasInterfaceRecord() ? mInterface : nsnull;}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 722 of file xptiInterfaceInfo.cpp.

{
    nsAutoMonitor lock(xptiInterfaceInfoManager::GetInfoMonitor());
    LOG_INFO_MONITOR_ENTRY;

#ifdef SHOW_INFO_COUNT_STATS
    static int callCount = 0;
    if(!(++callCount%100))
        printf("iiii %d xptiInterfaceInfos currently alive\n", DEBUG_CurrentInfos);       
#endif

    if(!mInfo)
    {
        mInfo = new xptiInterfaceInfo(this);
        if(!mInfo)
        {
            *info = nsnull;    
            return NS_ERROR_OUT_OF_MEMORY;
        }
    }
    
    NS_ADDREF(*info = mInfo);
    return NS_OK;    
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 636 of file xptiInterfaceInfo.cpp.

{
    if(!EnsureResolved())
        return NS_ERROR_UNEXPECTED;

    if(methodIndex < mInterface->mMethodBaseIndex)
        return mInterface->mParent->
            GetInterfaceIsArgNumberForParam(methodIndex, param, argnum);

    if(methodIndex >= mInterface->mMethodBaseIndex + 
                      mInterface->mDescriptor->num_methods)
    {
        NS_ERROR("bad index");
        return NS_ERROR_INVALID_ARG;
    }

    const XPTTypeDescriptor *td = &param->type;

    while (XPT_TDP_TAG(td->prefix) == TD_ARRAY) {
        td = &mInterface->mDescriptor->
                                additional_types[td->type.additional_type];
    }

    if(XPT_TDP_TAG(td->prefix) != TD_INTERFACE_IS_TYPE) {
        NS_ERROR("not an iid_is");
        return NS_ERROR_INVALID_ARG;
    }

    *argnum = td->argnum;
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 590 of file xptiInterfaceInfo.cpp.

{
    if(!EnsureResolved())
        return NS_ERROR_UNEXPECTED;

    if(methodIndex < mInterface->mMethodBaseIndex)
        return mInterface->mParent->
            GetLengthIsArgNumberForParam(methodIndex, param, dimension, argnum);

    if(methodIndex >= mInterface->mMethodBaseIndex + 
                      mInterface->mDescriptor->num_methods)
    {
        NS_ERROR("bad index");
        return NS_ERROR_INVALID_ARG;
    }

    const XPTTypeDescriptor *td;

    if(dimension) {
        nsresult rv = GetTypeInArray(param, dimension, &td);
        if(NS_FAILED(rv)) {
            return rv;
        }
    }
    else
        td = &param->type;

    // verify that this is a type that has length_is
    switch (XPT_TDP_TAG(td->prefix)) {
      case TD_ARRAY:
      case TD_PSTRING_SIZE_IS:
      case TD_PWSTRING_SIZE_IS:
        break;
      default:
        NS_ERROR("not a length_is");
        return NS_ERROR_INVALID_ARG;
    }

    *argnum = td->argnum2;
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 293 of file xptiInterfaceInfo.cpp.

{
    if(!EnsureResolved())
        return NS_ERROR_UNEXPECTED;
    
    *count = mInterface->mMethodBaseIndex + 
             mInterface->mDescriptor->num_methods;
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 315 of file xptiInterfaceInfo.cpp.

{
    if(!EnsureResolved())
        return NS_ERROR_UNEXPECTED;

    if(index < mInterface->mMethodBaseIndex)
        return mInterface->mParent->GetMethodInfo(index, info);

    if(index >= mInterface->mMethodBaseIndex + 
                mInterface->mDescriptor->num_methods)
    {
        NS_ERROR("bad param");
        *info = NULL;
        return NS_ERROR_INVALID_ARG;
    }

    // else...
    *info = NS_REINTERPRET_CAST(nsXPTMethodInfo*,
                                &mInterface->mDescriptor->
                                    method_descriptors[index - 
                                        mInterface->mMethodBaseIndex]);
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult xptiInterfaceEntry::GetMethodInfoForName ( const char *  methodName,
PRUint16 index,
const nsXPTMethodInfo **  info 
)

Definition at line 340 of file xptiInterfaceInfo.cpp.

{
    if(!EnsureResolved())
        return NS_ERROR_UNEXPECTED;

    // This is a slow algorithm, but this is not expected to be called much.
    for(uint16 i = 0; i < mInterface->mDescriptor->num_methods; ++i)
    {
        const nsXPTMethodInfo* info;
        info = NS_REINTERPRET_CAST(nsXPTMethodInfo*,
                                   &mInterface->mDescriptor->
                                        method_descriptors[i]);
        if (PL_strcmp(methodName, info->GetName()) == 0) {
            *index = i + mInterface->mMethodBaseIndex;
            *result = info;
            return NS_OK;
        }
    }
    
    if(mInterface->mParent)
        return mInterface->mParent->GetMethodInfoForName(methodName, index, result);
    else
    {
        *index = 0;
        *result = 0;
        return NS_ERROR_INVALID_ARG;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 258 of file xptiInterfaceInfo.cpp.

{
    // It is not necessary to Resolve because this info is read from manifest.
    *name = (char*) nsMemory::Clone(mName, PL_strlen(mName)+1);
    return *name ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 681 of file xptiInterfaceInfo.cpp.

{
    // It is not necessary to Resolve because this info is read from manifest.
    *name = mName;
    return NS_OK;
}

Here is the caller graph for this function:

Definition at line 553 of file xptiprivate.h.

{return mFlags.GetState();}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 583 of file xptiprivate.h.

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult xptiInterfaceEntry::GetSizeIsArgNumberForParam ( PRUint16  methodIndex,
const nsXPTParamInfo param,
PRUint16  dimension,
PRUint8 _retval 
)

Definition at line 545 of file xptiInterfaceInfo.cpp.

{
    if(!EnsureResolved())
        return NS_ERROR_UNEXPECTED;

    if(methodIndex < mInterface->mMethodBaseIndex)
        return mInterface->mParent->
            GetSizeIsArgNumberForParam(methodIndex, param, dimension, argnum);

    if(methodIndex >= mInterface->mMethodBaseIndex + 
                      mInterface->mDescriptor->num_methods)
    {
        NS_ERROR("bad index");
        return NS_ERROR_INVALID_ARG;
    }

    const XPTTypeDescriptor *td;

    if(dimension) {
        nsresult rv = GetTypeInArray(param, dimension, &td);
        if(NS_FAILED(rv))
            return rv;
    }
    else
        td = &param->type;

    // verify that this is a type that has size_is
    switch (XPT_TDP_TAG(td->prefix)) {
      case TD_ARRAY:
      case TD_PSTRING_SIZE_IS:
      case TD_PWSTRING_SIZE_IS:
        break;
      default:
        NS_ERROR("not a size_is");
        return NS_ERROR_INVALID_ARG;
    }

    *argnum = td->argnum;
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 586 of file xptiprivate.h.

{return &mIID;}

Here is the caller graph for this function:

const char* xptiInterfaceEntry::GetTheName ( ) const [inline]

Definition at line 587 of file xptiprivate.h.

{return mName;}

Here is the caller graph for this function:

nsresult xptiInterfaceEntry::GetTypeForParam ( PRUint16  methodIndex,
const nsXPTParamInfo param,
PRUint16  dimension,
nsXPTType _retval 
)

Definition at line 511 of file xptiInterfaceInfo.cpp.

{
    if(!EnsureResolved())
        return NS_ERROR_UNEXPECTED;

    if(methodIndex < mInterface->mMethodBaseIndex)
        return mInterface->mParent->
            GetTypeForParam(methodIndex, param, dimension, type);

    if(methodIndex >= mInterface->mMethodBaseIndex + 
                      mInterface->mDescriptor->num_methods)
    {
        NS_ERROR("bad index");
        return NS_ERROR_INVALID_ARG;
    }

    const XPTTypeDescriptor *td;

    if(dimension) {
        nsresult rv = GetTypeInArray(param, dimension, &td);
        if(NS_FAILED(rv))
            return rv;
    }
    else
        td = &param->type;

    *type = nsXPTType(td->prefix);
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 488 of file xptiInterfaceInfo.cpp.

{
    NS_ASSERTION(IsFullyResolved(), "bad state");

    const XPTTypeDescriptor *td = &param->type;
    const XPTTypeDescriptor *additional_types =
                mInterface->mDescriptor->additional_types;

    for (uint16 i = 0; i < dimension; i++) {
        if(XPT_TDP_TAG(td->prefix) != TD_ARRAY) {
            NS_ERROR("bad dimension");
            return NS_ERROR_INVALID_ARG;
        }
        td = &additional_types[td->type.additional_type];
    }

    *type = td;
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 562 of file xptiprivate.h.

        {return HasInterfaceRecord() ? mInterface->mTypelib : mTypelib;}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 699 of file xptiInterfaceInfo.cpp.

{
    *_retval = PR_FALSE;

    for(xptiInterfaceEntry* current = this; 
        current;
        current = current->mInterface->mParent)
    {
        if(current->mIID.Equals(*iid))
        {
            *_retval = PR_TRUE;
            break;
        }
        if(!current->EnsureResolved())
            return NS_ERROR_UNEXPECTED;
    }

    return NS_OK;
}

Here is the caller graph for this function:

Definition at line 558 of file xptiprivate.h.

        {int s = (int) GetResolveState(); 
         return (s == PARTIALLY_RESOLVED || s == FULLY_RESOLVED) && mInterface;}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 596 of file xptiprivate.h.

        {return info == mInfo;}

Definition at line 555 of file xptiprivate.h.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 283 of file xptiInterfaceInfo.cpp.

{
    if(!EnsureResolved())
        return NS_ERROR_UNEXPECTED;

    *result = XPT_ID_IS_FUNCTION(GetInterfaceGuts()->mDescriptor->flags);
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult xptiInterfaceEntry::IsIID ( const nsIID IID,
PRBool _retval 
)

Definition at line 672 of file xptiInterfaceInfo.cpp.

{
    // It is not necessary to Resolve because this info is read from manifest.
    *_retval = mIID.Equals(*IID);
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 274 of file xptiInterfaceInfo.cpp.

{
    // It is not necessary to Resolve because this info is read from manifest.
    NS_ASSERTION(DEBUG_ScriptableFlagIsValid(), "scriptable flag out of sync!");   
    *result = GetScriptableFlag();
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 600 of file xptiprivate.h.

Definition at line 748 of file xptiInterfaceInfo.cpp.

{
    if(mInfo)
    {
        mInfo->Invalidate(); 
        mInfo = nsnull;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

xptiInterfaceEntry * xptiInterfaceEntry::NewEntry ( const char *  name,
int  nameLength,
const nsID iid,
const xptiTypelib typelib,
xptiWorkingSet aWorkingSet 
) [static]

Definition at line 89 of file xptiInterfaceInfo.cpp.

{
    void* place = XPT_MALLOC(aWorkingSet->GetStructArena(),
                             sizeof(xptiInterfaceEntry) + nameLength);
    if(!place)
        return nsnull;
    return new(place) xptiInterfaceEntry(name, nameLength, iid, typelib);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 104 of file xptiInterfaceInfo.cpp.

{
    size_t nameLength = PL_strlen(r.mName);
    void* place = XPT_MALLOC(aWorkingSet->GetStructArena(),
                             sizeof(xptiInterfaceEntry) + nameLength);
    if(!place)
        return nsnull;
    return new(place) xptiInterfaceEntry(r, nameLength, typelib);
}

Here is the call graph for this function:

void* xptiInterfaceEntry::operator new ( size_t  ,
void p 
) [inline, private]

Definition at line 643 of file xptiprivate.h.

{return p;}

Definition at line 227 of file xptiInterfaceInfo.cpp.

{
    NS_ASSERTION(GetResolveState() == NOT_RESOLVED, "bad state");

    LOG_RESOLVE(("~ partial  resolve of %s\n", mName));

    xptiInterfaceGuts* iface = 
        xptiInterfaceGuts::NewGuts(aDescriptor, mTypelib, aWorkingSet);

    if(!iface)
        return PR_FALSE;

    mInterface = iface;

#ifdef DEBUG
    if(!DEBUG_ScriptableFlagIsValid())
    {
        NS_ERROR("unexpected scriptable flag!");
        SetScriptableFlag(XPT_ID_IS_SCRIPTABLE(mInterface->mDescriptor->flags));
    }
#endif

    SetResolvedState(PARTIALLY_RESOLVED);
    return PR_TRUE;
}        

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool xptiInterfaceEntry::Resolve ( xptiWorkingSet aWorkingSet = nsnull) [private]

Definition at line 142 of file xptiInterfaceInfo.cpp.

{
    nsAutoLock lock(xptiInterfaceInfoManager::GetResolveLock());
    return ResolveLocked(aWorkingSet);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 149 of file xptiInterfaceInfo.cpp.

{
    int resolvedState = GetResolveState();

    if(resolvedState == FULLY_RESOLVED)
        return PR_TRUE;
    if(resolvedState == RESOLVE_FAILED)
        return PR_FALSE;

    xptiInterfaceInfoManager* mgr = 
        xptiInterfaceInfoManager::GetInterfaceInfoManagerNoAddRef();

    if(!mgr)
        return PR_FALSE;

    if(!aWorkingSet)
    {
        aWorkingSet = mgr->GetWorkingSet();
    }

    if(resolvedState == NOT_RESOLVED)
    {
        LOG_RESOLVE(("! begin    resolve of %s\n", mName));
        // Make a copy of mTypelib because the underlying memory will change!
        xptiTypelib typelib = mTypelib;
        
        // We expect our PartiallyResolveLocked() to get called before 
        // this returns. 
        if(!mgr->LoadFile(typelib, aWorkingSet))
        {
            SetResolvedState(RESOLVE_FAILED);
            return PR_FALSE;    
        }
        // The state was changed by LoadFile to PARTIALLY_RESOLVED, so this 
        // ...falls through...
    }

    NS_ASSERTION(GetResolveState() == PARTIALLY_RESOLVED, "bad state!");    

    // Finish out resolution by finding parent and Resolving it so
    // we can set the info we get from it.

    PRUint16 parent_index = mInterface->mDescriptor->parent_interface;

    if(parent_index)
    {
        xptiInterfaceEntry* parent = 
            aWorkingSet->GetTypelibGuts(mInterface->mTypelib)->
                                GetEntryAt(parent_index - 1);
        
        if(!parent || !parent->EnsureResolvedLocked())
        {
            xptiTypelib aTypelib = mInterface->mTypelib;
            mInterface = nsnull;
            mTypelib = aTypelib;
            SetResolvedState(RESOLVE_FAILED);
            return PR_FALSE;
        }

        mInterface->mParent = parent;

        mInterface->mMethodBaseIndex =
            parent->mInterface->mMethodBaseIndex + 
            parent->mInterface->mDescriptor->num_methods;
        
        mInterface->mConstantBaseIndex =
            parent->mInterface->mConstantBaseIndex + 
            parent->mInterface->mDescriptor->num_constants;

    }
    LOG_RESOLVE(("+ complete resolve of %s\n", mName));

    SetResolvedState(FULLY_RESOLVED);
    return PR_TRUE;
}        

Here is the call graph for this function:

Here is the caller graph for this function:

void xptiInterfaceEntry::SetResolvedState ( int  state) [inline, private]

Definition at line 645 of file xptiprivate.h.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 581 of file xptiprivate.h.

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

union { ... } [private]

Definition at line 675 of file xptiprivate.h.

Definition at line 669 of file xptiprivate.h.

Definition at line 674 of file xptiprivate.h.

char xptiInterfaceEntry::mName[1] [private]

Definition at line 676 of file xptiprivate.h.


The documentation for this class was generated from the following files: