Back to index

lightning-sunbird  0.9+nobinonly
Classes | Functions | Variables
xpcjsruntime.cpp File Reference
#include "xpcprivate.h"

Go to the source code of this file.

Classes

struct  JSDyingJSObjectData
struct  CX_AND_XPCRT_Data

Functions

 WrappedJSDyingJSObjectFinder (JSDHashTable *table, JSDHashEntryHdr *hdr, uint32 number, void *arg)
 NativeInterfaceGC (JSDHashTable *table, JSDHashEntryHdr *hdr, uint32 number, void *arg)
 NativeInterfaceSweeper (JSDHashTable *table, JSDHashEntryHdr *hdr, uint32 number, void *arg)
 NativeUnMarkedSetRemover (JSDHashTable *table, JSDHashEntryHdr *hdr, uint32 number, void *arg)
 NativeSetSweeper (JSDHashTable *table, JSDHashEntryHdr *hdr, uint32 number, void *arg)
 JSClassSweeper (JSDHashTable *table, JSDHashEntryHdr *hdr, uint32 number, void *arg)
 DyingProtoKiller (JSDHashTable *table, JSDHashEntryHdr *hdr, uint32 number, void *arg)
 DetachedWrappedNativeProtoMarker (JSDHashTable *table, JSDHashEntryHdr *hdr, uint32 number, void *arg)
 ContextCallback (JSContext *cx, uintN operation)
 WrappedJSShutdownMarker (JSDHashTable *table, JSDHashEntryHdr *hdr, uint32 number, void *arg)
 DetachedWrappedNativeProtoShutdownMarker (JSDHashTable *table, JSDHashEntryHdr *hdr, uint32 number, void *arg)
 SweepContextsCB (JSDHashTable *table, JSDHashEntryHdr *hdr, uint32 number, void *arg)
 PurgeContextsCB (JSDHashTable *table, JSDHashEntryHdr *hdr, uint32 number, void *arg)

Variables

static JSContextCallback gOldJSContextCallback
static JSGCCallback gOldJSGCCallback

Class Documentation

struct JSDyingJSObjectData

Definition at line 78 of file xpcjsruntime.cpp.

Collaboration diagram for JSDyingJSObjectData:
Class Members
nsVoidArray * array
JSContext * cx
struct CX_AND_XPCRT_Data

Definition at line 105 of file xpcjsruntime.cpp.

Collaboration diagram for CX_AND_XPCRT_Data:
Class Members
JSContext * cx
XPCJSRuntime * rt

Function Documentation

ContextCallback ( JSContext cx,
uintN  operation 
)

Definition at line 232 of file xpcjsruntime.cpp.

