OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // The basis for all native run loops on the Mac is the CFRunLoop. It can be | 5 // The basis for all native run loops on the Mac is the CFRunLoop. It can be |
6 // used directly, it can be used as the driving force behind the similar | 6 // used directly, it can be used as the driving force behind the similar |
7 // Foundation NSRunLoop, and it can be used to implement higher-level event | 7 // Foundation NSRunLoop, and it can be used to implement higher-level event |
8 // loops such as the NSApplication event loop. | 8 // loops such as the NSApplication event loop. |
9 // | 9 // |
10 // This file introduces a basic CFRunLoop-based implementation of the | 10 // This file introduces a basic CFRunLoop-based implementation of the |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 DISALLOW_COPY_AND_ASSIGN(MessagePumpNSRunLoop); | 256 DISALLOW_COPY_AND_ASSIGN(MessagePumpNSRunLoop); |
257 }; | 257 }; |
258 | 258 |
259 #if defined(OS_IOS) | 259 #if defined(OS_IOS) |
260 // This is a fake message pump. It attaches sources to the main thread's | 260 // This is a fake message pump. It attaches sources to the main thread's |
261 // CFRunLoop, so PostTask() will work, but it is unable to drive the loop | 261 // CFRunLoop, so PostTask() will work, but it is unable to drive the loop |
262 // directly, so calling Run() or Quit() are errors. | 262 // directly, so calling Run() or Quit() are errors. |
263 class MessagePumpUIApplication : public MessagePumpCFRunLoopBase { | 263 class MessagePumpUIApplication : public MessagePumpCFRunLoopBase { |
264 public: | 264 public: |
265 MessagePumpUIApplication(); | 265 MessagePumpUIApplication(); |
266 virtual ~MessagePumpUIApplication(); | 266 ~MessagePumpUIApplication() override; |
267 virtual void DoRun(Delegate* delegate) override; | 267 void DoRun(Delegate* delegate) override; |
268 virtual void Quit() override; | 268 void Quit() override; |
269 | 269 |
270 // This message pump can not spin the main message loop directly. Instead, | 270 // This message pump can not spin the main message loop directly. Instead, |
271 // call |Attach()| to set up a delegate. It is an error to call |Run()|. | 271 // call |Attach()| to set up a delegate. It is an error to call |Run()|. |
272 virtual void Attach(Delegate* delegate); | 272 virtual void Attach(Delegate* delegate); |
273 | 273 |
274 private: | 274 private: |
275 RunLoop* run_loop_; | 275 RunLoop* run_loop_; |
276 | 276 |
277 DISALLOW_COPY_AND_ASSIGN(MessagePumpUIApplication); | 277 DISALLOW_COPY_AND_ASSIGN(MessagePumpUIApplication); |
278 }; | 278 }; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 DISALLOW_IMPLICIT_CONSTRUCTORS(MessagePumpMac); | 344 DISALLOW_IMPLICIT_CONSTRUCTORS(MessagePumpMac); |
345 }; | 345 }; |
346 | 346 |
347 // Tasks posted to the message loop are posted under this mode, as well | 347 // Tasks posted to the message loop are posted under this mode, as well |
348 // as kCFRunLoopCommonModes. | 348 // as kCFRunLoopCommonModes. |
349 extern const CFStringRef BASE_EXPORT kMessageLoopExclusiveRunLoopMode; | 349 extern const CFStringRef BASE_EXPORT kMessageLoopExclusiveRunLoopMode; |
350 | 350 |
351 } // namespace base | 351 } // namespace base |
352 | 352 |
353 #endif // BASE_MESSAGE_LOOP_MESSAGE_PUMP_MAC_H_ | 353 #endif // BASE_MESSAGE_LOOP_MESSAGE_PUMP_MAC_H_ |
OLD | NEW |