Back to index

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

#include <nsNSSShutDown.h>

Collaboration diagram for nsNSSActivityState:
Collaboration graph
[legend]

List of all members.

Public Types

enum  RealOrTesting { test_only, do_it_for_real }

Public Member Functions

 nsNSSActivityState ()
 ~nsNSSActivityState ()
void enter ()
void leave ()
void enterBlockingUIState ()
void leaveBlockingUIState ()
PRBool isBlockingUIActive ()
PRBool isUIForbidden ()
PRBool ifPossibleDisallowUI (RealOrTesting rot)
void allowUI ()
PRStatus restrictActivityToCurrentThread ()
void releaseCurrentThreadActivityRestriction ()

Private Attributes

PRLockmNSSActivityStateLock
PRCondVarmNSSActivityChanged
int mNSSActivityCounter
int mBlockingUICounter
PRBool mIsUIForbidden
PRThreadmNSSRestrictedThread

Detailed Description

Definition at line 49 of file nsNSSShutDown.h.


Member Enumeration Documentation

Enumerator:
test_only 
do_it_for_real 

Definition at line 75 of file nsNSSShutDown.h.


Constructor & Destructor Documentation


Member Function Documentation

Definition at line 417 of file nsNSSShutDown.cpp.

Here is the caller graph for this function:

Definition at line 323 of file nsNSSShutDown.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 349 of file nsNSSShutDown.cpp.

Here is the caller graph for this function:

Definition at line 389 of file nsNSSShutDown.cpp.

{
  PRBool retval = PR_FALSE;

  PR_Lock(mNSSActivityStateLock);

    // Checking and disallowing the UI must be done atomically.

    if (!mBlockingUICounter) {
      // No UI is currently shown, we are able to evaporate.
      retval = PR_TRUE;
      if (rot == do_it_for_real) {
        // Remember to disallow UI.
        mIsUIForbidden = PR_TRUE;
        
        // to clear the "forbidden" state,
        // one must either call 
        // restrictActivityToCurrentThread() + releaseCurrentThreadActivityRestriction()
        // or cancel the operation by calling
        // unprepareCurrentThreadRestriction()
      }
    }
  
  PR_Unlock(mNSSActivityStateLock);

  return retval;
}

Here is the caller graph for this function:

Definition at line 378 of file nsNSSShutDown.cpp.

Here is the caller graph for this function:

Definition at line 336 of file nsNSSShutDown.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 358 of file nsNSSShutDown.cpp.

Here is the caller graph for this function:

Definition at line 453 of file nsNSSShutDown.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 426 of file nsNSSShutDown.cpp.

{
  PRStatus retval = PR_FAILURE;

  PR_Lock(mNSSActivityStateLock);
  
    if (!mBlockingUICounter) {
      while (0 < mNSSActivityCounter && !mBlockingUICounter) {
        PR_WaitCondVar(mNSSActivityChanged, PR_TicksPerSecond());
      }
      
      if (mBlockingUICounter) {
        // This should never happen.
        // If we arrive here, our logic is broken.
        PR_ASSERT(0);
      }
      else {
        mNSSRestrictedThread = PR_GetCurrentThread();
        retval = PR_SUCCESS;
      }
    }
  
  PR_Unlock(mNSSActivityStateLock);

  return retval;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 104 of file nsNSSShutDown.h.

Definition at line 107 of file nsNSSShutDown.h.

Definition at line 97 of file nsNSSShutDown.h.

Definition at line 100 of file nsNSSShutDown.h.

Definition at line 92 of file nsNSSShutDown.h.

Definition at line 111 of file nsNSSShutDown.h.


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