{
    XPCJSRuntime* self = nsXPConnect::GetRuntime();
    if (self)
    {
        if (operation == JSCONTEXT_NEW)
        {
            XPCPerThreadData* tls = XPCPerThreadData::GetData();
            if(tls)
            {
                JS_SetThreadStackLimit(cx, tls->GetStackLimit());
            }
        }
    }

    return gOldJSContextCallback
           ? gOldJSContextCallback(cx, operation)
           : JS_TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

DetachedWrappedNativeProtoMarker ( JSDHashTable table,
JSDHashEntryHdr hdr,
uint32  number,
void arg 
)

Definition at line 220 of file xpcjsruntime.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 631 of file xpcjsruntime.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

DyingProtoKiller ( JSDHashTable table,
JSDHashEntryHdr hdr,
uint32  number,
void arg 
)

Definition at line 210 of file xpcjsruntime.cpp.

Here is the caller graph for this function:

JSClassSweeper ( JSDHashTable table,
JSDHashEntryHdr hdr,
uint32  number,
void arg 
)

Definition at line 183 of file xpcjsruntime.cpp.

{
    XPCNativeScriptableShared* shared =
        ((XPCNativeScriptableSharedMap::Entry*) hdr)->key;
    if(shared->IsMarked())
    {
#ifdef off_XPC_REPORT_JSCLASS_FLUSHING
        printf("+ Marked XPCNativeScriptableShared for: %s @ %x\n",
               shared->GetJSClass()->name,
               shared->GetJSClass());
#endif
        shared->Unmark();
        return JS_DHASH_NEXT;
    }

#ifdef XPC_REPORT_JSCLASS_FLUSHING
    printf("- Destroying XPCNativeScriptableShared for: %s @ %x\n",
           shared->GetJSClass()->name,
           shared->GetJSClass());
#endif

    delete shared;
    return JS_DHASH_REMOVE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

NativeInterfaceGC ( JSDHashTable table,
JSDHashEntryHdr hdr,
uint32  number,
void arg 
)

Definition at line 112 of file xpcjsruntime.cpp.

{
    CX_AND_XPCRT_Data* data = (CX_AND_XPCRT_Data*) arg;
    ((IID2NativeInterfaceMap::Entry*)hdr)->value->
            DealWithDyingGCThings(data->cx, data->rt);
    return JS_DHASH_NEXT;
}

Here is the caller graph for this function:

NativeInterfaceSweeper ( JSDHashTable table,
JSDHashEntryHdr hdr,
uint32  number,
void arg 
)

Definition at line 122 of file xpcjsruntime.cpp.

{
    CX_AND_XPCRT_Data* data = (CX_AND_XPCRT_Data*) arg;
    XPCNativeInterface* iface = ((IID2NativeInterfaceMap::Entry*)hdr)->value;
    if(iface->IsMarked())
    {
        iface->Unmark();
        return JS_DHASH_NEXT;
    }

#ifdef XPC_REPORT_NATIVE_INTERFACE_AND_SET_FLUSHING
    printf("- Destroying XPCNativeInterface for %s\n",
            JS_GetStringBytes(JSVAL_TO_STRING(iface->GetName())));
#endif

    XPCNativeInterface::DestroyInstance(data->cx, data->rt, iface);
    return JS_DHASH_REMOVE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

NativeSetSweeper ( JSDHashTable table,
JSDHashEntryHdr hdr,
uint32  number,
void arg 
)

Definition at line 158 of file xpcjsruntime.cpp.

{
    XPCNativeSet* set = ((NativeSetMap::Entry*)hdr)->key_value;
    if(set->IsMarked())
    {
        set->Unmark();
        return JS_DHASH_NEXT;
    }

#ifdef XPC_REPORT_NATIVE_INTERFACE_AND_SET_FLUSHING
    printf("- Destroying XPCNativeSet for:\n");
    PRUint16 count = set->GetInterfaceCount();
    for(PRUint16 k = 0; k < count; k++)
    {
        XPCNativeInterface* iface = set->GetInterfaceAt(k);
        printf("    %s\n",JS_GetStringBytes(JSVAL_TO_STRING(iface->GetName())));
    }
#endif

    XPCNativeSet::DestroyInstance(set);
    return JS_DHASH_REMOVE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

NativeUnMarkedSetRemover ( JSDHashTable table,
JSDHashEntryHdr hdr,
uint32  number,
void arg 
)

Definition at line 148 of file xpcjsruntime.cpp.

{
    XPCNativeSet* set = ((ClassInfo2NativeSetMap::Entry*)hdr)->value;
    if(set->IsMarked())
        return JS_DHASH_NEXT;
    return JS_DHASH_REMOVE;
}

Here is the caller graph for this function:

PurgeContextsCB ( JSDHashTable table,
JSDHashEntryHdr hdr,
uint32  number,
void arg 
)

Definition at line 967 of file xpcjsruntime.cpp.

{
    delete ((JSContext2XPCContextMap::Entry*)hdr)->value;
    return JS_DHASH_REMOVE;
}

Here is the caller graph for this function:

SweepContextsCB ( JSDHashTable table,
JSDHashEntryHdr hdr,
uint32  number,
void arg 
)

Definition at line 903 of file xpcjsruntime.cpp.

{
    XPCContext* xpcc = ((JSContext2XPCContextMap::Entry*)hdr)->value;
    if(xpcc->IsMarked())
    {
        xpcc->Unmark();
        return JS_DHASH_NEXT;
    }

    // this XPCContext represents a dead JSContext - delete it
    delete xpcc;
    return JS_DHASH_REMOVE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

WrappedJSDyingJSObjectFinder ( JSDHashTable table,
JSDHashEntryHdr hdr,
uint32  number,
void arg 
)

Definition at line 85 of file xpcjsruntime.cpp.

{
    JSDyingJSObjectData* data = (JSDyingJSObjectData*) arg;
    nsXPCWrappedJS* wrapper = ((JSObject2WrappedJSMap::Entry*)hdr)->value;
    NS_ASSERTION(wrapper, "found a null JS wrapper!");

    // walk the wrapper chain and find any whose JSObject is to be finalized
    while(wrapper)
    {
        if(wrapper->IsSubjectToFinalization())
        {
            if(JS_IsAboutToBeFinalized(data->cx, wrapper->GetJSObject()))
                data->array->AppendElement(wrapper);
        }
        wrapper = wrapper->GetNextWrapper();
    }
    return JS_DHASH_NEXT;
}

Here is the call graph for this function:

Here is the caller graph for this function:

WrappedJSShutdownMarker ( JSDHashTable table,
JSDHashEntryHdr hdr,
uint32  number,
void arg 
)

Definition at line 619 of file xpcjsruntime.cpp.

{
    JSRuntime* rt = (JSRuntime*) arg;
    nsXPCWrappedJS* wrapper = ((JSObject2WrappedJSMap::Entry*)hdr)->value;
    NS_ASSERTION(wrapper, "found a null JS wrapper!");
    NS_ASSERTION(wrapper->IsValid(), "found an invalid JS wrapper!");
    wrapper->SystemIsBeingShutDown(rt);
    return JS_DHASH_NEXT;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

JSContextCallback gOldJSContextCallback [static]

Definition at line 72 of file xpcjsruntime.cpp.

JSGCCallback gOldJSGCCallback [static]

Definition at line 75 of file xpcjsruntime.cpp.