shill: Add "IO Ready" handler
For output sockets and for non-traditional "input" events we
need to trigger when an fd is ready, but we don't want GLib
to be in charge of the IO itself. For this, we create a
"ready handler" which triggers a callback which is passed the
file descriptor which is ready.
BUG=chromium-os:21664
TEST=New unit tests
Change-Id: I4960658e6d0940d8db65ae6f77ff09679b3ef96a
Reviewed-on: http://gerrit.chromium.org/gerrit/10327
Reviewed-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
diff --git a/event_dispatcher.h b/event_dispatcher.h
index d540fbd..5ca886e 100644
--- a/event_dispatcher.h
+++ b/event_dispatcher.h
@@ -11,6 +11,8 @@
#include <base/memory/scoped_ptr.h>
#include <base/message_loop.h>
+#include "shill/io_handler.h"
+
namespace base {
class MessageLoopProxy;
} // namespace base
@@ -19,9 +21,6 @@
namespace shill {
-class InputData;
-class IOHandler;
-
// This is the main event dispatcher. It contains a central instance, and is
// the entity responsible for dispatching events out of all queues to their
// listeners during the idle loop.
@@ -44,6 +43,11 @@
int fd,
Callback1<InputData *>::Type *callback);
+ virtual IOHandler *CreateReadyHandler(
+ int fd,
+ IOHandler::ReadyMode mode,
+ Callback1<int>::Type *callback);
+
private:
scoped_ptr<MessageLoop> dont_use_directly_;
scoped_refptr<base::MessageLoopProxy> message_loop_proxy_;