Index: base/message_pump_mac.h |
=================================================================== |
--- base/message_pump_mac.h (revision 29677) |
+++ base/message_pump_mac.h (working copy) |
@@ -54,18 +54,11 @@ |
virtual void ScheduleDelayedWork(const Time& delayed_work_time); |
protected: |
- // The thread's run loop. |
- CFRunLoopRef run_loop_; |
+ // Accessors for private data members to be used by subclasses. |
+ CFRunLoopRef run_loop() const { return run_loop_; } |
+ int nesting_level() const { return nesting_level_; } |
+ int run_nesting_level() const { return run_nesting_level_; } |
- // The recursion depth of the currently-executing CFRunLoopRun loop on the |
- // run loop's thread. 0 if no run loops are running inside of whatever scope |
- // the object was created in. |
- int nesting_level_; |
- |
- // The recursion depth (calculated in the same way as nesting_level_) of the |
- // innermost executing CFRunLoopRun loop started by a call to Run. |
- int run_nesting_level_; |
- |
private: |
// Timer callback scheduled by ScheduleDelayedWork. This does not do any |
// work, but it signals delayed_work_source_ so that delayed work can be |
@@ -96,13 +89,19 @@ |
// Perform work that may have been deferred because it was not runnable |
// within a nested run loop. This is associated with |
- // nesting_deferred_work_source_ and is signalled by EnterExitObserver when |
- // a run loop exits, so that an outer loop will be able to perform the |
- // necessary tasks. The static method calls the instance method; the |
- // instance method returns true if anything was done. |
+ // nesting_deferred_work_source_ and is signalled by |
+ // MaybeScheduleNestingDeferredWork when returning from a nested loop, |
+ // so that an outer loop will be able to perform the necessary tasks if it |
+ // permits nestable tasks. |
static void RunNestingDeferredWorkSource(void* info); |
bool RunNestingDeferredWork(); |
+ // Schedules possible nesting-deferred work to be processed before the run |
+ // loop goes to sleep or exits. If this function detects that a nested loop |
+ // had run since the previous attempt to schedule nesting-deferred work, it |
+ // will schedule a call to RunNestingDeferredWorkSource. |
+ void MaybeScheduleNestingDeferredWork(); |
+ |
// Observer callback responsible for performing idle-priority work, before |
// the run loop goes to sleep. Associated with idle_work_observer_. |
static void PreWaitObserver(CFRunLoopObserverRef observer, |
@@ -119,6 +118,9 @@ |
// the basis of run loops starting and stopping. |
virtual void EnterExitRunLoop(CFRunLoopActivity activity); |
+ // The thread's run loop. |
+ CFRunLoopRef run_loop_; |
+ |
// The timer, sources, and observers are described above alongside their |
// callbacks. |
CFRunLoopTimerRef delayed_work_timer_; |
@@ -132,6 +134,19 @@ |
// (weak) Delegate passed as an argument to the innermost Run call. |
Delegate* delegate_; |
+ // The recursion depth of the currently-executing CFRunLoopRun loop on the |
+ // run loop's thread. 0 if no run loops are running inside of whatever scope |
+ // the object was created in. |
+ int nesting_level_; |
+ |
+ // The recursion depth (calculated in the same way as nesting_level_) of the |
+ // innermost executing CFRunLoopRun loop started by a call to Run. |
+ int run_nesting_level_; |
+ |
+ // The deepest (numerically highest) recursion depth encountered since the |
+ // most recent attempt to run nesting-deferred work. |
+ int deepest_nesting_level_; |
+ |
// "Delegateless" work flags are set when work is ready to be performed but |
// must wait until a delegate is available to process it. This can happen |
// when a MessagePumpCFRunLoopBase is instantiated and work arrives without |