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

Unified Diff: dbus/object_manager.cc

Issue 1074963003: Clean up potentially leaky use of base::DeletePointer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed another probleb Created 5 years, 8 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 | « dbus/object_manager.h ('k') | dbus/object_proxy.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dbus/object_manager.cc
diff --git a/dbus/object_manager.cc b/dbus/object_manager.cc
index 851fee44b2e140b41c39b6bc8b190319252c6b08..46d70b7b23096d47e1f11287639ae1da75657b88 100644
--- a/dbus/object_manager.cc
+++ b/dbus/object_manager.cc
@@ -289,17 +289,16 @@ DBusHandlerResult ObjectManager::HandleMessage(DBusConnection* connection,
if (bus_->HasDBusThread()) {
// Post a task to run the method in the origin thread. Transfer ownership of
// |signal| to NotifyPropertiesChanged, which will handle the clean up.
- Signal* released_signal = signal.release();
bus_->GetOriginTaskRunner()->PostTask(
FROM_HERE,
base::Bind(&ObjectManager::NotifyPropertiesChanged,
this, path,
- released_signal));
+ base::Passed(&signal)));
} else {
// If the D-Bus thread is not used, just call the callback on the
// current thread. Transfer the ownership of |signal| to
// NotifyPropertiesChanged.
- NotifyPropertiesChanged(path, signal.release());
+ NotifyPropertiesChanged(path, signal.Pass());
}
// We don't return DBUS_HANDLER_RESULT_HANDLED for signals because other
@@ -309,16 +308,16 @@ DBusHandlerResult ObjectManager::HandleMessage(DBusConnection* connection,
void ObjectManager::NotifyPropertiesChanged(
const dbus::ObjectPath object_path,
- Signal* signal) {
+ scoped_ptr<Signal> signal) {
DCHECK(bus_);
bus_->AssertOnOriginThread();
- NotifyPropertiesChangedHelper(object_path, signal);
+ NotifyPropertiesChangedHelper(object_path, signal.get());
// Delete the message on the D-Bus thread. See comments in HandleMessage.
bus_->GetDBusTaskRunner()->PostTask(
FROM_HERE,
- base::Bind(&base::DeletePointer<Signal>, signal));
+ base::Bind(&base::DeletePointer<Signal>, base::Passed(&signal)));
}
void ObjectManager::NotifyPropertiesChangedHelper(
« no previous file with comments | « dbus/object_manager.h ('k') | dbus/object_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698