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

Side by Side Diff: base/message_pump_libevent.cc

Issue 15709015: Make sure that the UI window created by base::MessagePumpForUI is destoyed on the same thread (Wind… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: oops Created 7 years, 6 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
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_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 #include <unistd.h> 9 #include <unistd.h>
10 10
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 } 298 }
299 299
300 void MessagePumpLibevent::ScheduleDelayedWork( 300 void MessagePumpLibevent::ScheduleDelayedWork(
301 const TimeTicks& delayed_work_time) { 301 const TimeTicks& delayed_work_time) {
302 // We know that we can't be blocked on Wait right now since this method can 302 // We know that we can't be blocked on Wait right now since this method can
303 // only be called on the same thread as Run, so we only need to update our 303 // only be called on the same thread as Run, so we only need to update our
304 // record of how long to sleep when we do sleep. 304 // record of how long to sleep when we do sleep.
305 delayed_work_time_ = delayed_work_time; 305 delayed_work_time_ = delayed_work_time;
306 } 306 }
307 307
308 void MessagePumpLibevent::Stop() {
309 }
310
308 void MessagePumpLibevent::WillProcessIOEvent() { 311 void MessagePumpLibevent::WillProcessIOEvent() {
309 FOR_EACH_OBSERVER(IOObserver, io_observers_, WillProcessIOEvent()); 312 FOR_EACH_OBSERVER(IOObserver, io_observers_, WillProcessIOEvent());
310 } 313 }
311 314
312 void MessagePumpLibevent::DidProcessIOEvent() { 315 void MessagePumpLibevent::DidProcessIOEvent() {
313 FOR_EACH_OBSERVER(IOObserver, io_observers_, DidProcessIOEvent()); 316 FOR_EACH_OBSERVER(IOObserver, io_observers_, DidProcessIOEvent());
314 } 317 }
315 318
316 bool MessagePumpLibevent::Init() { 319 bool MessagePumpLibevent::Init() {
317 int fds[2]; 320 int fds[2];
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 // Remove and discard the wakeup byte. 373 // Remove and discard the wakeup byte.
371 char buf; 374 char buf;
372 int nread = HANDLE_EINTR(read(socket, &buf, 1)); 375 int nread = HANDLE_EINTR(read(socket, &buf, 1));
373 DCHECK_EQ(nread, 1); 376 DCHECK_EQ(nread, 1);
374 that->processed_io_events_ = true; 377 that->processed_io_events_ = true;
375 // Tell libevent to break out of inner loop. 378 // Tell libevent to break out of inner loop.
376 event_base_loopbreak(that->event_base_); 379 event_base_loopbreak(that->event_base_);
377 } 380 }
378 381
379 } // namespace base 382 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698