Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Private Attributes
MessageRunnable Class Reference

Wraps a JavaMessage in an nsIRunnable form, so that it runs on the correct native thread. More...

Inheritance diagram for MessageRunnable:
Inheritance graph
[legend]
Collaboration diagram for MessageRunnable:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 MessageRunnable (PRUint32 threadID, JavaMessage *msg)
virtual void execute (JNIEnv *env)
NS_IMETHOD Run ()
 Defines an entry point for a newly created thread.
 MessageRunnable (PRUint32 threadID, JavaMessage *msg)
virtual void execute (JNIEnv *env)
NS_IMETHOD Run ()
 Defines an entry point for a newly created thread.
void setNext (JavaMessage *next)
void setNext (JavaMessage *next)
JavaMessagegetNext ()
JavaMessagegetNext ()
void run ()
nsresult queryInterface (const nsIID &aIID, void **aInstancePtr)
 The lowercase implementations of queryInterface, addRef, and release all act locally on the current object, regardless of aggregation.
nsrefcnt addRef (void)
nsrefcnt release (void)

Private Attributes

PRUint32 mThreadID
JavaMessagemMessage

Detailed Description

Wraps a JavaMessage in an nsIRunnable form, so that it runs on the correct native thread.

Definition at line 319 of file LiveConnectNativeMethods.cpp.


Constructor & Destructor Documentation

Definition at line 332 of file LiveConnectNativeMethods.cpp.

    : mThreadID(threadID), mMessage(msg)
{
}

Member Function Documentation

nsrefcnt SupportsMixin::addRef ( void  ) [inherited]

Here is the caller graph for this function:

void MessageRunnable::execute ( JNIEnv env) [virtual]

Implements JavaMessage.

Definition at line 337 of file LiveConnectNativeMethods.cpp.

{
    // because a spontaneous Java thread called us, we have to switch to the JavaScript thread
    // to handle this request.
    nsIThreadManager* threadManager = NULL;
    if (MRJPlugin::GetService(nsIJVMManager::GetCID(), NS_GET_IID(nsIThreadManager), (void **)&threadManager) == NS_OK) {
        threadManager->PostEvent(mThreadID, this, PR_FALSE);
        NS_RELEASE(threadManager);
    }
}

Here is the call graph for this function:

virtual void MessageRunnable::execute ( JNIEnv env) [virtual]

Implements JavaMessage.

JavaMessage* JavaMessage::getNext ( ) [inline, inherited]

Definition at line 55 of file JavaMessageQueue.h.

{ return mNext; }

Here is the caller graph for this function:

JavaMessage* JavaMessage::getNext ( ) [inline, inherited]

Definition at line 56 of file JavaMessageQueue.h.

{ return mNext; }
NS_IMETHODIMP SupportsMixin::queryInterface ( const nsIID aIID,
void **  aInstancePtr 
) [inherited]

The lowercase implementations of queryInterface, addRef, and release all act locally on the current object, regardless of aggregation.

They are meant to be called by aggregating outer objects.

Definition at line 129 of file SupportsMixin.cpp.

{
       if (aInstancePtr == NULL) {
              return NS_ERROR_NULL_POINTER;
       }
       // first check to see if it's one of our known interfaces.
       // need to solve the non-left inheritance graph case.
       const InterfaceInfo* interfaces = mInterfaces;
       UInt32 count = mInterfaceCount;
       for (UInt32 i = 0; i < count; i++) {
              if (aIID.Equals(interfaces[i].mIID)) {
                     *aInstancePtr = (void*) (UInt32(mInstance) + interfaces[i].mOffset);
                     addRef();
                     return NS_OK;
              }
       }
       // finally, does the interface match nsISupports?
       static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
       if (aIID.Equals(kISupportsIID)) {
              *aInstancePtr = (void*) mInstance;
              addRef();
              return NS_OK;
       }
       return NS_NOINTERFACE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Here is the caller graph for this function:

void nsIRunnable::run ( ) [inherited]

Defines an entry point for a newly created thread.

Implements RunnableMixin.

Definition at line 348 of file LiveConnectNativeMethods.cpp.

{
    nsIJVMManager* javaManager = NULL;
    if (MRJPlugin::GetService(nsIJVMManager::GetCID(), NS_GET_IID(nsIJVMManager), (void **)&javaManager) == NS_OK) {
        JNIEnv* proxyEnv = NULL;
        if (javaManager->GetProxyJNI(&proxyEnv) == NS_OK && proxyEnv != NULL)
            mMessage->execute(proxyEnv);
        NS_RELEASE(javaManager);
    }
    return NS_OK;
}

Here is the call graph for this function:

Defines an entry point for a newly created thread.

Implements RunnableMixin.

void JavaMessage::setNext ( JavaMessage next) [inline, inherited]

Definition at line 54 of file JavaMessageQueue.h.

{ mNext = next; }

Here is the caller graph for this function:

void JavaMessage::setNext ( JavaMessage next) [inline, inherited]

Definition at line 55 of file JavaMessageQueue.h.

{ mNext = next; }

Member Data Documentation

Definition at line 329 of file LiveConnectNativeMethods.cpp.

Definition at line 328 of file LiveConnectNativeMethods.cpp.


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