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

Side by Side Diff: base/message_pump_libevent.cc

Issue 3828009: Move scoped_nsdisable_screen_update from base to app/mac... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 2 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
« no previous file with comments | « base/message_pump_default.cc ('k') | base/scoped_aedesc.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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #include "base/message_pump_libevent.h" 5 #include "base/message_pump_libevent.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
11 #include "base/eintr_wrapper.h" 11 #include "base/eintr_wrapper.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/mac/scoped_nsautorelease_pool.h"
13 #include "base/observer_list.h" 14 #include "base/observer_list.h"
14 #include "base/scoped_nsautorelease_pool.h"
15 #include "base/scoped_ptr.h" 15 #include "base/scoped_ptr.h"
16 #include "base/time.h" 16 #include "base/time.h"
17 #if defined(USE_SYSTEM_LIBEVENT) 17 #if defined(USE_SYSTEM_LIBEVENT)
18 #include <event.h> 18 #include <event.h>
19 #else 19 #else
20 #include "third_party/libevent/event.h" 20 #include "third_party/libevent/event.h"
21 #endif 21 #endif
22 22
23 // Lifecycle of struct event 23 // Lifecycle of struct event
24 // Libevent uses two main data structures: 24 // Libevent uses two main data structures:
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 // Reentrant! 258 // Reentrant!
259 void MessagePumpLibevent::Run(Delegate* delegate) { 259 void MessagePumpLibevent::Run(Delegate* delegate) {
260 DCHECK(keep_running_) << "Quit must have been called outside of Run!"; 260 DCHECK(keep_running_) << "Quit must have been called outside of Run!";
261 AutoReset<bool> auto_reset_in_run(&in_run_, true); 261 AutoReset<bool> auto_reset_in_run(&in_run_, true);
262 262
263 // event_base_loopexit() + EVLOOP_ONCE is leaky, see http://crbug.com/25641. 263 // event_base_loopexit() + EVLOOP_ONCE is leaky, see http://crbug.com/25641.
264 // Instead, make our own timer and reuse it on each call to event_base_loop(). 264 // Instead, make our own timer and reuse it on each call to event_base_loop().
265 scoped_ptr<event> timer_event(new event); 265 scoped_ptr<event> timer_event(new event);
266 266
267 for (;;) { 267 for (;;) {
268 ScopedNSAutoreleasePool autorelease_pool; 268 mac::ScopedNSAutoreleasePool autorelease_pool;
269 269
270 bool did_work = delegate->DoWork(); 270 bool did_work = delegate->DoWork();
271 if (!keep_running_) 271 if (!keep_running_)
272 break; 272 break;
273 273
274 did_work |= delegate->DoDelayedWork(&delayed_work_time_); 274 did_work |= delegate->DoDelayedWork(&delayed_work_time_);
275 if (!keep_running_) 275 if (!keep_running_)
276 break; 276 break;
277 277
278 if (did_work) 278 if (did_work)
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 343
344 void MessagePumpLibevent::WillProcessIOEvent() { 344 void MessagePumpLibevent::WillProcessIOEvent() {
345 FOR_EACH_OBSERVER(IOObserver, io_observers_, WillProcessIOEvent()); 345 FOR_EACH_OBSERVER(IOObserver, io_observers_, WillProcessIOEvent());
346 } 346 }
347 347
348 void MessagePumpLibevent::DidProcessIOEvent() { 348 void MessagePumpLibevent::DidProcessIOEvent() {
349 FOR_EACH_OBSERVER(IOObserver, io_observers_, DidProcessIOEvent()); 349 FOR_EACH_OBSERVER(IOObserver, io_observers_, DidProcessIOEvent());
350 } 350 }
351 351
352 } // namespace base 352 } // namespace base
OLDNEW
« no previous file with comments | « base/message_pump_default.cc ('k') | base/scoped_aedesc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698