Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes | Private Attributes
nsTimeout Struct Reference

#include <nsGlobalWindow.h>

Collaboration diagram for nsTimeout:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsTimeout ()
 ~nsTimeout ()
void Release (nsIScriptContext *aContext)
void AddRef ()

Public Attributes

nsGlobalWindowmWindow
JSStringmExpr
JSObjectmFunObj
nsCOMPtr< nsITimermTimer
jsvalmArgv
PRUint16 mArgc
PRPackedBool mCleared
PRPackedBool mRunning
PRUint32 mPublicId
PRInt32 mInterval
PRTime mWhen
nsCOMPtr< nsIPrincipalmPrincipal
char * mFileName
PRUint32 mLineNo
const char * mVersion
PRUint32 mFiringDepth
nsTimeoutmNext
PopupControlState mPopupState

Private Attributes

PRInt32 mRefCnt

Detailed Description

Definition at line 599 of file nsGlobalWindow.h.


Constructor & Destructor Documentation

nsTimeout::nsTimeout ( ) [inline]

Definition at line 601 of file nsGlobalWindow.h.

  {
#ifdef DEBUG_jst
    {
      extern int gTimeoutCnt;

      ++gTimeoutCnt;
    }
#endif

    memset(this, 0, sizeof(*this));

    MOZ_COUNT_CTOR(nsTimeout);
  }

Here is the call graph for this function:

nsTimeout::~nsTimeout ( ) [inline]

Definition at line 616 of file nsGlobalWindow.h.

  {
#ifdef DEBUG_jst
    {
      extern int gTimeoutCnt;

      --gTimeoutCnt;
    }
#endif

    MOZ_COUNT_DTOR(nsTimeout);
  }

Member Function Documentation

Definition at line 7073 of file nsGlobalWindow.cpp.

{
  ++mRefCnt;
}

Here is the caller graph for this function:

Definition at line 6997 of file nsGlobalWindow.cpp.

{
  if (--mRefCnt > 0)
    return;

  if (mExpr || mFunObj) {
    nsIScriptContext *scx = aContext;
    JSRuntime *rt = nsnull;

    if (!scx && mWindow) {
      scx = mWindow->GetContext();
    }

    if (scx) {
      JSContext *cx;
      cx = (JSContext *)scx->GetNativeContext();
      rt = ::JS_GetRuntime(cx);
    } else {
      // XXX The timeout *must* be unrooted, even if !scx. This can be
      // done without a JS context using the JSRuntime. This is safe
      // enough, but it would be better to drop all a window's
      // timeouts before its context is cleared. Bug 50705 describes a
      // situation where we're not. In that case, at the time the
      // context is cleared, a timeout (actually an Interval) is still
      // active, but temporarily removed from the window's list of
      // timers (placed instead on the timer manager's list). This
      // makes the nearly handy ClearAllTimeouts routine useless, so
      // we settled on using the JSRuntime rather than relying on the
      // window having a context. It would be good to remedy this
      // workable but clumsy situation someday.

      nsCOMPtr<nsIJSRuntimeService> rtsvc =
        do_GetService("@mozilla.org/js/xpc/RuntimeService;1");

      if (rtsvc)
        rtsvc->GetRuntime(&rt);
    }

    if (!rt) {
      // most unexpected. not much choice but to bail.

      NS_ERROR("nsTimeout::Release() with no JSRuntime. eek!");

      return;
    }

    if (mExpr) {
      ::JS_RemoveRootRT(rt, &mExpr);
    } else {
      ::JS_RemoveRootRT(rt, &mFunObj);

      if (mArgv) {
        for (PRInt32 i = 0; i < mArgc; ++i) {
          ::JS_RemoveRootRT(rt, &mArgv[i]);
        }

        PR_FREEIF(mArgv);
      }
    }
  }

  if (mTimer) {
    mTimer->Cancel();
    mTimer = nsnull;
  }

  if (mFileName) {
    PL_strfree(mFileName);
  }

  NS_IF_RELEASE(mWindow);

  delete this;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 644 of file nsGlobalWindow.h.

Definition at line 643 of file nsGlobalWindow.h.

Definition at line 647 of file nsGlobalWindow.h.

Definition at line 636 of file nsGlobalWindow.h.

Definition at line 667 of file nsGlobalWindow.h.

Definition at line 672 of file nsGlobalWindow.h.

Definition at line 637 of file nsGlobalWindow.h.

Definition at line 656 of file nsGlobalWindow.h.

Definition at line 668 of file nsGlobalWindow.h.

Definition at line 676 of file nsGlobalWindow.h.

Definition at line 680 of file nsGlobalWindow.h.

Definition at line 663 of file nsGlobalWindow.h.

Definition at line 653 of file nsGlobalWindow.h.

Definition at line 684 of file nsGlobalWindow.h.

Definition at line 650 of file nsGlobalWindow.h.

Definition at line 640 of file nsGlobalWindow.h.

Definition at line 669 of file nsGlobalWindow.h.

Definition at line 660 of file nsGlobalWindow.h.

Definition at line 633 of file nsGlobalWindow.h.


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