summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-15 21:40:41 +0000
committerrsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-15 21:40:41 +0000
commit4ef3ade0c2ba8061d9ebad36a5e6fd6d52ad6f65 (patch)
tree070c22a23117c7cc3dadb10d1ba7868b63e14a95
parent344b9912870c219ceeccd438b88ed75c024bb9cc (diff)
downloadchromium_src-4ef3ade0c2ba8061d9ebad36a5e6fd6d52ad6f65.zip
chromium_src-4ef3ade0c2ba8061d9ebad36a5e6fd6d52ad6f65.tar.gz
chromium_src-4ef3ade0c2ba8061d9ebad36a5e6fd6d52ad6f65.tar.bz2
[Mac] Confirm-to-quit: Avoid busywaiting for the key up event.
BUG=74806 TEST=See bug for full steps. Review URL: http://codereview.chromium.org/6694035 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78291 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/ui/cocoa/confirm_quit_panel_controller.mm9
1 files changed, 6 insertions, 3 deletions
diff --git a/chrome/browser/ui/cocoa/confirm_quit_panel_controller.mm b/chrome/browser/ui/cocoa/confirm_quit_panel_controller.mm
index f7fb487..2a98357 100644
--- a/chrome/browser/ui/cocoa/confirm_quit_panel_controller.mm
+++ b/chrome/browser/ui/cocoa/confirm_quit_panel_controller.mm
@@ -194,9 +194,12 @@ ConfirmQuitPanelController* g_confirmQuitPanelController = nil;
BOOL willQuit = NO;
NSEvent* nextEvent = nil;
do {
- // Dequeue events until a key up is received.
- // TODO(rsesek): Explore using |untilDate| with |targetDate|.
- nextEvent = [self pumpEventQueueForKeyUp:app untilDate:nil];
+ // Dequeue events until a key up is received. To avoid busy waiting, figure
+ // out the amount of time that the thread can sleep before taking further
+ // action.
+ NSDate* waitDate = [NSDate dateWithTimeIntervalSinceNow:
+ kTimeToConfirmQuit - kTimeDeltaFuzzFactor];
+ nextEvent = [self pumpEventQueueForKeyUp:app untilDate:waitDate];
// Wait for the time expiry to happen. Once past the hold threshold,
// commit to quitting and hide all the open windows.