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

Unified Diff: chromeos/network/network_profile_handler.cc

Issue 679673002: Reduce runtime of client_cert_resolver_unittest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
Index: chromeos/network/network_profile_handler.cc
diff --git a/chromeos/network/network_profile_handler.cc b/chromeos/network/network_profile_handler.cc
index c8353cc622532a5b74e00e52ff142de5b4a6d1f3..2f678444b58c5cae3ce7d28056dc6873188efad2 100644
--- a/chromeos/network/network_profile_handler.cc
+++ b/chromeos/network/network_profile_handler.cc
@@ -111,17 +111,18 @@ void NetworkProfileHandler::OnPropertyChanged(const std::string& name,
}
}
- for (std::vector<std::string>::const_iterator it =
- removed_profile_paths.begin();
- it != removed_profile_paths.end(); ++it) {
- RemoveProfile(*it);
+ for (const std::string profile_path : removed_profile_paths) {
Joao da Silva 2014/10/24 12:01:06 const& (you can also use const auto&)
pneubeck (no reviews) 2014/10/24 12:33:52 Done.
+ RemoveProfile(profile_path);
+ // Also stop pending creations of this profile.
+ pending_profile_creations_.erase(profile_path);
}
for (std::vector<std::string>::const_iterator it = new_profile_paths.begin();
it != new_profile_paths.end(); ++it) {
// Skip known profiles. The associated userhash should never change.
- if (GetProfileForPath(*it))
+ if (GetProfileForPath(*it) || pending_profile_creations_.count(*it) > 0)
continue;
+ pending_profile_creations_.insert(*it);
VLOG(2) << "Requesting properties of profile path " << *it << ".";
DBusThreadManager::Get()->GetShillProfileClient()->GetProperties(
@@ -136,6 +137,14 @@ void NetworkProfileHandler::OnPropertyChanged(const std::string& name,
void NetworkProfileHandler::GetProfilePropertiesCallback(
const std::string& profile_path,
const base::DictionaryValue& properties) {
+ if (pending_profile_creations_.erase(profile_path) == 0) {
+ VLOG(1) << "Ignore received properties, profile was removed.";
+ return;
+ }
+ if (GetProfileForPath(profile_path)) {
+ VLOG(1) << "Ignore received properties, profile is already created.";
+ return;
+ }
std::string userhash;
properties.GetStringWithoutPathExpansion(shill::kUserHashProperty, &userhash);

Powered by Google App Engine
This is Rietveld 408576698