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

Unified Diff: dbus/bus.h

Issue 12022004: D-Bus: ObjectProxy remove function for Bus object. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Calls made from the right thread. Created 7 years, 11 months 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
« no previous file with comments | « no previous file | dbus/bus.cc » ('j') | dbus/bus.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dbus/bus.h
diff --git a/dbus/bus.h b/dbus/bus.h
index 75de9a3d1e240d51b81ba208ff910df2a5df3942..7d00756529cbc19dbecdf9cf3bc756c326fd0bd1 100644
--- a/dbus/bus.h
+++ b/dbus/bus.h
@@ -202,6 +202,14 @@ class CHROME_DBUS_EXPORT Bus : public base::RefCountedThreadSafe<Bus> {
// - whether ownership has been obtained or not.
typedef base::Callback<void (const std::string&, bool)> OnOwnershipCallback;
+ // Called when an object proxy removal is complete.
+ // Parameters identify the removed object proxy:
+ // - the service name.
+ // - the object path.
+ // - options
+ typedef base::Callback<void (const std::string&, const ObjectPath&, int)>
+ OnRemoveObjectProxyCallback;
+
// Gets the object proxy for the given service name and the object path.
// The caller must not delete the returned object.
//
@@ -230,6 +238,42 @@ class CHROME_DBUS_EXPORT Bus : public base::RefCountedThreadSafe<Bus> {
const ObjectPath& object_path,
int options);
+ // Removes the previously created object proxy for the given service
+ // name and the object path and releases its memory.
+ //
+ // If and object proxy for the given service name and object was
+ // created with GetObjectProxy, this function removes it from the
+ // bus object and detaches the ObjectProxy, invalidating any pointer
+ // previously acquired for it with GetObjectProxy. A subsequent call
+ // to GetObjectProxy will return a new object.
+ //
+ // All the object proxies are detached from remote objects at the
+ // shutdown time of the bus, but they can be detached early to reduce
+ // memory footprint and used match rules for the bus connection.
+ //
+ // |service_name| looks like "org.freedesktop.NetworkManager", and
+ // |object_path| looks like "/org/freedesktop/NetworkManager/Devices/0".
+ // |callback| is called when the object proxy is successfully removed and
+ // detached.
+ //
+ // The function returns true when there is an object proxy matching the
+ // |service_name| and |object_path| to remove, and calls |callback| when it
+ // is removed. Otherwise, it returns false and the |callback| function is
+ // never called.
+ //
+ // Must be called in the origin thread.
+ virtual bool RemoveObjectProxy(const std::string& service_name,
+ const ObjectPath& object_path,
+ OnRemoveObjectProxyCallback callback);
+
+ // Same as above, but also takes a bitfield of ObjectProxy::Options.
+ // See object_proxy.h for available options.
+ virtual bool RemoveObjectProxyWithOptions(
+ const std::string& service_name,
+ const ObjectPath& object_path,
+ int options,
+ OnRemoveObjectProxyCallback callback);
+
// Gets the exported object for the given object path.
// The caller must not delete the returned object.
//
@@ -449,6 +493,19 @@ class CHROME_DBUS_EXPORT Bus : public base::RefCountedThreadSafe<Bus> {
private:
friend class base::RefCountedThreadSafe<Bus>;
+ // Helper function used for RemoveObjectProxy().
+ void RemoveObjectProxyInternal(scoped_refptr<dbus::ObjectProxy> object_proxy,
+ const std::string& service_name,
+ const dbus::ObjectPath& object_path,
+ int options,
+ OnRemoveObjectProxyCallback callback);
+
+ // Called when the object proxy removal is completed.
+ void OnRemoveObjectProxy(OnRemoveObjectProxyCallback callback,
+ const std::string& service_name,
+ const dbus::ObjectPath& object_path,
+ int options);
+
// Helper function used for UnregisterExportedObject().
void UnregisterExportedObjectInternal(
scoped_refptr<dbus::ExportedObject> exported_object);
« no previous file with comments | « no previous file | dbus/bus.cc » ('j') | dbus/bus.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698