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::FileWatcher FileWatcher; | 476 typedef base::MessagePumpLibevent::FileDescriptorWatcher |
| 477 FileDescriptorWatcher; |
477 | 478 |
478 // Please see MessagePumpLibevent for definitions of these methods. | 479 enum Mode { |
479 void WatchSocket(int socket, short interest_mask, | 480 WATCH_READ = base::MessagePumpLibevent::WATCH_READ, |
480 struct event* e, Watcher* watcher); | 481 WATCH_WRITE = base::MessagePumpLibevent::WATCH_WRITE, |
481 void WatchFileHandle(int fd, short interest_mask, event* e, FileWatcher*); | 482 WATCH_READ_WRITE = base::MessagePumpLibevent::WATCH_READ_WRITE |
482 void UnwatchSocket(struct event* e); | 483 }; |
483 void UnwatchFileHandle(event* e); | 484 |
| 485 // Please see MessagePumpLibevent for definition. |
| 486 bool WatchFileDescriptor(int fd, |
| 487 bool persistent, |
| 488 Mode mode, |
| 489 FileDescriptorWatcher *controller, |
| 490 Watcher *delegate); |
484 #endif // defined(OS_POSIX) | 491 #endif // defined(OS_POSIX) |
485 }; | 492 }; |
486 | 493 |
487 // Do not add any member variables to MessageLoopForIO! This is important b/c | 494 // Do not add any member variables to MessageLoopForIO! This is important b/c |
488 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra | 495 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra |
489 // data that you need should be stored on the MessageLoop's pump_ instance. | 496 // data that you need should be stored on the MessageLoop's pump_ instance. |
490 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), | 497 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), |
491 MessageLoopForIO_should_not_have_extra_member_variables); | 498 MessageLoopForIO_should_not_have_extra_member_variables); |
492 | 499 |
493 #endif // BASE_MESSAGE_LOOP_H_ | 500 #endif // BASE_MESSAGE_LOOP_H_ |
OLD | NEW |