Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(947)

Side by Side Diff: base/message_loop/message_pump_mac.h

Issue 16897006: Move message_pump to base/message_loop. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
11 // MessagePump interface called CFRunLoopBase. CFRunLoopBase contains all 11 // MessagePump interface called CFRunLoopBase. CFRunLoopBase contains all
12 // of the machinery necessary to dispatch events to a delegate, but does not 12 // of the machinery necessary to dispatch events to a delegate, but does not
13 // implement the specific run loop. Concrete subclasses must provide their 13 // implement the specific run loop. Concrete subclasses must provide their
14 // own DoRun and Quit implementations. 14 // own DoRun and Quit implementations.
15 // 15 //
16 // A concrete subclass that just runs a CFRunLoop loop is provided in 16 // A concrete subclass that just runs a CFRunLoop loop is provided in
17 // MessagePumpCFRunLoop. For an NSRunLoop, the similar MessagePumpNSRunLoop 17 // MessagePumpCFRunLoop. For an NSRunLoop, the similar MessagePumpNSRunLoop
18 // is provided. 18 // is provided.
19 // 19 //
20 // For the application's event loop, an implementation based on AppKit's 20 // For the application's event loop, an implementation based on AppKit's
21 // NSApplication event system is provided in MessagePumpNSApplication. 21 // NSApplication event system is provided in MessagePumpNSApplication.
22 // 22 //
23 // Typically, MessagePumpNSApplication only makes sense on a Cocoa 23 // Typically, MessagePumpNSApplication only makes sense on a Cocoa
24 // application's main thread. If a CFRunLoop-based message pump is needed on 24 // application's main thread. If a CFRunLoop-based message pump is needed on
25 // any other thread, one of the other concrete subclasses is preferrable. 25 // any other thread, one of the other concrete subclasses is preferrable.
26 // MessagePumpMac::Create is defined, which returns a new NSApplication-based 26 // MessagePumpMac::Create is defined, which returns a new NSApplication-based
27 // or NSRunLoop-based MessagePump subclass depending on which thread it is 27 // or NSRunLoop-based MessagePump subclass depending on which thread it is
28 // called on. 28 // called on.
29 29
30 #ifndef BASE_MESSAGE_PUMP_MAC_H_ 30 #ifndef BASE_MESSAGE_LOOP_MESSAGE_PUMP_MAC_H_
31 #define BASE_MESSAGE_PUMP_MAC_H_ 31 #define BASE_MESSAGE_LOOP_MESSAGE_PUMP_MAC_H_
32 32
33 #include "base/message_pump.h" 33 #include "base/message_loop/message_pump.h"
34 34
35 #include <CoreFoundation/CoreFoundation.h> 35 #include <CoreFoundation/CoreFoundation.h>
36 36
37 #if !defined(__OBJC__) 37 #if !defined(__OBJC__)
38 class NSAutoreleasePool; 38 class NSAutoreleasePool;
39 #else // !defined(__OBJC__) 39 #else // !defined(__OBJC__)
40 #if defined(OS_IOS) 40 #if defined(OS_IOS)
41 #import <Foundation/Foundation.h> 41 #import <Foundation/Foundation.h>
42 #else 42 #else
43 #import <AppKit/AppKit.h> 43 #import <AppKit/AppKit.h>
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 virtual void Quit() OVERRIDE; 250 virtual void Quit() OVERRIDE;
251 251
252 // This message pump can not spin the main message loop directly. Instead, 252 // This message pump can not spin the main message loop directly. Instead,
253 // call |Attach()| to set up a delegate. It is an error to call |Run()|. 253 // call |Attach()| to set up a delegate. It is an error to call |Run()|.
254 virtual void Attach(Delegate* delegate); 254 virtual void Attach(Delegate* delegate);
255 255
256 protected: 256 protected:
257 virtual ~MessagePumpUIApplication(); 257 virtual ~MessagePumpUIApplication();
258 258
259 private: 259 private:
260 base::RunLoop* run_loop_; 260 RunLoop* run_loop_;
261 261
262 DISALLOW_COPY_AND_ASSIGN(MessagePumpUIApplication); 262 DISALLOW_COPY_AND_ASSIGN(MessagePumpUIApplication);
263 }; 263 };
264 264
265 #else 265 #else
266 266
267 class MessagePumpNSApplication : public MessagePumpCFRunLoopBase { 267 class MessagePumpNSApplication : public MessagePumpCFRunLoopBase {
268 public: 268 public:
269 MessagePumpNSApplication(); 269 MessagePumpNSApplication();
270 270
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 // Requires NSApp to implement CrAppProtocol. 327 // Requires NSApp to implement CrAppProtocol.
328 BASE_EXPORT static bool IsHandlingSendEvent(); 328 BASE_EXPORT static bool IsHandlingSendEvent();
329 #endif // !defined(OS_IOS) 329 #endif // !defined(OS_IOS)
330 330
331 private: 331 private:
332 DISALLOW_IMPLICIT_CONSTRUCTORS(MessagePumpMac); 332 DISALLOW_IMPLICIT_CONSTRUCTORS(MessagePumpMac);
333 }; 333 };
334 334
335 } // namespace base 335 } // namespace base
336 336
337 #endif // BASE_MESSAGE_PUMP_MAC_H_ 337 #endif // BASE_MESSAGE_LOOP_MESSAGE_PUMP_MAC_H_
OLDNEW
« no previous file with comments | « base/message_loop/message_pump_libevent_unittest.cc ('k') | base/message_loop/message_pump_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698