shill: Fix a crash on creation of Cellular device.
Main fix is that DeviceInfo doesn't create/manage kCellular devices thus
avoiding D-Bus path collisions. Also, create the Cellular device in a delayed
task because the WiFi comments say that D-Bus objects can't be registered in
signal callbacks.
Fixes bad dispatcher_ member initialization and missing manager_ initialization.
Adds a DispatchPendingEvents method to the event dispatcher useful for testing.
BUG=chromium-os:18228
TEST=unit tests, tested on device
Change-Id: Ib8859dfe59f7a3fd7b3978793dc8f38f22609db5
Reviewed-on: http://gerrit.chromium.org/gerrit/4771
Tested-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
diff --git a/shill_event.h b/shill_event.h
index 2484554..0b0322b 100644
--- a/shill_event.h
+++ b/shill_event.h
@@ -5,26 +5,26 @@
#ifndef SHILL_EVENT_
#define SHILL_EVENT_
-#include <vector>
-
#include <base/basictypes.h>
#include <base/callback_old.h>
#include <base/memory/ref_counted.h>
#include <base/memory/scoped_ptr.h>
#include <base/message_loop.h>
-#include "shill/io_handler.h"
-
namespace base {
class MessageLoopProxy;
} // namespace base
+
class Task;
namespace shill {
-// 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.
+class IOInputHandler;
+class InputData;
+
+// 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.
class EventDispatcher {
public:
EventDispatcher();
@@ -32,18 +32,23 @@
void DispatchForever();
+ // Processes all pending events that can run and returns.
+ void DispatchPendingEvents();
+
// These are thin wrappers around calls of the same name in
// <base/message_loop_proxy.h>
- bool PostTask(Task* task);
- bool PostDelayedTask(Task* task, int64 delay_ms);
+ bool PostTask(Task *task);
+ bool PostDelayedTask(Task *task, int64 delay_ms);
virtual IOInputHandler *CreateInputHandler(
int fd,
- Callback1<InputData*>::Type *callback);
+ Callback1<InputData *>::Type *callback);
private:
scoped_ptr<MessageLoop> dont_use_directly_;
scoped_refptr<base::MessageLoopProxy> message_loop_proxy_;
+
+ DISALLOW_COPY_AND_ASSIGN(EventDispatcher);
};
} // namespace shill