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

Unified Diff: chrome/browser/webdata/web_database.cc

Issue 5610002: Don't re-save autofill profiles to the web database if they haven't changed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Denitting Created 10 years 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 | « chrome/browser/webdata/web_database.h ('k') | chrome/browser/webdata/web_database_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/webdata/web_database.cc
diff --git a/chrome/browser/webdata/web_database.cc b/chrome/browser/webdata/web_database.cc
index 2b9c0298cdabe8ba21f7536daf3ac9f36dcf21aa..89325c22d3c206935557d2ab82e2dad3c83dc8b1 100644
--- a/chrome/browser/webdata/web_database.cc
+++ b/chrome/browser/webdata/web_database.cc
@@ -1693,6 +1693,14 @@ bool WebDatabase::GetAutoFillProfiles(
bool WebDatabase::UpdateAutoFillProfile(const AutoFillProfile& profile) {
DCHECK(guid::IsValidGUID(profile.guid()));
+
+ // Preserve appropriate modification dates by not updating unchanged profiles.
+ AutoFillProfile* tmp_profile = NULL;
+ DCHECK(GetAutoFillProfileForGUID(profile.guid(), &tmp_profile));
+ scoped_ptr<AutoFillProfile> old_profile(tmp_profile);
+ if (*old_profile == profile)
+ return true;
+
sql::Statement s(db_.GetUniqueStatement(
"UPDATE autofill_profiles "
"SET guid=?, label=?, first_name=?, middle_name=?, last_name=?, "
@@ -1813,6 +1821,14 @@ bool WebDatabase::GetCreditCards(
bool WebDatabase::UpdateCreditCard(const CreditCard& credit_card) {
DCHECK(guid::IsValidGUID(credit_card.guid()));
+
+ // Preserve appropriate modification dates by not updating unchanged cards.
+ CreditCard* tmp_credit_card = NULL;
+ DCHECK(GetCreditCardForGUID(credit_card.guid(), &tmp_credit_card));
+ scoped_ptr<CreditCard> old_credit_card(tmp_credit_card);
+ if (*old_credit_card == credit_card)
+ return true;
+
sql::Statement s(db_.GetUniqueStatement(
"UPDATE credit_cards "
"SET guid=?, label=?, name_on_card=?, expiration_month=?, "
« no previous file with comments | « chrome/browser/webdata/web_database.h ('k') | chrome/browser/webdata/web_database_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698