// Main thread via OnProcessNextEvent below
bool
nsBaseAppShell::DoProcessNextNativeEvent(bool mayWait, uint32_t recursionDepth)
{
    // The next native event to be processed may trigger our NativeEventCallback,
    // in which case we do not want it to process any thread events since we'll
    // do that when this function returns.
    //
    // If the next native event is not our NativeEventCallback, then we may end
    // up recursing into this function.
    //
    // However, if the next native event is not our NativeEventCallback, but it
    // results in another native event loop, then our NativeEventCallback could
    // fire and it will see mEventloopNestingState as eEventloopOther.
    //
    EventloopNestingState prevVal = mEventloopNestingState;
    mEventloopNestingState = eEventloopXPCOM;

    ++mEventloopNestingLevel;

    bool result = ProcessNextNativeEvent(mayWait);

    // Make sure that any sync sections registered during this most recent event
    // are run now. This is not considered a stable state because we're not back
    // to the event loop yet.
    RunSyncSections(false, recursionDepth);

    --mEventloopNestingLevel;

    mEventloopNestingState = prevVal;
    return result;
}
Exemple #2
0
// Main thread via OnProcessNextEvent below
bool
nsBaseAppShell::DoProcessNextNativeEvent(bool mayWait)
{
  // The next native event to be processed may trigger our NativeEventCallback,
  // in which case we do not want it to process any thread events since we'll
  // do that when this function returns.
  //
  // If the next native event is not our NativeEventCallback, then we may end
  // up recursing into this function.
  //
  // However, if the next native event is not our NativeEventCallback, but it
  // results in another native event loop, then our NativeEventCallback could
  // fire and it will see mEventloopNestingState as eEventloopOther.
  //
  EventloopNestingState prevVal = mEventloopNestingState;
  mEventloopNestingState = eEventloopXPCOM;

  ++mEventloopNestingLevel;
  bool result = ProcessNextNativeEvent(mayWait);
  --mEventloopNestingLevel;

  mEventloopNestingState = prevVal;
  return result;
}