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

Unified Diff: components/autofill/core/browser/webdata/autofill_table.cc

Issue 1198013002: Avoiding Vectors usage while setting info in AutofillProfile. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/autofill/core/browser/webdata/autofill_table.cc
diff --git a/components/autofill/core/browser/webdata/autofill_table.cc b/components/autofill/core/browser/webdata/autofill_table.cc
index b9468bb2a51ddec27b3c3692b6f593ea57909492..5de1097701afb1454b14e34c09322d2532674371 100644
--- a/components/autofill/core/browser/webdata/autofill_table.cc
+++ b/components/autofill/core/browser/webdata/autofill_table.cc
@@ -200,31 +200,15 @@ bool AddAutofillProfileNamesToProfile(sql::Connection* db,
if (!s.is_valid())
return false;
- std::vector<base::string16> first_names;
- std::vector<base::string16> middle_names;
- std::vector<base::string16> last_names;
- std::vector<base::string16> full_names;
- while (s.Step()) {
+ if (s.Step()) {
DCHECK_EQ(profile->guid(), s.ColumnString(0));
- first_names.push_back(s.ColumnString16(1));
- middle_names.push_back(s.ColumnString16(2));
- last_names.push_back(s.ColumnString16(3));
- full_names.push_back(s.ColumnString16(4));
+ profile->SetRawInfo(NAME_FIRST, s.ColumnString16(1));
+ profile->SetRawInfo(NAME_MIDDLE, s.ColumnString16(2));
+ profile->SetRawInfo(NAME_LAST, s.ColumnString16(3));
+ profile->SetRawInfo(NAME_FULL, s.ColumnString16(4));
AKV 2015/06/22 10:00:38 s.Succeded() needs to be checked whether Query for
Deepak 2015/06/22 11:31:51 Done.
+ return true;
}
- if (!s.Succeeded())
- return false;
-
- // TODO(estade): update schema so these aren't vectors.
- first_names.resize(1);
- middle_names.resize(1);
- last_names.resize(1);
- full_names.resize(1);
-
- profile->SetRawInfo(NAME_FIRST, first_names[0]);
- profile->SetRawInfo(NAME_MIDDLE, middle_names[0]);
- profile->SetRawInfo(NAME_LAST, last_names[0]);
- profile->SetRawInfo(NAME_FULL, full_names[0]);
- return true;
+ return false;
}
bool AddAutofillProfileEmailsToProfile(sql::Connection* db,
@@ -238,18 +222,12 @@ bool AddAutofillProfileEmailsToProfile(sql::Connection* db,
if (!s.is_valid())
return false;
- std::vector<base::string16> emails;
- while (s.Step()) {
+ if (s.Step()) {
DCHECK_EQ(profile->guid(), s.ColumnString(0));
- emails.push_back(s.ColumnString16(1));
+ profile->SetRawInfo(EMAIL_ADDRESS, s.ColumnString16(1));
+ return true;
}
- if (!s.Succeeded())
- return false;
-
- // TODO(estade): update schema so this is not a vector.
- emails.resize(1);
- profile->SetRawInfo(EMAIL_ADDRESS, emails[0]);
- return true;
+ return false;
}
bool AddAutofillProfilePhonesToProfile(sql::Connection* db,
@@ -263,18 +241,12 @@ bool AddAutofillProfilePhonesToProfile(sql::Connection* db,
if (!s.is_valid())
return false;
- std::vector<base::string16> numbers;
- while (s.Step()) {
+ if (s.Step()) {
DCHECK_EQ(profile->guid(), s.ColumnString(0));
- numbers.push_back(s.ColumnString16(1));
+ profile->SetRawInfo(PHONE_HOME_WHOLE_NUMBER, s.ColumnString16(1));
+ return true;
}
- if (!s.Succeeded())
- return false;
-
- // TODO(estade): update schema so this isn't a vector.
- numbers.resize(1);
- profile->SetRawInfo(PHONE_HOME_WHOLE_NUMBER, numbers[0]);
- return true;
+ return false;
}
bool AddAutofillProfileNames(const AutofillProfile& profile,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698