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

Unified Diff: components/autofill/core/browser/password_generator.cc

Issue 1192403003: Avoid checking of VerifyPassword() 2 times when generated password is proper. (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/password_generator.cc
diff --git a/components/autofill/core/browser/password_generator.cc b/components/autofill/core/browser/password_generator.cc
index 36964ad1ebd0931a291d8404c82dd06dbd664ed8..d66e062d53222b183c04335747ed65b003e057cf 100644
--- a/components/autofill/core/browser/password_generator.cc
+++ b/components/autofill/core/browser/password_generator.cc
@@ -88,21 +88,17 @@ std::string PasswordGenerator::Generate() const {
unsigned int mode = S_NB | S_CL | S_SL;
// gen_pron_pass() doesn't guarantee that it includes all of the type given
- // in mode, so regenerate a few times if neccessary.
- // TODO(gcasto): Is it worth regenerating at all?
- for (int i = 0; i < 10; ++i) {
- gen_pron_pass(password, unused_hypenated_password,
- password_length_, password_length_, mode);
- if (VerifyPassword(password))
- break;
- }
-
- // If the password still isn't conforming after a few iterations, force it
- // to be so. This may change a syllable in the password.
+ // in mode, so if generated password is not proper we will force fix this by
+ // |ForceFixPassword| as lowercase letters are default in generated password.
AKV 2015/06/22 09:39:18 Can we reduce this password generation loop furthe
Deepak 2015/06/22 10:50:31 ok, I will raise the bug and discuss this.
+ gen_pron_pass(password, unused_hypenated_password, password_length_,
+ password_length_, mode);
+ if (VerifyPassword(password))
+ return std::string(password);
AKV 2015/06/22 09:39:18 Looks legitimate.
Deepak 2015/06/22 10:50:31 Done.
+
+ // As the password isn't conforming force it to be so. This may change a
+ // syllable in the password.
std::string str_password(password);
- if (!VerifyPassword(str_password)) {
- ForceFixPassword(&str_password);
- }
+ ForceFixPassword(&str_password);
return str_password;
}
« 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