| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 virtual ~MessagePumpCFRunLoopBase(); | 44 virtual ~MessagePumpCFRunLoopBase(); |
| 45 | 45 |
| 46 // Subclasses should implement the work they need to do in MessagePump::Run | 46 // Subclasses should implement the work they need to do in MessagePump::Run |
| 47 // in the DoRun method. MessagePumpCFRunLoopBase::Run calls DoRun directly. | 47 // in the DoRun method. MessagePumpCFRunLoopBase::Run calls DoRun directly. |
| 48 // This arrangement is used because MessagePumpCFRunLoopBase needs to set | 48 // This arrangement is used because MessagePumpCFRunLoopBase needs to set |
| 49 // up and tear down things before and after the "meat" of DoRun. | 49 // up and tear down things before and after the "meat" of DoRun. |
| 50 virtual void Run(Delegate* delegate); | 50 virtual void Run(Delegate* delegate); |
| 51 virtual void DoRun(Delegate* delegate) = 0; | 51 virtual void DoRun(Delegate* delegate) = 0; |
| 52 | 52 |
| 53 virtual void ScheduleWork(); | 53 virtual void ScheduleWork(); |
| 54 virtual void ScheduleDelayedWork(const Time& delayed_work_time); | 54 virtual void ScheduleDelayedWork(const base::Time& delayed_work_time); |
| 55 | 55 |
| 56 protected: | 56 protected: |
| 57 // The thread's run loop. | 57 // The thread's run loop. |
| 58 CFRunLoopRef run_loop_; | 58 CFRunLoopRef run_loop_; |
| 59 | 59 |
| 60 private: | 60 private: |
| 61 // Timer callback scheduled by ScheduleDelayedWork. This does not do any | 61 // Timer callback scheduled by ScheduleDelayedWork. This does not do any |
| 62 // work, but it signals delayed_work_source_ so that delayed work can be | 62 // work, but it signals delayed_work_source_ so that delayed work can be |
| 63 // performed within the appropriate priority constraints. | 63 // performed within the appropriate priority constraints. |
| 64 static void RunDelayedWorkTimer(CFRunLoopTimerRef timer, void* info); | 64 static void RunDelayedWorkTimer(CFRunLoopTimerRef timer, void* info); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 // thread. Otherwise, returns a new instance of MessagePumpNSRunLoop. | 172 // thread. Otherwise, returns a new instance of MessagePumpNSRunLoop. |
| 173 static MessagePump* Create(); | 173 static MessagePump* Create(); |
| 174 | 174 |
| 175 private: | 175 private: |
| 176 DISALLOW_IMPLICIT_CONSTRUCTORS(MessagePumpMac); | 176 DISALLOW_IMPLICIT_CONSTRUCTORS(MessagePumpMac); |
| 177 }; | 177 }; |
| 178 | 178 |
| 179 } // namespace base | 179 } // namespace base |
| 180 | 180 |
| 181 #endif // BASE_MESSAGE_PUMP_MAC_H_ | 181 #endif // BASE_MESSAGE_PUMP_MAC_H_ |
| OLD | NEW |