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

Side by Side Diff: base/message_pump_mac.h

Issue 3884001: Switch to using TimeTicks rather than Time in message loops (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month 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
« no previous file with comments | « base/message_pump_libevent.cc ('k') | base/message_pump_mac.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 26 matching lines...) Expand all
37 #include <IOKit/IOKitLib.h> 37 #include <IOKit/IOKitLib.h>
38 38
39 #if defined(__OBJC__) 39 #if defined(__OBJC__)
40 @class NSAutoreleasePool; 40 @class NSAutoreleasePool;
41 #else // defined(__OBJC__) 41 #else // defined(__OBJC__)
42 class NSAutoreleasePool; 42 class NSAutoreleasePool;
43 #endif // defined(__OBJC__) 43 #endif // defined(__OBJC__)
44 44
45 namespace base { 45 namespace base {
46 46
47 class Time; 47 class TimeTicks;
48 48
49 class MessagePumpCFRunLoopBase : public MessagePump { 49 class MessagePumpCFRunLoopBase : public MessagePump {
50 // Needs access to CreateAutoreleasePool. 50 // Needs access to CreateAutoreleasePool.
51 friend class MessagePumpScopedAutoreleasePool; 51 friend class MessagePumpScopedAutoreleasePool;
52 public: 52 public:
53 MessagePumpCFRunLoopBase(); 53 MessagePumpCFRunLoopBase();
54 virtual ~MessagePumpCFRunLoopBase(); 54 virtual ~MessagePumpCFRunLoopBase();
55 55
56 // Subclasses should implement the work they need to do in MessagePump::Run 56 // Subclasses should implement the work they need to do in MessagePump::Run
57 // in the DoRun method. MessagePumpCFRunLoopBase::Run calls DoRun directly. 57 // in the DoRun method. MessagePumpCFRunLoopBase::Run calls DoRun directly.
58 // This arrangement is used because MessagePumpCFRunLoopBase needs to set 58 // This arrangement is used because MessagePumpCFRunLoopBase needs to set
59 // up and tear down things before and after the "meat" of DoRun. 59 // up and tear down things before and after the "meat" of DoRun.
60 virtual void Run(Delegate* delegate); 60 virtual void Run(Delegate* delegate);
61 virtual void DoRun(Delegate* delegate) = 0; 61 virtual void DoRun(Delegate* delegate) = 0;
62 62
63 virtual void ScheduleWork(); 63 virtual void ScheduleWork();
64 virtual void ScheduleDelayedWork(const Time& delayed_work_time); 64 virtual void ScheduleDelayedWork(const TimeTicks& delayed_work_time);
65 65
66 protected: 66 protected:
67 // Accessors for private data members to be used by subclasses. 67 // Accessors for private data members to be used by subclasses.
68 CFRunLoopRef run_loop() const { return run_loop_; } 68 CFRunLoopRef run_loop() const { return run_loop_; }
69 int nesting_level() const { return nesting_level_; } 69 int nesting_level() const { return nesting_level_; }
70 int run_nesting_level() const { return run_nesting_level_; } 70 int run_nesting_level() const { return run_nesting_level_; }
71 71
72 // Return an autorelease pool to wrap around any work being performed. 72 // Return an autorelease pool to wrap around any work being performed.
73 // In some cases, CreateAutoreleasePool may return nil intentionally to 73 // In some cases, CreateAutoreleasePool may return nil intentionally to
74 // preventing an autorelease pool from being created, allowing any 74 // preventing an autorelease pool from being created, allowing any
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 // thread. Otherwise, returns a new instance of MessagePumpNSRunLoop. 267 // thread. Otherwise, returns a new instance of MessagePumpNSRunLoop.
268 static MessagePump* Create(); 268 static MessagePump* Create();
269 269
270 private: 270 private:
271 DISALLOW_IMPLICIT_CONSTRUCTORS(MessagePumpMac); 271 DISALLOW_IMPLICIT_CONSTRUCTORS(MessagePumpMac);
272 }; 272 };
273 273
274 } // namespace base 274 } // namespace base
275 275
276 #endif // BASE_MESSAGE_PUMP_MAC_H_ 276 #endif // BASE_MESSAGE_PUMP_MAC_H_
OLDNEW
« no previous file with comments | « base/message_pump_libevent.cc ('k') | base/message_pump_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698