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

Side by Side Diff: components/autofill/core/browser/personal_data_manager.cc

Issue 2398253003: Early exit from autofill profile de-duplication if <2 profiles. (Closed)
Patch Set: Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/autofill/core/browser/personal_data_manager.h" 5 #include "components/autofill/core/browser/personal_data_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <list> 10 #include <list>
(...skipping 1632 matching lines...) Expand 10 before | Expand all | Expand 10 after
1643 SetProfiles(&profiles); 1643 SetProfiles(&profiles);
1644 } 1644 }
1645 1645
1646 bool PersonalDataManager::ApplyDedupingRoutine() { 1646 bool PersonalDataManager::ApplyDedupingRoutine() {
1647 if (!is_autofill_profile_dedupe_pending_) 1647 if (!is_autofill_profile_dedupe_pending_)
1648 return false; 1648 return false;
1649 1649
1650 DCHECK(IsAutofillProfileCleanupEnabled()); 1650 DCHECK(IsAutofillProfileCleanupEnabled());
1651 is_autofill_profile_dedupe_pending_ = false; 1651 is_autofill_profile_dedupe_pending_ = false;
1652 1652
1653 // Check if the deduping routine has already been run on this major version. 1653 // No need to de-duplicate if there are less than two profiles.
1654 if (web_profiles_.get().size() < 2) {
1655 DVLOG(1) << "Autofill profile de-duplication not needed.";
1656 return false;
1657 }
1658
1659 // Check if de-duplication has already been performed this major version.
1654 int current_major_version = atoi(version_info::GetVersionNumber().c_str()); 1660 int current_major_version = atoi(version_info::GetVersionNumber().c_str());
1655 if (pref_service_->GetInteger(prefs::kAutofillLastVersionDeduped) >= 1661 if (pref_service_->GetInteger(prefs::kAutofillLastVersionDeduped) >=
1656 current_major_version) { 1662 current_major_version) {
1657 DVLOG(1) 1663 DVLOG(1)
1658 << "Autofill profile de-duplication already performed for this version"; 1664 << "Autofill profile de-duplication already performed for this version";
1659 return false; 1665 return false;
1660 } 1666 }
1661 1667
1662 DVLOG(1) << "Starting autofill profile de-duplication."; 1668 DVLOG(1) << "Starting autofill profile de-duplication.";
1663 std::vector<AutofillProfile*> existing_profiles = web_profiles_.get(); 1669 std::vector<AutofillProfile*> existing_profiles = web_profiles_.get();
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
1756 if (profile_to_merge->IsVerified()) 1762 if (profile_to_merge->IsVerified())
1757 break; 1763 break;
1758 } 1764 }
1759 } 1765 }
1760 } 1766 }
1761 AutofillMetrics::LogNumberOfProfilesRemovedDuringDedupe( 1767 AutofillMetrics::LogNumberOfProfilesRemovedDuringDedupe(
1762 profiles_to_delete->size()); 1768 profiles_to_delete->size());
1763 } 1769 }
1764 1770
1765 } // namespace autofill 1771 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698