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

Issue 1453193002: autofill: switch autofill_regexes to RE2 library (Closed)

Created:
5 years, 1 month ago by tfarina
Modified:
5 years ago
CC:
chromium-reviews, droger+watchlist_chromium.org, rouslan+autofill_chromium.org, blundell+watchlist_chromium.org, sdefresne+watchlist_chromium.org, browser-components-watch_chromium.org, jdonnelly+autofillwatch_chromium.org, bondd+autofillwatch_chromium.org, vabr+watchlistautofill_chromium.org, estade+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

autofill: switch autofill_regexes to RE2 library This moves it away from using regex library from icu to the in-house re2 library that is known to have a better performance and be much more lightweight and much less verbose to write code. BUG=470065 TEST=components_unittests --gtest_filter=*Autofill* R=vabr@chromium.org,isherman@chromium.org Committed: https://crrev.com/2df535152b8023dc3dcbc7dd8c7f1a1e3d959e13 Cr-Commit-Position: refs/heads/master@{#363835}

Patch Set 1 #

Patch Set 2 : deps #

Total comments: 9

Patch Set 3 : std::string #

Patch Set 4 : fix #

Total comments: 1

Patch Set 5 : macros.h #

Total comments: 5

Patch Set 6 : case_insensitive #

Patch Set 7 : add TODO #

Patch Set 8 : input is UTF8 #

Total comments: 4

Patch Set 9 : pattern - ASCII- std::string #

Total comments: 3

Patch Set 10 : 14 tests failing #

Total comments: 14

Patch Set 11 : *Autofill* - all tests passed #

Total comments: 3

Patch Set 12 : lets see if the tests passes #

Patch Set 13 : REBASE - to see if the skia errors go way #

Patch Set 14 : another try #

Total comments: 2

Patch Set 15 : WORDBREAK macro #

Total comments: 6

Patch Set 16 : address reviews #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+164 lines, -215 lines) Patch
M components/autofill.gypi View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +1 line, -0 lines 0 comments Download
M components/autofill/core/browser/address_field.cc View 1 2 3 4 5 6 7 8 9 10 15 chunks +42 lines, -58 lines 2 comments Download
M components/autofill/core/browser/autofill_regex_constants.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 8 chunks +18 lines, -10 lines 0 comments Download
M components/autofill/core/browser/credit_card.cc View 1 2 3 4 5 6 7 8 1 chunk +1 line, -1 line 0 comments Download
M components/autofill/core/browser/credit_card_field.cc View 1 2 3 4 5 6 7 8 9 10 15 chunks +20 lines, -26 lines 0 comments Download
M components/autofill/core/browser/email_field.cc View 1 2 3 4 5 6 7 8 9 10 2 chunks +2 lines, -3 lines 0 comments Download
M components/autofill/core/browser/form_field.h View 1 2 3 4 5 6 7 8 9 4 chunks +5 lines, -5 lines 0 comments Download
M components/autofill/core/browser/form_field.cc View 1 2 3 4 5 6 7 8 9 10 6 chunks +6 lines, -7 lines 0 comments Download
M components/autofill/core/browser/form_field_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 2 chunks +34 lines, -56 lines 0 comments Download
M components/autofill/core/browser/name_field.cc View 1 2 3 4 5 6 7 8 9 10 6 chunks +8 lines, -13 lines 0 comments Download
M components/autofill/core/browser/phone_field.cc View 1 2 3 4 5 6 7 8 9 10 2 chunks +2 lines, -5 lines 0 comments Download
M components/autofill/core/browser/validation.cc View 1 2 3 4 5 6 7 8 2 chunks +3 lines, -3 lines 0 comments Download
M components/autofill/core/common/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +1 line, -0 lines 0 comments Download
A + components/autofill/core/common/DEPS View 0 chunks +-1 lines, --1 lines 0 comments Download
M components/autofill/core/common/autofill_regexes.h View 1 2 3 4 5 6 7 8 2 chunks +3 lines, -1 line 0 comments Download
M components/autofill/core/common/autofill_regexes.cc View 1 2 3 4 5 6 7 8 5 chunks +15 lines, -24 lines 0 comments Download
M components/autofill/core/common/autofill_regexes_unittest.cc View 1 2 3 4 5 6 7 8 2 chunks +4 lines, -4 lines 0 comments Download

