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

Side by Side Diff: base/message_loop/message_pump_libevent.cc

Issue 1059353003: Add missing check for quitting from MessagePumpLibevent (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use WaitableEventWatcher Created 5 years, 8 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
« no previous file with comments | « no previous file | base/message_loop/message_pump_libevent_unittest.cc » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_loop/message_pump_libevent.h" 5 #include "base/message_loop/message_pump_libevent.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <unistd.h> 9 #include <unistd.h>
10 10
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 event_base_set(event_base_, timer_event.get()); 267 event_base_set(event_base_, timer_event.get());
268 event_add(timer_event.get(), &poll_tv); 268 event_add(timer_event.get(), &poll_tv);
269 event_base_loop(event_base_, EVLOOP_ONCE); 269 event_base_loop(event_base_, EVLOOP_ONCE);
270 event_del(timer_event.get()); 270 event_del(timer_event.get());
271 } else { 271 } else {
272 // It looks like delayed_work_time_ indicates a time in the past, so we 272 // It looks like delayed_work_time_ indicates a time in the past, so we
273 // need to call DoDelayedWork now. 273 // need to call DoDelayedWork now.
274 delayed_work_time_ = TimeTicks(); 274 delayed_work_time_ = TimeTicks();
275 } 275 }
276 } 276 }
277
278 if (!keep_running_)
279 break;
277 } 280 }
278 } 281 }
279 282
280 void MessagePumpLibevent::Quit() { 283 void MessagePumpLibevent::Quit() {
281 DCHECK(in_run_) << "Quit was called outside of Run!"; 284 DCHECK(in_run_) << "Quit was called outside of Run!";
282 // Tell both libevent and Run that they should break out of their loops. 285 // Tell both libevent and Run that they should break out of their loops.
283 keep_running_ = false; 286 keep_running_ = false;
284 ScheduleWork(); 287 ScheduleWork();
285 } 288 }
286 289
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 // Remove and discard the wakeup byte. 367 // Remove and discard the wakeup byte.
365 char buf; 368 char buf;
366 int nread = HANDLE_EINTR(read(socket, &buf, 1)); 369 int nread = HANDLE_EINTR(read(socket, &buf, 1));
367 DCHECK_EQ(nread, 1); 370 DCHECK_EQ(nread, 1);
368 that->processed_io_events_ = true; 371 that->processed_io_events_ = true;
369 // Tell libevent to break out of inner loop. 372 // Tell libevent to break out of inner loop.
370 event_base_loopbreak(that->event_base_); 373 event_base_loopbreak(that->event_base_);
371 } 374 }
372 375
373 } // namespace base 376 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/message_loop/message_pump_libevent_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698