8
8
9
9
#include < memory>
10
10
11
+ #include " base/containers/contains.h"
11
12
#include " base/files/file_descriptor_watcher_posix.h"
12
13
#include " base/functional/bind.h"
13
14
#include " base/logging.h"
@@ -555,7 +556,7 @@ bool Bus::RequestOwnershipAndBlock(const std::string& service_name,
555
556
AssertOnDBusThread ();
556
557
557
558
// Check if we already own the service name.
558
- if (owned_service_names_. find (service_name) != owned_service_names_. end ( )) {
559
+ if (base::Contains ( owned_service_names_, service_name )) {
559
560
return true ;
560
561
}
561
562
@@ -694,8 +695,7 @@ void Bus::AddFilterFunction(DBusHandleMessageFunction filter_function,
694
695
695
696
std::pair<DBusHandleMessageFunction, void *> filter_data_pair =
696
697
std::make_pair (filter_function, user_data);
697
- if (filter_functions_added_.find (filter_data_pair) !=
698
- filter_functions_added_.end ()) {
698
+ if (base::Contains (filter_functions_added_, filter_data_pair)) {
699
699
VLOG (1 ) << " Filter function already exists: " << filter_function
700
700
<< " with associated data: " << user_data;
701
701
return ;
@@ -716,8 +716,7 @@ void Bus::RemoveFilterFunction(DBusHandleMessageFunction filter_function,
716
716
717
717
std::pair<DBusHandleMessageFunction, void *> filter_data_pair =
718
718
std::make_pair (filter_function, user_data);
719
- if (filter_functions_added_.find (filter_data_pair) ==
720
- filter_functions_added_.end ()) {
719
+ if (!base::Contains (filter_functions_added_, filter_data_pair)) {
721
720
VLOG (1 ) << " Requested to remove an unknown filter function: "
722
721
<< filter_function
723
722
<< " with associated data: " << user_data;
@@ -812,8 +811,7 @@ bool Bus::TryRegisterObjectPathInternal(
812
811
base::ScopedBlockingCall scoped_blocking_call (FROM_HERE,
813
812
base::BlockingType::MAY_BLOCK);
814
813
815
- if (registered_object_paths_.find (object_path) !=
816
- registered_object_paths_.end ()) {
814
+ if (base::Contains (registered_object_paths_, object_path)) {
817
815
LOG (ERROR) << " Object path already registered: " << object_path.value ();
818
816
return false ;
819
817
}
@@ -834,8 +832,7 @@ void Bus::UnregisterObjectPath(const ObjectPath& object_path) {
834
832
DCHECK (connection_);
835
833
AssertOnDBusThread ();
836
834
837
- if (registered_object_paths_.find (object_path) ==
838
- registered_object_paths_.end ()) {
835
+ if (!base::Contains (registered_object_paths_, object_path)) {
839
836
LOG (ERROR) << " Requested to unregister an unknown object path: "
840
837
<< object_path.value ();
841
838
return ;
0 commit comments