Chromium Code Reviews| Index: components/autofill/core/browser/webdata/autofill_wallet_syncable_service.cc |
| diff --git a/components/autofill/core/browser/webdata/autofill_wallet_syncable_service.cc b/components/autofill/core/browser/webdata/autofill_wallet_syncable_service.cc |
| index 971e2009eaf9b4699c6cc94df21a9012160e6e40..5667a3f8a4a2bbe2b9ca47c1a5848e6d57488fe3 100644 |
| --- a/components/autofill/core/browser/webdata/autofill_wallet_syncable_service.cc |
| +++ b/components/autofill/core/browser/webdata/autofill_wallet_syncable_service.cc |
| @@ -123,11 +123,11 @@ AutofillProfile ProfileFromSpecifics( |
| // The credit card's IDs do not change over time. |
| void CopyBillingAddressesFromDisk(AutofillTable* table, |
| std::vector<CreditCard>* cards_from_server) { |
| - ScopedVector<CreditCard> cards_on_disk; |
| - table->GetServerCreditCards(&cards_on_disk.get()); |
| + std::vector<std::unique_ptr<CreditCard>> cards_on_disk; |
| + table->GetServerCreditCards(&cards_on_disk); |
| // The reasons behind brute-force search are explained in SetDataIfChanged. |
| - for (const CreditCard* saved_card : cards_on_disk) { |
| + for (const auto& saved_card : cards_on_disk) { |
| for (CreditCard& server_card : *cards_from_server) { |
| if (saved_card->server_id() == server_card.server_id()) { |
| server_card.set_billing_address_id(saved_card->billing_address_id()); |
| @@ -150,15 +150,15 @@ void CopyBillingAddressesFromDisk(AutofillTable* table, |
| // |
| // Returns true if anything changed. The previous number of items in the table |
| // (for sync tracking) will be placed into *prev_item_count. |
| -template<class Data> |
| +template <class Data> |
| bool SetDataIfChanged( |
| AutofillTable* table, |
| const std::vector<Data>& data, |
| - bool (AutofillTable::*getter)(std::vector<Data*>*), |
| + bool (AutofillTable::*getter)(std::vector<std::unique_ptr<Data>>*), |
| void (AutofillTable::*setter)(const std::vector<Data>&), |
| size_t* prev_item_count) { |
| - ScopedVector<Data> existing_data; |
| - (table->*getter)(&existing_data.get()); |
| + std::vector<std::unique_ptr<Data>> existing_data; |
| + (table->*getter)(&existing_data); |
| *prev_item_count = existing_data.size(); |
| // If the user has a large number of addresses, don't bother verifying |
| @@ -177,9 +177,9 @@ bool SetDataIfChanged( |
| // compares). A std::set only uses operator< requiring multiple calls to |
| // check equality, giving 8 compares for 2 elements and 16 for 3. For these |
| // set sizes, brute force O(n^2) is faster. |
| - for (const Data* cur_existing : existing_data) { |
| + for (const auto& cur_existing : existing_data) { |
| bool found_match_for_cur_existing = false; |
| - for (const Data& cur_new : data) { |
| + for (const auto& cur_new : data) { |
|
vabr (Chromium)
2016/10/14 07:24:43
Here I would prefer the original "const Data&" to
Avi (use Gerrit)
2016/10/16 20:05:54
Done.
|
| if (cur_existing->Compare(cur_new) == 0) { |
| found_match_for_cur_existing = true; |
| break; |