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

Side by Side Diff: base/message_pump_mac.h

Issue 8520018: Add OVERRIDE to base/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: extra header Created 9 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.h ('k') | base/metrics/histogram.h » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 // Needs access to CreateAutoreleasePool. 58 // Needs access to CreateAutoreleasePool.
59 friend class MessagePumpScopedAutoreleasePool; 59 friend class MessagePumpScopedAutoreleasePool;
60 public: 60 public:
61 MessagePumpCFRunLoopBase(); 61 MessagePumpCFRunLoopBase();
62 virtual ~MessagePumpCFRunLoopBase(); 62 virtual ~MessagePumpCFRunLoopBase();
63 63
64 // Subclasses should implement the work they need to do in MessagePump::Run 64 // Subclasses should implement the work they need to do in MessagePump::Run
65 // in the DoRun method. MessagePumpCFRunLoopBase::Run calls DoRun directly. 65 // in the DoRun method. MessagePumpCFRunLoopBase::Run calls DoRun directly.
66 // This arrangement is used because MessagePumpCFRunLoopBase needs to set 66 // This arrangement is used because MessagePumpCFRunLoopBase needs to set
67 // up and tear down things before and after the "meat" of DoRun. 67 // up and tear down things before and after the "meat" of DoRun.
68 virtual void Run(Delegate* delegate); 68 virtual void Run(Delegate* delegate) OVERRIDE;
69 virtual void DoRun(Delegate* delegate) = 0; 69 virtual void DoRun(Delegate* delegate) = 0;
70 70
71 virtual void ScheduleWork(); 71 virtual void ScheduleWork() OVERRIDE;
72 virtual void ScheduleDelayedWork(const TimeTicks& delayed_work_time); 72 virtual void ScheduleDelayedWork(const TimeTicks& delayed_work_time) OVERRIDE;
73 73
74 protected: 74 protected:
75 // Accessors for private data members to be used by subclasses. 75 // Accessors for private data members to be used by subclasses.
76 CFRunLoopRef run_loop() const { return run_loop_; } 76 CFRunLoopRef run_loop() const { return run_loop_; }
77 int nesting_level() const { return nesting_level_; } 77 int nesting_level() const { return nesting_level_; }
78 int run_nesting_level() const { return run_nesting_level_; } 78 int run_nesting_level() const { return run_nesting_level_; }
79 79
80 // Return an autorelease pool to wrap around any work being performed. 80 // Return an autorelease pool to wrap around any work being performed.
81 // In some cases, CreateAutoreleasePool may return nil intentionally to 81 // In some cases, CreateAutoreleasePool may return nil intentionally to
82 // preventing an autorelease pool from being created, allowing any 82 // preventing an autorelease pool from being created, allowing any
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 bool delegateless_work_; 184 bool delegateless_work_;
185 bool delegateless_idle_work_; 185 bool delegateless_idle_work_;
186 186
187 DISALLOW_COPY_AND_ASSIGN(MessagePumpCFRunLoopBase); 187 DISALLOW_COPY_AND_ASSIGN(MessagePumpCFRunLoopBase);
188 }; 188 };
189 189
190 class MessagePumpCFRunLoop : public MessagePumpCFRunLoopBase { 190 class MessagePumpCFRunLoop : public MessagePumpCFRunLoopBase {
191 public: 191 public:
192 MessagePumpCFRunLoop(); 192 MessagePumpCFRunLoop();
193 193
194 virtual void DoRun(Delegate* delegate); 194 virtual void DoRun(Delegate* delegate) OVERRIDE;
195 virtual void Quit(); 195 virtual void Quit() OVERRIDE;
196 196
197 private: 197 private:
198 virtual void EnterExitRunLoop(CFRunLoopActivity activity); 198 virtual void EnterExitRunLoop(CFRunLoopActivity activity) OVERRIDE;
199 199
200 // True if Quit is called to stop the innermost MessagePump 200 // True if Quit is called to stop the innermost MessagePump
201 // (innermost_quittable_) but some other CFRunLoopRun loop (nesting_level_) 201 // (innermost_quittable_) but some other CFRunLoopRun loop (nesting_level_)
202 // is running inside the MessagePump's innermost Run call. 202 // is running inside the MessagePump's innermost Run call.
203 bool quit_pending_; 203 bool quit_pending_;
204 204
205 DISALLOW_COPY_AND_ASSIGN(MessagePumpCFRunLoop); 205 DISALLOW_COPY_AND_ASSIGN(MessagePumpCFRunLoop);
206 }; 206 };
207 207
208 class MessagePumpNSRunLoop : public MessagePumpCFRunLoopBase { 208 class MessagePumpNSRunLoop : public MessagePumpCFRunLoopBase {
209 public: 209 public:
210 MessagePumpNSRunLoop(); 210 MessagePumpNSRunLoop();
211 virtual ~MessagePumpNSRunLoop(); 211 virtual ~MessagePumpNSRunLoop();
212 212
213 virtual void DoRun(Delegate* delegate); 213 virtual void DoRun(Delegate* delegate) OVERRIDE;
214 virtual void Quit(); 214 virtual void Quit() OVERRIDE;
215 215
216 private: 216 private:
217 // A source that doesn't do anything but provide something signalable 217 // A source that doesn't do anything but provide something signalable
218 // attached to the run loop. This source will be signalled when Quit 218 // attached to the run loop. This source will be signalled when Quit
219 // is called, to cause the loop to wake up so that it can stop. 219 // is called, to cause the loop to wake up so that it can stop.
220 CFRunLoopSourceRef quit_source_; 220 CFRunLoopSourceRef quit_source_;
221 221
222 // False after Quit is called. 222 // False after Quit is called.
223 bool keep_running_; 223 bool keep_running_;
224 224
225 DISALLOW_COPY_AND_ASSIGN(MessagePumpNSRunLoop); 225 DISALLOW_COPY_AND_ASSIGN(MessagePumpNSRunLoop);
226 }; 226 };
227 227
228 class MessagePumpNSApplication : public MessagePumpCFRunLoopBase { 228 class MessagePumpNSApplication : public MessagePumpCFRunLoopBase {
229 public: 229 public:
230 MessagePumpNSApplication(); 230 MessagePumpNSApplication();
231 231
232 virtual void DoRun(Delegate* delegate); 232 virtual void DoRun(Delegate* delegate) OVERRIDE;
233 virtual void Quit(); 233 virtual void Quit() OVERRIDE;
234 234
235 protected: 235 protected:
236 // Returns nil if NSApp is currently in the middle of calling -sendEvent. 236 // Returns nil if NSApp is currently in the middle of calling -sendEvent.
237 virtual NSAutoreleasePool* CreateAutoreleasePool(); 237 virtual NSAutoreleasePool* CreateAutoreleasePool() OVERRIDE;
238 238
239 private: 239 private:
240 // False after Quit is called. 240 // False after Quit is called.
241 bool keep_running_; 241 bool keep_running_;
242 242
243 // True if DoRun is managing its own run loop as opposed to letting 243 // True if DoRun is managing its own run loop as opposed to letting
244 // -[NSApplication run] handle it. The outermost run loop in the application 244 // -[NSApplication run] handle it. The outermost run loop in the application
245 // is managed by -[NSApplication run], inner run loops are handled by a loop 245 // is managed by -[NSApplication run], inner run loops are handled by a loop
246 // in DoRun. 246 // in DoRun.
247 bool running_own_loop_; 247 bool running_own_loop_;
248 248
249 DISALLOW_COPY_AND_ASSIGN(MessagePumpNSApplication); 249 DISALLOW_COPY_AND_ASSIGN(MessagePumpNSApplication);
250 }; 250 };
251 251
252 class MessagePumpMac { 252 class MessagePumpMac {
253 public: 253 public:
254 // Returns a new instance of MessagePumpNSApplication if called on the main 254 // Returns a new instance of MessagePumpNSApplication if called on the main
255 // thread. Otherwise, returns a new instance of MessagePumpNSRunLoop. 255 // thread. Otherwise, returns a new instance of MessagePumpNSRunLoop.
256 static MessagePump* Create(); 256 static MessagePump* Create();
257 257
258 private: 258 private:
259 DISALLOW_IMPLICIT_CONSTRUCTORS(MessagePumpMac); 259 DISALLOW_IMPLICIT_CONSTRUCTORS(MessagePumpMac);
260 }; 260 };
261 261
262 } // namespace base 262 } // namespace base
263 263
264 #endif // BASE_MESSAGE_PUMP_MAC_H_ 264 #endif // BASE_MESSAGE_PUMP_MAC_H_
OLDNEW
« no previous file with comments | « base/message_pump_libevent.h ('k') | base/metrics/histogram.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698