diff options
author | hashimoto <hashimoto@chromium.org> | 2014-12-03 23:41:55 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-12-04 07:43:18 +0000 |
commit | b387031e67c39435464223512280a3aa2393d61a (patch) | |
tree | cee9138a2bb3745088ae857303eae0f4a89fa57c /dbus/object_proxy.cc | |
parent | 411962a23428ac3b2ca00aa43d20118d0c3b78a9 (diff) | |
download | chromium_src-b387031e67c39435464223512280a3aa2393d61a.zip chromium_src-b387031e67c39435464223512280a3aa2393d61a.tar.gz chromium_src-b387031e67c39435464223512280a3aa2393d61a.tar.bz2 |
Remove dbus::ObjectProxy::filter_added_
Bus::Add/RemoveFilterFunction is already performing duplication check.
BUG=None
Review URL: https://codereview.chromium.org/747903004
Cr-Commit-Position: refs/heads/master@{#306781}
Diffstat (limited to 'dbus/object_proxy.cc')
-rw-r--r-- | dbus/object_proxy.cc | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/dbus/object_proxy.cc b/dbus/object_proxy.cc index 59584f2..c11f1fe 100644 --- a/dbus/object_proxy.cc +++ b/dbus/object_proxy.cc @@ -55,7 +55,6 @@ ObjectProxy::ObjectProxy(Bus* bus, : bus_(bus), service_name_(service_name), object_path_(object_path), - filter_added_(false), ignore_service_unknown_errors_( options & IGNORE_SERVICE_UNKNOWN_ERRORS) { } @@ -202,11 +201,8 @@ void ObjectProxy::WaitForServiceToBeAvailable( void ObjectProxy::Detach() { bus_->AssertOnDBusThread(); - if (filter_added_) { - if (!bus_->RemoveFilterFunction(&ObjectProxy::HandleMessageThunk, this)) { - LOG(ERROR) << "Failed to remove filter function"; - } - } + if (bus_->is_connected()) + bus_->RemoveFilterFunction(&ObjectProxy::HandleMessageThunk, this); for (std::set<std::string>::iterator iter = match_rules_.begin(); iter != match_rules_.end(); ++iter) { @@ -377,15 +373,8 @@ bool ObjectProxy::ConnectToNameOwnerChangedSignal() { if (!bus_->Connect() || !bus_->SetUpAsyncOperations()) return false; - // We should add the filter only once. Otherwise, HandleMessage() will - // be called more than once. - if (!filter_added_) { - if (bus_->AddFilterFunction(&ObjectProxy::HandleMessageThunk, this)) { - filter_added_ = true; - } else { - LOG(ERROR) << "Failed to add filter function"; - } - } + bus_->AddFilterFunction(&ObjectProxy::HandleMessageThunk, this); + // Add a match_rule listening NameOwnerChanged for the well-known name // |service_name_|. const std::string name_owner_changed_match_rule = |