Messages

Total messages: 56 (8 generated)
tfarina
PTAL. Is it correct? Am I missing some check?
5 years, 1 month ago (2015-11-17 19:28:41 UTC) #1
Ilya Sherman
https://codereview.chromium.org/1453193002/diff/20001/components/autofill/core/common/autofill_regexes.cc File components/autofill/core/common/autofill_regexes.cc (right): https://codereview.chromium.org/1453193002/diff/20001/components/autofill/core/common/autofill_regexes.cc#newcode65 components/autofill/core/common/autofill_regexes.cc:65: return matcher->ok(); Hmm, it looks like you aren't using ...
5 years, 1 month ago (2015-11-18 06:48:51 UTC) #2
vabr (Chromium)
Thanks for switching this one! I left some comments. Also, adding the tests as Ilya ...
5 years, 1 month ago (2015-11-18 09:26:36 UTC) #3
tfarina
PTAL! https://codereview.chromium.org/1453193002/diff/20001/components/autofill/core/common/autofill_regexes.cc File components/autofill/core/common/autofill_regexes.cc (right): https://codereview.chromium.org/1453193002/diff/20001/components/autofill/core/common/autofill_regexes.cc#newcode47 components/autofill/core/common/autofill_regexes.cc:47: re2::RE2* AutofillRegexes::GetMatcher(const base::string16& pattern) { On 2015/11/18 09:26:36, ...
5 years, 1 month ago (2015-11-18 18:03:10 UTC) #4
Ilya Sherman
Thanks, Thiago, for working on this! https://codereview.chromium.org/1453193002/diff/20001/components/autofill/core/common/autofill_regexes.cc File components/autofill/core/common/autofill_regexes.cc (right): https://codereview.chromium.org/1453193002/diff/20001/components/autofill/core/common/autofill_regexes.cc#newcode47 components/autofill/core/common/autofill_regexes.cc:47: re2::RE2* AutofillRegexes::GetMatcher(const base::string16& ...
5 years, 1 month ago (2015-11-19 02:09:00 UTC) #5
vabr (Chromium)
Thanks Thiago. Some clarification below. Cheers, Vaclav https://codereview.chromium.org/1453193002/diff/20001/components/autofill/core/common/autofill_regexes.cc File components/autofill/core/common/autofill_regexes.cc (right): https://codereview.chromium.org/1453193002/diff/20001/components/autofill/core/common/autofill_regexes.cc#newcode47 components/autofill/core/common/autofill_regexes.cc:47: re2::RE2* AutofillRegexes::GetMatcher(const ...
5 years, 1 month ago (2015-11-19 08:09:04 UTC) #6
tfarina
PTAL guys! https://codereview.chromium.org/1453193002/diff/20001/components/autofill/core/common/autofill_regexes.cc File components/autofill/core/common/autofill_regexes.cc (right): https://codereview.chromium.org/1453193002/diff/20001/components/autofill/core/common/autofill_regexes.cc#newcode47 components/autofill/core/common/autofill_regexes.cc:47: re2::RE2* AutofillRegexes::GetMatcher(const base::string16& pattern) { On 2015/11/19 ...
5 years, 1 month ago (2015-11-20 19:03:37 UTC) #7
Ilya Sherman
Thanks, Thiago. Please take a look at the test failures for your current patch. It ...
5 years, 1 month ago (2015-11-20 22:27:59 UTC) #8
vabr (Chromium)
Hi Thiago! I'm a bit confused by the name of the patch set 8. It ...
5 years, 1 month ago (2015-11-23 08:48:25 UTC) #9
tfarina
On 2015/11/23 08:48:25, vabr (Chromium) wrote: > Hi Thiago! > > I'm a bit confused ...
5 years, 1 month ago (2015-11-23 13:01:10 UTC) #10
vabr (Chromium)
On 2015/11/23 13:01:10, tfarina wrote: > On 2015/11/23 08:48:25, vabr (Chromium) wrote: > > Hi ...
5 years, 1 month ago (2015-11-23 13:07:25 UTC) #11
tfarina
On 2015/11/23 13:07:25, vabr (Chromium) wrote: > I see that Ilya already pointed that out ...
5 years, 1 month ago (2015-11-23 13:10:14 UTC) #12
vabr (Chromium)
On 2015/11/23 13:10:14, tfarina wrote: > On 2015/11/23 13:07:25, vabr (Chromium) wrote: > > I ...
5 years, 1 month ago (2015-11-23 14:03:13 UTC) #13
Evan Stade
https://codereview.chromium.org/1453193002/diff/140001/components/autofill/core/common/autofill_regexes.cc File components/autofill/core/common/autofill_regexes.cc (right): https://codereview.chromium.org/1453193002/diff/140001/components/autofill/core/common/autofill_regexes.cc#newcode23 components/autofill/core/common/autofill_regexes.cc:23: re2::RE2* GetMatcher(const base::string16& pattern); can you make this return ...
5 years, 1 month ago (2015-11-23 16:38:39 UTC) #15
tfarina
Ilya, I will try to put up your suggestion for the lookbehind later tonight. In ...
5 years ago (2015-11-25 17:20:23 UTC) #16
Evan Stade
https://codereview.chromium.org/1453193002/diff/160001/components/autofill/core/browser/form_field.cc File components/autofill/core/browser/form_field.cc (right): https://codereview.chromium.org/1453193002/diff/160001/components/autofill/core/browser/form_field.cc#newcode183 components/autofill/core/browser/form_field.cc:183: MatchesPattern(field->label, base::UTF16ToASCII(pattern))) { Yes, Ilya's suggestion is good :) ...
5 years ago (2015-11-25 19:33:01 UTC) #17
Ilya Sherman
https://codereview.chromium.org/1453193002/diff/160001/components/autofill/core/browser/form_field.cc File components/autofill/core/browser/form_field.cc (right): https://codereview.chromium.org/1453193002/diff/160001/components/autofill/core/browser/form_field.cc#newcode183 components/autofill/core/browser/form_field.cc:183: MatchesPattern(field->label, base::UTF16ToASCII(pattern))) { On 2015/11/25 19:33:01, Evan Stade wrote: ...
5 years ago (2015-11-25 22:18:15 UTC) #18
tfarina
https://codereview.chromium.org/1453193002/diff/160001/components/autofill/core/browser/form_field.cc File components/autofill/core/browser/form_field.cc (right): https://codereview.chromium.org/1453193002/diff/160001/components/autofill/core/browser/form_field.cc#newcode183 components/autofill/core/browser/form_field.cc:183: MatchesPattern(field->label, base::UTF16ToASCII(pattern))) { On 2015/11/25 22:18:14, Ilya Sherman wrote: ...
5 years ago (2015-11-26 00:56:34 UTC) #19
Ilya Sherman
Thanks, Thiago! This is getting pretty close =) https://codereview.chromium.org/1453193002/diff/180001/components/autofill/core/browser/address_field.cc File components/autofill/core/browser/address_field.cc (right): https://codereview.chromium.org/1453193002/diff/180001/components/autofill/core/browser/address_field.cc#newcode20 components/autofill/core/browser/address_field.cc:20: using ...
5 years ago (2015-11-26 02:25:09 UTC) #20
tfarina
Thanks for the support Ilya! PTAL. https://codereview.chromium.org/1453193002/diff/180001/components/autofill/core/browser/address_field.cc File components/autofill/core/browser/address_field.cc (right): https://codereview.chromium.org/1453193002/diff/180001/components/autofill/core/browser/address_field.cc#newcode20 components/autofill/core/browser/address_field.cc:20: using base::UTF8ToUTF16; On ...
5 years ago (2015-11-26 14:22:27 UTC) #23
vabr (Chromium)
Thanks, Thiago, LGTM! You improved this code very much, and even cut 60+ lines out ...
5 years ago (2015-11-26 14:47:42 UTC) #24
Ilya Sherman
LGTM % a final nit. Thanks, Thiago! https://codereview.chromium.org/1453193002/diff/200001/components/autofill/core/browser/address_field.cc File components/autofill/core/browser/address_field.cc (right): https://codereview.chromium.org/1453193002/diff/200001/components/autofill/core/browser/address_field.cc#newcode352 components/autofill/core/browser/address_field.cc:352: size_t saved_cursor ...
5 years ago (2015-11-26 20:55:29 UTC) #25
tfarina
Still have to fix the test failure of FormField::Match. components/autofill/core/browser/form_field_unittest.cc:93 Value of: FormField::Match(&field, "\\bcr\\b", FormField::MATCH_LABEL) ...
5 years ago (2015-11-26 21:04:20 UTC) #26
Ilya Sherman
On 2015/11/26 21:04:20, tfarina wrote: > Still have to fix the test failure of FormField::Match. ...
5 years ago (2015-11-26 21:32:33 UTC) #28
Evan Stade
On 2015/11/26 21:32:33, Ilya Sherman wrote: > On 2015/11/26 21:04:20, tfarina wrote: > > Still ...
5 years ago (2015-12-01 00:00:29 UTC) #29
Ilya Sherman
On 2015/12/01 00:00:29, Evan Stade wrote: > On 2015/11/26 21:32:33, Ilya Sherman wrote: > > ...
5 years ago (2015-12-01 00:13:48 UTC) #30
Evan Stade
On 2015/12/01 00:13:48, Ilya Sherman wrote: > On 2015/12/01 00:00:29, Evan Stade wrote: > > ...
5 years ago (2015-12-01 00:22:21 UTC) #31
Evan Stade
On 2015/12/01 00:22:21, Evan Stade wrote: > On 2015/12/01 00:13:48, Ilya Sherman wrote: > > ...
5 years ago (2015-12-01 00:23:01 UTC) #32
Ilya Sherman
On 2015/12/01 00:23:01, Evan Stade wrote: > On 2015/12/01 00:22:21, Evan Stade wrote: > > ...
5 years ago (2015-12-01 00:31:25 UTC) #33
Evan Stade
On 2015/12/01 00:31:25, Ilya Sherman wrote: > On 2015/12/01 00:23:01, Evan Stade wrote: > > ...
5 years ago (2015-12-01 00:34:05 UTC) #34
Ilya Sherman
On 2015/12/01 00:34:05, Evan Stade wrote: > On 2015/12/01 00:31:25, Ilya Sherman wrote: > > ...
5 years ago (2015-12-01 00:38:31 UTC) #35
tfarina
Thank you Evan and Ilya for saving this patch! You guys are awesome and rock ...
5 years ago (2015-12-01 19:51:00 UTC) #36
tfarina
Sorry for the delay Ilya! Looking at this now.
5 years ago (2015-12-04 19:27:55 UTC) #37
tfarina
Ilya, unfortunatelly the regex support of RE2 is very limited! https://github.com/google/re2/wiki/Syntax \A not \a (NOT ...
5 years ago (2015-12-04 21:00:06 UTC) #38
tfarina
Anyhow, I have green trybots with \\A. If it is OK I will look into ...
5 years ago (2015-12-05 01:05:03 UTC) #39
Ilya Sherman
On 2015/12/05 01:05:03, tfarina wrote: > Anyhow, I have green trybots with \\A. > > ...
5 years ago (2015-12-05 04:28:21 UTC) #40
tfarina
Ilya, I have updated autofill_regex_constants.cc. PTAL.
5 years ago (2015-12-07 23:31:28 UTC) #41
Ilya Sherman
Thanks, Thiago. LGTM % the remaining nits: https://codereview.chromium.org/1453193002/diff/260001/components/autofill/core/browser/form_field_unittest.cc File components/autofill/core/browser/form_field_unittest.cc (right): https://codereview.chromium.org/1453193002/diff/260001/components/autofill/core/browser/form_field_unittest.cc#newcode89 components/autofill/core/browser/form_field_unittest.cc:89: EXPECT_TRUE(FormField::Match(&field, "(\\A|\\z|\\PL)word(\\A|\\z|\\PL)", ...
5 years ago (2015-12-07 23:49:26 UTC) #42
Evan Stade
https://codereview.chromium.org/1453193002/diff/280001/components/autofill/core/browser/autofill_regex_constants.cc File components/autofill/core/browser/autofill_regex_constants.cc (right): https://codereview.chromium.org/1453193002/diff/280001/components/autofill/core/browser/autofill_regex_constants.cc#newcode11 components/autofill/core/browser/autofill_regex_constants.cc:11: #define WORDBREAK "(\\A|\\z|\\PL)" could you add a comment explaining ...
5 years ago (2015-12-07 23:56:10 UTC) #43
tfarina
https://codereview.chromium.org/1453193002/diff/260001/components/autofill/core/browser/form_field_unittest.cc File components/autofill/core/browser/form_field_unittest.cc (right): https://codereview.chromium.org/1453193002/diff/260001/components/autofill/core/browser/form_field_unittest.cc#newcode89 components/autofill/core/browser/form_field_unittest.cc:89: EXPECT_TRUE(FormField::Match(&field, "(\\A|\\z|\\PL)word(\\A|\\z|\\PL)", On 2015/12/07 23:49:25, Ilya Sherman wrote: > ...
5 years ago (2015-12-08 12:46:28 UTC) #44
Evan Stade
https://codereview.chromium.org/1453193002/diff/300001/components/autofill/core/browser/address_field.cc File components/autofill/core/browser/address_field.cc (right): https://codereview.chromium.org/1453193002/diff/300001/components/autofill/core/browser/address_field.cc#newcode245 components/autofill/core/browser/address_field.cc:245: // Ignore spurious matches for "United States". where is ...
5 years ago (2015-12-08 19:34:56 UTC) #45
Ilya Sherman
https://codereview.chromium.org/1453193002/diff/300001/components/autofill/core/browser/address_field.cc File components/autofill/core/browser/address_field.cc (right): https://codereview.chromium.org/1453193002/diff/300001/components/autofill/core/browser/address_field.cc#newcode245 components/autofill/core/browser/address_field.cc:245: // Ignore spurious matches for "United States". On 2015/12/08 ...
5 years ago (2015-12-08 20:02:28 UTC) #46
Evan Stade
lgtm
5 years ago (2015-12-08 20:05:47 UTC) #47
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1453193002/300001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1453193002/300001
5 years ago (2015-12-08 21:18:31 UTC) #50
commit-bot: I haz the power
Committed patchset #16 (id:300001)
5 years ago (2015-12-09 00:20:26 UTC) #52
commit-bot: I haz the power
Patchset 16 (id:??) landed as https://crrev.com/2df535152b8023dc3dcbc7dd8c7f1a1e3d959e13 Cr-Commit-Position: refs/heads/master@{#363835}
5 years ago (2015-12-09 00:21:38 UTC) #54
tfarina
Reverting this now. Will also revert the other one that introduced the re2 dependency.
5 years ago (2015-12-10 18:40:10 UTC) #55
tfarina
5 years ago (2015-12-10 18:41:49 UTC) #56
Message was sent while issue was closed.
A revert of this CL (patchset #16 id:300001) has been created in
https://codereview.chromium.org/1518783002/ by tfarina@chromium.org.

The reason for reverting is: This caused a memory perf regression on android.

BUG=568134.

Powered by Google App Engine
This is Rietveld 408576698