summaryrefslogtreecommitdiffstats
path: root/base/message_pump_mac.h
diff options
context:
space:
mode:
authormark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-22 16:18:03 +0000
committermark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-22 16:18:03 +0000
commitaf87d5b0f0bd21e4681ea9e1798bd9fb5b9ee83f (patch)
tree5fd9558628917f58b8c0ac58fcd0482deda32234 /base/message_pump_mac.h
parent3e5bf103d2b7199b00610ce6ef1411be91be8a2e (diff)
downloadchromium_src-af87d5b0f0bd21e4681ea9e1798bd9fb5b9ee83f.zip
chromium_src-af87d5b0f0bd21e4681ea9e1798bd9fb5b9ee83f.tar.gz
chromium_src-af87d5b0f0bd21e4681ea9e1798bd9fb5b9ee83f.tar.bz2
Call MaybeScheduleNestingDeferredWork at the top of each loop iteration from
a kCFRunLoopBeforeSources observer. A busy loop that's driven with a nonzero duration might not go to sleep or exit soon after a nested loop exits, so calling MaybeScheduleNestingDeferredWork from the existing kCFRunLoopBeforeWaiting and kCFRunLoopExit observers may not be sufficient to guarantee processing of nesting-deferred work in all situations. BUG=24968 TEST=All of the test cases listed in the commit message from r29749. No new test cases; this change addresses a purely theoretical case. Review URL: http://codereview.chromium.org/315010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29775 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/message_pump_mac.h')
-rw-r--r--base/message_pump_mac.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/base/message_pump_mac.h b/base/message_pump_mac.h
index 9c24d8b..381acbf 100644
--- a/base/message_pump_mac.h
+++ b/base/message_pump_mac.h
@@ -97,9 +97,10 @@ class MessagePumpCFRunLoopBase : public MessagePump {
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.
+ // loop goes to sleep, exits, or begins processing sources at the top of its
+ // loop. 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
@@ -107,6 +108,11 @@ class MessagePumpCFRunLoopBase : public MessagePump {
static void PreWaitObserver(CFRunLoopObserverRef observer,
CFRunLoopActivity activity, void* info);
+ // Observer callback called before the run loop processes any sources.
+ // Associated with pre_source_observer_.
+ static void PreSourceObserver(CFRunLoopObserverRef observer,
+ CFRunLoopActivity activity, void* info);
+
// Observer callback called when the run loop starts and stops, at the
// beginning and end of calls to CFRunLoopRun. This is used to maintain
// nesting_level_. Associated with enter_exit_observer_.
@@ -129,6 +135,7 @@ class MessagePumpCFRunLoopBase : public MessagePump {
CFRunLoopSourceRef idle_work_source_;
CFRunLoopSourceRef nesting_deferred_work_source_;
CFRunLoopObserverRef pre_wait_observer_;
+ CFRunLoopObserverRef pre_source_observer_;
CFRunLoopObserverRef enter_exit_observer_;
// (weak) Delegate passed as an argument to the innermost Run call.