| Index: src/service_manager.h
|
| diff --git a/src/service_manager.h b/src/service_manager.h
|
| index e12fd91503cfb92119166f6cad63103a599b79f4..f248025806da7872f44a790e418858c0bc42ac96 100644
|
| --- a/src/service_manager.h
|
| +++ b/src/service_manager.h
|
| @@ -5,6 +5,8 @@
|
| #ifndef SRC_SERVICE_MANAGER_H_
|
| #define SRC_SERVICE_MANAGER_H_
|
|
|
| +#include <glib.h>
|
| +
|
| #include <map>
|
| #include <string>
|
| #include <vector>
|
| @@ -22,6 +24,9 @@ class CashewServer;
|
| // map of service path names to Service objects
|
| typedef std::map<std::string, Service*> ServiceMap;
|
|
|
| +// vector of Service objects
|
| +typedef std::vector<Service*> ServiceList;
|
| +
|
| // vector of DBus::Path objects (strings) representing service path names
|
| typedef std::vector<DBus::Path> ServicePathList;
|
|
|
| @@ -30,7 +35,8 @@ class ServiceManager : public org::chromium::flimflam::Manager_proxy,
|
| public DBus::IntrospectableProxy,
|
| public DBus::ObjectProxy {
|
| public:
|
| - explicit ServiceManager(DBus::Connection& connection); // NOLINT
|
| + explicit ServiceManager(DBus::Connection& connection, // NOLINT
|
| + GMainLoop * const main_loop);
|
| virtual ~ServiceManager();
|
|
|
| // look up a service by its path name
|
| @@ -92,11 +98,20 @@ class ServiceManager : public org::chromium::flimflam::Manager_proxy,
|
| // set the retrying flag
|
| virtual void OnRetryingGetProperties(bool retrying);
|
|
|
| + // get deferred service deletion source id
|
| + virtual guint GetDeferredServiceDeletionSourceId() const;
|
| +
|
| + // set deferred service deletion source id
|
| + virtual void SetDeferredServiceDeletionSourceId(guint source_id);
|
| +
|
| private:
|
| // D-Bus connection owned by our creator
|
| // shared with Service objs that we create
|
| DBus::Connection& connection_;
|
|
|
| + // glib main loop
|
| + GMainLoop * const main_loop_;
|
| +
|
| // collection of Service objs representing cellular services
|
| ServiceMap services_;
|
|
|
| @@ -123,8 +138,29 @@ class ServiceManager : public org::chromium::flimflam::Manager_proxy,
|
| // and our subsequent timer calls
|
| bool retrying_get_properties_;
|
|
|
| + // Service 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
|
| + ServiceList services_pending_deletion_;
|
| +
|
| + // glib source id for deferred service deletion
|
| + guint deferred_service_deletion_source_id_;
|
| +
|
| // delete a collection of services
|
| - void DeleteServices(ServiceMap *service_map);
|
| + // deletes services immediately if |defer| == false
|
| + // schedules services for later deletion if |defer| == true
|
| + void DeleteServices(ServiceMap *service_map, bool defer);
|
| +
|
| + // deletes members of |services_pending_deletion_| immediately
|
| + void DeletePendingServices();
|
| +
|
| + // schedule service for later deletion from the main loop
|
| + void ScheduleServiceForLaterDeletion(Service *service);
|
| +
|
| + // glib integration: static wrapper for DeletePendingServices
|
| + // takes object ptr as data and invokes object->DeletePendingServices()
|
| + // does not reschedule itself to run again
|
| + static gboolean StaticDeletePendingServicesCallback(gpointer data);
|
|
|
| // glib integration: static wrapper for GetFlimflamProperties
|
| // takes object ptr as data and invokes object->GetFlimflamProperties()
|
|
|