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

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: satorux comments in unittest 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') | no next file with comments »
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..054525843522e8dd6fd5c77d0090bed17d56a67a 100644
--- a/dbus/bus.h
+++ b/dbus/bus.h
@@ -201,6 +201,8 @@ class CHROME_DBUS_EXPORT Bus : public base::RefCountedThreadSafe<Bus> {
// - the requested service name.
// - whether ownership has been obtained or not.
typedef base::Callback<void (const std::string&, bool)> OnOwnershipCallback;
+ // TODO(satorux): Remove the service name parameter as the caller of
+ // RequestOwnership() knows the service name.
// Gets the object proxy for the given service name and the object path.
// The caller must not delete the returned object.
@@ -230,6 +232,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. The |callback| argument must not be null.
+ //
+ // Must be called in the origin thread.
+ virtual bool RemoveObjectProxy(const std::string& service_name,
+ const ObjectPath& object_path,
+ const base::Closure& 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,
+ const base::Closure& callback);
+
// Gets the exported object for the given object path.
// The caller must not delete the returned object.
//
@@ -449,6 +487,10 @@ 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 base::Closure& callback);
+
// Helper function used for UnregisterExportedObject().
void UnregisterExportedObjectInternal(
scoped_refptr<dbus::ExportedObject> exported_object);
@@ -460,11 +502,6 @@ class CHROME_DBUS_EXPORT Bus : public base::RefCountedThreadSafe<Bus> {
void RequestOwnershipInternal(const std::string& service_name,
OnOwnershipCallback on_ownership_callback);
- // Called when the ownership request is completed.
- void OnOwnership(OnOwnershipCallback on_ownership_callback,
- const std::string& service_name,
- bool success);
-
// Processes the all incoming data to the connection, if any.
//
// BLOCKING CALL.
« no previous file with comments | « no previous file | dbus/bus.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698