OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #ifndef BASE_MESSAGE_LOOP_H_ | 5 #ifndef BASE_MESSAGE_LOOP_H_ |
6 #define BASE_MESSAGE_LOOP_H_ | 6 #define BASE_MESSAGE_LOOP_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <queue> | 9 #include <queue> |
10 #include <string> | 10 #include <string> |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 bool WaitForIOCompletion(DWORD timeout, IOHandler* filter); | 466 bool WaitForIOCompletion(DWORD timeout, IOHandler* filter); |
467 | 467 |
468 protected: | 468 protected: |
469 // TODO(rvargas): Make this platform independent. | 469 // TODO(rvargas): Make this platform independent. |
470 base::MessagePumpForIO* pump_io() { | 470 base::MessagePumpForIO* pump_io() { |
471 return static_cast<base::MessagePumpForIO*>(pump_.get()); | 471 return static_cast<base::MessagePumpForIO*>(pump_.get()); |
472 } | 472 } |
473 | 473 |
474 #elif defined(OS_POSIX) | 474 #elif defined(OS_POSIX) |
475 typedef base::MessagePumpLibevent::Watcher Watcher; | 475 typedef base::MessagePumpLibevent::Watcher Watcher; |
476 typedef base::MessagePumpLibevent::FileDescriptorWatcher | 476 typedef base::MessagePumpLibevent::FileWatcher FileWatcher; |
477 FileDescriptorWatcher; | |
478 | 477 |
479 enum Mode { | 478 // Please see MessagePumpLibevent for definitions of these methods. |
480 WATCH_READ = base::MessagePumpLibevent::WATCH_READ, | 479 void WatchSocket(int socket, short interest_mask, |
481 WATCH_WRITE = base::MessagePumpLibevent::WATCH_WRITE, | 480 struct event* e, Watcher* watcher); |
482 WATCH_READ_WRITE = base::MessagePumpLibevent::WATCH_READ_WRITE | 481 void WatchFileHandle(int fd, short interest_mask, event* e, FileWatcher*); |
483 }; | 482 void UnwatchSocket(struct event* e); |
484 | 483 void UnwatchFileHandle(event* e); |
485 // Please see MessagePumpLibevent for definition. | |
486 bool WatchFileDescriptor(int fd, | |
487 bool persistent, | |
488 Mode mode, | |
489 FileDescriptorWatcher *controller, | |
490 Watcher *delegate); | |
491 #endif // defined(OS_POSIX) | 484 #endif // defined(OS_POSIX) |
492 }; | 485 }; |
493 | 486 |
494 // Do not add any member variables to MessageLoopForIO! This is important b/c | 487 // Do not add any member variables to MessageLoopForIO! This is important b/c |
495 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra | 488 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra |
496 // data that you need should be stored on the MessageLoop's pump_ instance. | 489 // data that you need should be stored on the MessageLoop's pump_ instance. |
497 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), | 490 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), |
498 MessageLoopForIO_should_not_have_extra_member_variables); | 491 MessageLoopForIO_should_not_have_extra_member_variables); |
499 | 492 |
500 #endif // BASE_MESSAGE_LOOP_H_ | 493 #endif // BASE_MESSAGE_LOOP_H_ |
OLD | NEW |