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 // 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 18 matching lines...) Expand all Loading... |
29 | 29 |
30 #ifndef BASE_MESSAGE_PUMP_MAC_H_ | 30 #ifndef BASE_MESSAGE_PUMP_MAC_H_ |
31 #define BASE_MESSAGE_PUMP_MAC_H_ | 31 #define BASE_MESSAGE_PUMP_MAC_H_ |
32 #pragma once | 32 #pragma once |
33 | 33 |
34 #include "base/message_pump.h" | 34 #include "base/message_pump.h" |
35 | 35 |
36 #include <CoreFoundation/CoreFoundation.h> | 36 #include <CoreFoundation/CoreFoundation.h> |
37 #include <IOKit/IOKitLib.h> | 37 #include <IOKit/IOKitLib.h> |
38 | 38 |
39 #if defined(__OBJC__) | 39 #if !defined(__OBJC__) |
40 @class NSAutoreleasePool; | |
41 #else // defined(__OBJC__) | |
42 class NSAutoreleasePool; | 40 class NSAutoreleasePool; |
43 #endif // defined(__OBJC__) | 41 #else // !defined(__OBJC__) |
| 42 #import <AppKit/AppKit.h> |
| 43 |
| 44 // Clients must subclass NSApplication and implement this protocol if they use |
| 45 // MessagePumpMac. |
| 46 @protocol CrAppProtocol |
| 47 // Must return true if -[NSApplication sendEvent:] is currently on the stack. |
| 48 // See the comment for |CreateAutoreleasePool()| in the cc file for why this is |
| 49 // necessary. |
| 50 - (BOOL)isHandlingSendEvent; |
| 51 @end |
| 52 #endif // !defined(__OBJC__) |
44 | 53 |
45 namespace base { | 54 namespace base { |
46 | 55 |
47 class TimeTicks; | 56 class TimeTicks; |
48 | 57 |
49 class MessagePumpCFRunLoopBase : public MessagePump { | 58 class MessagePumpCFRunLoopBase : public MessagePump { |
50 // Needs access to CreateAutoreleasePool. | 59 // Needs access to CreateAutoreleasePool. |
51 friend class MessagePumpScopedAutoreleasePool; | 60 friend class MessagePumpScopedAutoreleasePool; |
52 public: | 61 public: |
53 MessagePumpCFRunLoopBase(); | 62 MessagePumpCFRunLoopBase(); |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 // thread. Otherwise, returns a new instance of MessagePumpNSRunLoop. | 276 // thread. Otherwise, returns a new instance of MessagePumpNSRunLoop. |
268 static MessagePump* Create(); | 277 static MessagePump* Create(); |
269 | 278 |
270 private: | 279 private: |
271 DISALLOW_IMPLICIT_CONSTRUCTORS(MessagePumpMac); | 280 DISALLOW_IMPLICIT_CONSTRUCTORS(MessagePumpMac); |
272 }; | 281 }; |
273 | 282 |
274 } // namespace base | 283 } // namespace base |
275 | 284 |
276 #endif // BASE_MESSAGE_PUMP_MAC_H_ | 285 #endif // BASE_MESSAGE_PUMP_MAC_H_ |
OLD | NEW |