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

Unified Diff: src/service.h

Issue 5333003: cashew: do not delete DBus::ObjectProxy objects from D-Bus callbacks (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/cashew.git@master
Patch Set: Address more djkurtz review comments Created 10 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« src/main.cc ('K') | « src/main.cc ('k') | src/service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/service.h
diff --git a/src/service.h b/src/service.h
index 5143fedc82df265006a4c0da6e80769160db5d93..7bda6728f73a871e7783921dfd24e26f65c90a7e 100644
--- a/src/service.h
+++ b/src/service.h
@@ -11,6 +11,7 @@
#include <map>
#include <string>
+#include <vector>
#include <base/basictypes.h> // NOLINT
#include <dbus-c++/dbus.h> // NOLINT
@@ -28,6 +29,9 @@ class ServiceManager;
// map of key, value pairs representing service properties received via D-Bus
typedef std::map<std::string, DBus::Variant> PropertyMap;
+// vector of Device objects
+typedef std::vector<Device*> DeviceList;
+
// represents a cellular service and monitors Flimflam state for that service
class Service : public org::chromium::flimflam::Service_proxy,
public DBus::IntrospectableProxy,
@@ -143,6 +147,12 @@ class Service : public org::chromium::flimflam::Service_proxy,
// set the retrying flag
virtual void OnRetryingGetProperties(bool retrying);
+ // get deferred device deletion source id
+ virtual guint GetDeferredDeviceDeletionSourceId() const;
+
+ // set deferred device deletion source id
+ virtual void SetDeferredDeviceDeletionSourceId(guint source_id);
+
private:
// back pointer to our parent ServiceManager
ServiceManager * const parent_;
@@ -199,6 +209,24 @@ class Service : public org::chromium::flimflam::Service_proxy,
// finer-grained connectivity info applicable when |state_| == kStateReady
ConnectivityState connectivity_state_;
+ // Device objects pending deletion from the main loop
+ // We need to do this to work around a dbus-c++ deadlock issue that arises
+ // when we send a D-Bus message from a D-Bus callback
+ DeviceList devices_pending_deletion_;
+
+ // glib source id for deferred device deletion
+ guint deferred_device_deletion_source_id_;
+
+ // deletes members of |devices_pending_deletion_| immediately
+ void DeletePendingDevices();
+
+ // schedule a device for later deletion from the main loop
+ void ScheduleDeviceForLaterDeletion(Device *device);
+
+ // glib integration: static wrapper for DeletePendingDevices
+ // takes object ptr as data and invokes object->DeletePendingDevices()
+ static gboolean StaticDeletePendingDevicesCallback(gpointer data);
+
// convert connectivity state string to ConnectivityState enum value
static ConnectivityState ConnectivityStateFromString(
const std::string& connectivity_state);
« src/main.cc ('K') | « src/main.cc ('k') | src/service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698