Index: base/message_loop/message_pump_mac.h |
diff --git a/base/message_loop/message_pump_mac.h b/base/message_loop/message_pump_mac.h |
index f0766eb860e592d5cab96c93db7ae57d36ce00bc..763c6b4868d43e19e8d3ee4198bb19586a3a67c2 100644 |
--- a/base/message_loop/message_pump_mac.h |
+++ b/base/message_loop/message_pump_mac.h |
@@ -79,26 +79,29 @@ typedef NSAutoreleasePool AutoreleasePoolType; |
#endif // !defined(__OBJC__) || __has_feature(objc_arc) |
class BASE_EXPORT MessagePumpCFRunLoopBase : public MessagePump { |
+ public: |
+ // MessagePump: |
+ void Run(Delegate* delegate) override; |
+ void ScheduleWork() override; |
+ void ScheduleDelayedWork(const TimeTicks& delayed_work_time) override; |
+ void SetTimerSlack(TimerSlack timer_slack) override; |
+ |
+ protected: |
// Needs access to CreateAutoreleasePool. |
friend class MessagePumpScopedAutoreleasePool; |
friend class TestMessagePumpCFRunLoopBase; |
- public: |
- MessagePumpCFRunLoopBase(); |
+ // Tasks will be pumped in the run loop modes described by |mode_mask|, which |
+ // maps bits to the index of an internal array of run loop mode identifiers. |
+ explicit MessagePumpCFRunLoopBase(int mode_mask); |
~MessagePumpCFRunLoopBase() override; |
// Subclasses should implement the work they need to do in MessagePump::Run |
// in the DoRun method. MessagePumpCFRunLoopBase::Run calls DoRun directly. |
// This arrangement is used because MessagePumpCFRunLoopBase needs to set |
// up and tear down things before and after the "meat" of DoRun. |
- void Run(Delegate* delegate) override; |
virtual void DoRun(Delegate* delegate) = 0; |
- void ScheduleWork() override; |
- void ScheduleDelayedWork(const TimeTicks& delayed_work_time) override; |
- void SetTimerSlack(TimerSlack timer_slack) override; |
- |
- protected: |
// Accessors for private data members to be used by subclasses. |
CFRunLoopRef run_loop() const { return run_loop_; } |
int nesting_level() const { return nesting_level_; } |
@@ -114,6 +117,11 @@ class BASE_EXPORT MessagePumpCFRunLoopBase : public MessagePump { |
// objects autoreleased by work to fall into the current autorelease pool. |
virtual AutoreleasePoolType* CreateAutoreleasePool(); |
+ // Invokes function(run_loop_, arg, mode) for all the modes in |mode_mask_|. |
+ template <typename Argument> |
+ void InvokeForEnabledModes(void function(CFRunLoopRef, Argument, CFStringRef), |
+ Argument argument); |
+ |
private: |
// Marking timers as invalid at the right time helps significantly reduce |
// power use (see the comment in RunDelayedWorkTimer()), however there is no |
@@ -190,6 +198,9 @@ class BASE_EXPORT MessagePumpCFRunLoopBase : public MessagePump { |
// The thread's run loop. |
CFRunLoopRef run_loop_; |
+ // Bitmask controlling the run loop modes in which posted tasks may run. |
+ const int mode_mask_; |
+ |
// The timer, sources, and observers are described above alongside their |
// callbacks. |
CFRunLoopTimerRef delayed_work_timer_; |