| OLD | NEW |
| 1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/message_pump_mac.h" | 5 #include "base/message_pump_mac.h" |
| 6 | 6 |
| 7 #import <AppKit/AppKit.h> | 7 #import <AppKit/AppKit.h> |
| 8 #import <Foundation/Foundation.h> | 8 #import <Foundation/Foundation.h> |
| 9 #include <float.h> | 9 #include <float.h> |
| 10 | 10 |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 | 256 |
| 257 // Called from the run loop. | 257 // Called from the run loop. |
| 258 // static | 258 // static |
| 259 void MessagePumpCFRunLoopBase::RunNestingDeferredWorkSource(void* info) { | 259 void MessagePumpCFRunLoopBase::RunNestingDeferredWorkSource(void* info) { |
| 260 MessagePumpCFRunLoopBase* self = static_cast<MessagePumpCFRunLoopBase*>(info); | 260 MessagePumpCFRunLoopBase* self = static_cast<MessagePumpCFRunLoopBase*>(info); |
| 261 self->RunNestingDeferredWork(); | 261 self->RunNestingDeferredWork(); |
| 262 } | 262 } |
| 263 | 263 |
| 264 // Called by MessagePumpCFRunLoopBase::RunNestingDeferredWorkSource. | 264 // Called by MessagePumpCFRunLoopBase::RunNestingDeferredWorkSource. |
| 265 bool MessagePumpCFRunLoopBase::RunNestingDeferredWork() { | 265 bool MessagePumpCFRunLoopBase::RunNestingDeferredWork() { |
| 266 // Immediately try work in priority order. |
| 266 if (!RunWork()) { | 267 if (!RunWork()) { |
| 267 if (!RunDelayedWork()) { | 268 if (!RunDelayedWork()) { |
| 268 if (!RunIdleWork()) { | 269 if (!RunIdleWork()) { |
| 269 return false; | 270 return false; |
| 270 } | 271 } |
| 272 } else { |
| 273 // There was no work, and delayed work was done. Arrange for the loop |
| 274 // to try non-nestable idle work on a subsequent pass. |
| 275 CFRunLoopSourceSignal(idle_work_source_); |
| 271 } | 276 } |
| 277 } else { |
| 278 // Work was done. Arrange for the loop to try non-nestable delayed and |
| 279 // idle work on a subsequent pass. |
| 280 CFRunLoopSourceSignal(delayed_work_source_); |
| 281 CFRunLoopSourceSignal(idle_work_source_); |
| 272 } | 282 } |
| 273 | 283 |
| 274 return true; | 284 return true; |
| 275 } | 285 } |
| 276 | 286 |
| 277 // Called from the run loop. | 287 // Called from the run loop. |
| 278 // static | 288 // static |
| 279 void MessagePumpCFRunLoopBase::PreWaitObserver(CFRunLoopObserverRef observer, | 289 void MessagePumpCFRunLoopBase::PreWaitObserver(CFRunLoopObserverRef observer, |
| 280 CFRunLoopActivity activity, | 290 CFRunLoopActivity activity, |
| 281 void* info) { | 291 void* info) { |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 // static | 471 // static |
| 462 MessagePump* MessagePumpMac::Create() { | 472 MessagePump* MessagePumpMac::Create() { |
| 463 if ([NSThread isMainThread]) { | 473 if ([NSThread isMainThread]) { |
| 464 return new MessagePumpNSApplication; | 474 return new MessagePumpNSApplication; |
| 465 } | 475 } |
| 466 | 476 |
| 467 return new MessagePumpNSRunLoop; | 477 return new MessagePumpNSRunLoop; |
| 468 } | 478 } |
| 469 | 479 |
| 470 } // namespace base | 480 } // namespace base |
| OLD | NEW |