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

Issue 8921006: Standardize StringToInt{,64} interface. (Closed)

Created:
9 years ago by Ted Vessenes
Modified:
9 years ago
CC:
chromium-reviews, cbentzel+watch_chromium.org, Paweł Hajdan Jr., darin-cc_chromium.org, jshin+watch_chromium.org, brettw-cc_chromium.org
Base URL:
http://git.chromium.org/chromium/src.git@master
Visibility:
Public.

Description

Standardize StringToInt{,64} interface. These changes address issue #106655. All variants of StringToInt have been converted to use the StringPiece class. One instance of conversion, in chrome/browser/history/text_database.cc, required copying an underlying string. This is because the string type in question could use 8 or 16 bit characters depending on the OS type, and because StringPiece is not implemented as a template, the code cannot specify whether to create a StringPiece or StringPiece16. This should be remedied in a future CL. R=erikwright@chromium.org BUG=106655 TEST= Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=114929 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=114944 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=114993

Patch Set 1 #

Patch Set 2 : Updated StringPiece constructor interface to use iterators. #

Total comments: 10

Patch Set 3 : Update formatting and convert HexStringToInt() calls. #

Total comments: 8

Patch Set 4 : More formatting updates. #

Total comments: 3

Patch Set 5 : Add another round of formatting changes. #

Total comments: 7

Patch Set 6 : Fix namespace issues. #

Total comments: 5

Patch Set 7 : Explicitly qualify namespace for StringPiece. #

Patch Set 8 : Remove needless include file. #

Patch Set 9 : Rebase of CL onto latest sync. #

Patch Set 10 : Convert StringToInt interface in performance test. #

Patch Set 11 : Fix uses of StringToInt() in Windows and Mac code. #

Total comments: 1

Patch Set 12 : Explicitly compute string length for Mac code. #

Patch Set 13 : Fix more bugs in interfaces of tests. #

Total comments: 1

Patch Set 14 : Correct substring extraction. #

Patch Set 15 : Revert changes to extensions_helper.cc. #

Patch Set 16 : Verify StringPiece iterators are correctly oriented. #

Total comments: 1

Patch Set 17 : Guarantee StringPiece has NULL pointer when given zero length string. #

Patch Set 18 : Fix call syntax of StringToInt() in Chrome OS code. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+164 lines, -304 lines) Patch
M AUTHORS View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +1 line, -0 lines 0 comments Download
M base/mac/mac_util.mm View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +4 lines, -1 line 0 comments Download
M base/string_number_conversions.h View 1 2 3 chunks +6 lines, -32 lines 0 comments Download
M base/string_number_conversions.cc View 1 2 3 4 5 5 chunks +34 lines, -115 lines 0 comments Download
M base/string_number_conversions_unittest.cc View 1 2 6 chunks +0 lines, -90 lines 0 comments Download
M base/string_piece.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 2 chunks +8 lines, -0 lines 0 comments Download
M base/sys_info_chromeos.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 2 chunks +7 lines, -6 lines 0 comments Download
M chrome/browser/autocomplete_history_manager.cc View 1 2 3 4 5 6 7 8 2 chunks +17 lines, -10 lines 0 comments Download
M chrome/browser/chromeos/login/default_user_images.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 2 chunks +3 lines, -2 lines 0 comments Download
M chrome/browser/component_updater/component_updater_service.cc View 1 2 3 2 chunks +6 lines, -2 lines 0 comments Download
M chrome/browser/history/text_database.cc View 1 2 3 4 5 6 7 1 chunk +7 lines, -2 lines 0 comments Download
M chrome/browser/profiles/profile_info_cache.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 2 chunks +4 lines, -2 lines 0 comments Download
M chrome/browser/safe_browsing/filter_false_positive_perftest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +3 lines, -1 line 0 comments Download
M chrome/browser/safe_browsing/safe_browsing_blocking_page.cc View 1 2 3 4 5 6 7 8 2 chunks +4 lines, -2 lines 0 comments Download
M chrome/common/extensions/extension.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 2 chunks +6 lines, -2 lines 0 comments Download
M chrome/test/perf/page_cycler_test.cc View 1 2 3 4 5 6 7 8 9 2 chunks +3 lines, -2 lines 0 comments Download
M chrome_frame/test/test_server.cc View 1 2 3 4 5 6 7 8 9 10 2 chunks +3 lines, -2 lines 0 comments Download
M chrome_frame/utils.cc View 1 2 3 4 5 6 7 8 9 10 2 chunks +4 lines, -1 line 0 comments Download
M net/base/net_util.cc View 1 2 3 4 5 1 chunk +2 lines, -2 lines 0 comments Download
M net/base/x509_cert_types.cc View 1 2 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download
M net/ftp/ftp_ctrl_response_buffer.cc View 1 2 3 4 5 6 7 8 2 chunks +6 lines, -4 lines 0 comments Download
M net/ftp/ftp_util.cc View 1 2 3 3 chunks +15 lines, -12 lines 0 comments Download
M net/http/http_chunked_decoder.cc View 1 2 3 1 chunk +5 lines, -3 lines 0 comments Download
M net/http/http_response_headers.cc View 1 2 3 6 chunks +11 lines, -9 lines 0 comments Download
M net/proxy/proxy_bypass_rules.cc View 1 2 3 4 5 6 2 chunks +4 lines, -1 line 0 comments Download

Messages

Total messages: 74 (0 generated)
Ted Vessenes
9 years ago (2011-12-12 14:27:58 UTC) #1
erikwright (departed)
Brett: I'd like your opinion on this (in particular, string_piece.h). Firstly, I think an iterator ...
9 years ago (2011-12-12 18:49:51 UTC) #2
brettw
Yeah, I think we should go with the iterator constructor only which more closely matches ...
9 years ago (2011-12-12 18:58:59 UTC) #3
Ted Vessenes
Just to clarify, we're talking about iterator range constructors for StringPiece, not iterator invocations for ...
9 years ago (2011-12-12 21:52:13 UTC) #4
erikwright (departed)
That's the intention. See http://codereview.chromium.org/8846001/ . On Dec 12, 2011 4:52 PM, <tedvessenes@gmail.com> wrote: > ...
9 years ago (2011-12-12 21:57:42 UTC) #5
Ted Vessenes
Alright, I updated the interfaces accordingly. Using iterators turned out to be surprisingly less ugly ...
9 years ago (2011-12-13 17:21:24 UTC) #6
erikwright (departed)
Looking good. 1) A few things missed in your tidying up. 2) Would be nice ...
9 years ago (2011-12-13 20:20:45 UTC) #7
Ted Vessenes
I updated the formatting per request, and also converted HexStringToInt(). I also noticed a HexStringToBytes() ...
9 years ago (2011-12-14 03:34:59 UTC) #8
erikwright (departed)
It's looking really great. A few more style comments here. As you might have noticed, ...
9 years ago (2011-12-14 04:24:08 UTC) #9
Ted Vessenes
Hopefully that's the last round of formatting updates. Yes, I've signed the contributor agreement.
9 years ago (2011-12-14 04:44:41 UTC) #10
erikwright (departed)
LGTM with nits. Brett, PTAL at base/... and chrome/... Chris, PTAL at net/... I will ...
9 years ago (2011-12-14 05:29:57 UTC) #11
Ted Vessenes
Thanks for the information on splitting up long template lines. Made those consistent. I also ...
9 years ago (2011-12-14 16:25:38 UTC) #12
erikwright (departed)
On 2011/12/14 16:25:38, tedv wrote: > Thanks for the information on splitting up long template ...
9 years ago (2011-12-14 16:38:29 UTC) #13
Ted Vessenes
When visiting a campsite, leave it in better condition than you found it, even if ...
9 years ago (2011-12-14 16:42:59 UTC) #14
cbentzel
http://codereview.chromium.org/8921006/diff/17001/base/string_number_conversions.h File base/string_number_conversions.h (right): http://codereview.chromium.org/8921006/diff/17001/base/string_number_conversions.h#newcode63 base/string_number_conversions.h:63: BASE_EXPORT bool StringToInt(const StringPiece16& input, int* output); Is there ...
9 years ago (2011-12-14 16:54:09 UTC) #15
erikwright (departed)
http://codereview.chromium.org/8921006/diff/17001/base/string_number_conversions.h File base/string_number_conversions.h (right): http://codereview.chromium.org/8921006/diff/17001/base/string_number_conversions.h#newcode63 base/string_number_conversions.h:63: BASE_EXPORT bool StringToInt(const StringPiece16& input, int* output); On 2011/12/14 ...
9 years ago (2011-12-14 17:01:09 UTC) #16
Ted Vessenes
> http://codereview.chromium.org/8921006/diff/17001/base/string_number_conversions.h#newcode63 > base/string_number_conversions.h:63: BASE_EXPORT bool StringToInt(const > StringPiece16& input, int* output); > Is there ...
9 years ago (2011-12-14 17:04:02 UTC) #17
erikwright (departed)
Unfortunately, the CL that is pending would not change the signatures here, because we would ...
9 years ago (2011-12-14 17:12:07 UTC) #18
brettw
base LGTM, I didn't look at the rest. http://codereview.chromium.org/8921006/diff/17001/base/string_number_conversions.cc File base/string_number_conversions.cc (right): http://codereview.chromium.org/8921006/diff/17001/base/string_number_conversions.cc#newcode373 base/string_number_conversions.cc:373: namespace ...
9 years ago (2011-12-14 17:25:47 UTC) #19
Ted Vessenes
Fixed the namespace nitpicks and left the StringToInt() interface as written. Let me know if ...
9 years ago (2011-12-14 17:53:25 UTC) #20
cbentzel
LGTM http://codereview.chromium.org/8921006/diff/22004/net/base/x509_cert_types.cc File net/base/x509_cert_types.cc (right): http://codereview.chromium.org/8921006/diff/22004/net/base/x509_cert_types.cc#newcode13 net/base/x509_cert_types.cc:13: using base::StringPiece; Remove this using declaration. http://codereview.chromium.org/8921006/diff/22004/net/proxy/proxy_bypass_rules.cc File ...
9 years ago (2011-12-14 18:14:54 UTC) #21
Ted Vessenes
Removed those "using" declarations and, anticipating similar feedback from other OWNERS, removed a few others ...
9 years ago (2011-12-14 19:05:24 UTC) #22
erikwright (departed)
Hi Ted, I'll take OWNER responsibility for the chrome/ stuff. I had in-flight comments for ...
9 years ago (2011-12-14 19:09:58 UTC) #23
Ted Vessenes
Removed that include file per request.
9 years ago (2011-12-14 19:21:44 UTC) #24
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/tedvessenes@gmail.com/8921006/21005
9 years ago (2011-12-14 19:22:23 UTC) #25
commit-bot: I haz the power
Presubmit check for 8921006-21005 failed and returned exit status 1. Running presubmit commit checks ...
9 years ago (2011-12-14 19:22:36 UTC) #26
erikwright (departed)
mal, PTAL at chrome/browser/component_updater/component_updater_service.cc mirandac, PTAL at chrome/browser/profiles/profile_info_cache.cc Thanks, Erik
9 years ago (2011-12-14 20:21:07 UTC) #27
Mark Larson
LGTM for changes in component updater
9 years ago (2011-12-14 23:47:30 UTC) #28
Miranda Callahan
On 2011/12/14 23:47:30, Mark Larson wrote: > LGTM > for changes in component updater profiles/* ...
9 years ago (2011-12-15 08:37:09 UTC) #29
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/tedvessenes@gmail.com/8921006/21005
9 years ago (2011-12-15 13:44:31 UTC) #30
commit-bot: I haz the power
Can't apply patch for file chrome/browser/autocomplete_history_manager.cc. While running patch -p1 --forward --force; patching file chrome/browser/autocomplete_history_manager.cc ...
9 years ago (2011-12-15 13:44:39 UTC) #31
Ted Vessenes
Fixed the merge conflict and uploaded a version rebased onto the latest sync. This *should* ...
9 years ago (2011-12-15 17:32:25 UTC) #32
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/tedvessenes@gmail.com/8921006/27001
9 years ago (2011-12-15 20:09:33 UTC) #33
commit-bot: I haz the power
Try job failure for 8921006-27001 (retry) on linux_rel for step "compile" (clobber build). It's a ...
9 years ago (2011-12-15 20:45:57 UTC) #34
Ted Vessenes
Failures were caused by a performance test that was still using the StringToInt(begin_iter, end_iter, &val) ...
9 years ago (2011-12-15 20:50:15 UTC) #35
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/tedvessenes@gmail.com/8921006/37001
9 years ago (2011-12-15 21:58:26 UTC) #36
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/tedvessenes@gmail.com/8921006/31003
9 years ago (2011-12-16 03:53:08 UTC) #37
erikwright (departed)
http://codereview.chromium.org/8921006/diff/31003/base/mac/mac_util.mm File base/mac/mac_util.mm (right): http://codereview.chromium.org/8921006/diff/31003/base/mac/mac_util.mm#newcode525 base/mac/mac_util.mm:525: if (!base::StringToInt(base::StringPiece(uname_info.release, dot), Does this work because a std::string::iterator ...
9 years ago (2011-12-16 03:56:33 UTC) #38
Ted Vessenes
Yes, that's the reason it works. I was a bit suspicious when I saw the ...
9 years ago (2011-12-16 04:00:51 UTC) #39
grt (UTC plus 2)
On 2011/12/16 04:00:51, tedv wrote: > Yes, that's the reason it works. I was a ...
9 years ago (2011-12-16 04:16:53 UTC) #40
commit-bot: I haz the power
Try job failure for 8921006-31003 (retry) on mac_rel for step "compile" (clobber build). It's a ...
9 years ago (2011-12-16 04:44:27 UTC) #41
Ted Vessenes
Fragile is an understatement-- apparently it doesn't build at all. Now I'm curious how the ...
9 years ago (2011-12-16 05:44:52 UTC) #42
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/tedvessenes@gmail.com/8921006/36004
9 years ago (2011-12-16 11:43:53 UTC) #43
commit-bot: I haz the power
Try job failure for 8921006-36004 (retry) on win_rel for step "compile" (clobber build). It's a ...
9 years ago (2011-12-16 12:13:12 UTC) #44
Ted Vessenes
Is this a legitimate compilation failure or just flakiness in the windows test machines? I've ...
9 years ago (2011-12-16 16:53:39 UTC) #45
erikwright (departed)
Near as I can tell, the second failure was spurious, but the first one was ...
9 years ago (2011-12-16 16:56:03 UTC) #46
Ted Vessenes
I just audited all files matching '*test*cc' for inconsistent StringToInt() interfaces and that appears to ...
9 years ago (2011-12-16 17:11:44 UTC) #47
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/tedvessenes@gmail.com/8921006/31027
9 years ago (2011-12-16 20:51:13 UTC) #48
commit-bot: I haz the power
Presubmit check for 8921006-31027 failed and returned exit status 1. Running presubmit commit checks ...
9 years ago (2011-12-16 20:51:27 UTC) #49
erikwright (departed)
http://codereview.chromium.org/8921006/diff/31027/chrome/browser/sync/test/integration/extensions_helper.cc File chrome/browser/sync/test/integration/extensions_helper.cc (right): http://codereview.chromium.org/8921006/diff/31027/chrome/browser/sync/test/integration/extensions_helper.cc#newcode118 chrome/browser/sync/test/integration/extensions_helper.cc:118: !base::StringToInt(base::StringPiece(name, strlen(extension_name_prefix)), Are you sure this works? Looks like ...
9 years ago (2011-12-16 21:05:49 UTC) #50
Ted Vessenes
Thanks for the catch; I mentally parsed the original code as name.substr(0, strlen(extension_name_prefix)); On 2011/12/16 ...
9 years ago (2011-12-16 21:19:39 UTC) #51
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/tedvessenes@gmail.com/8921006/34008
9 years ago (2011-12-16 21:22:49 UTC) #52
commit-bot: I haz the power
Presubmit check for 8921006-34008 failed and returned exit status 1. Running presubmit commit checks ...
9 years ago (2011-12-16 21:23:03 UTC) #53
Ted Vessenes
Given that the update to chrome/browser/sync/test/integration/extensions_helper.cc are largely aesthetic and would require another review, I'm ...
9 years ago (2011-12-16 21:33:14 UTC) #54
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/tedvessenes@gmail.com/8921006/41051
9 years ago (2011-12-16 21:33:32 UTC) #55
commit-bot: I haz the power
Try job failure for 8921006-41051 (retry) on win_rel for step "net_unittests". It's a second try, ...
9 years ago (2011-12-16 23:49:44 UTC) #56
Ted Vessenes
It's hard to say without a windows build in front of me, but the hang ...
9 years ago (2011-12-16 23:55:35 UTC) #57
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/tedvessenes@gmail.com/8921006/44001
9 years ago (2011-12-17 17:18:02 UTC) #58
Ted Vessenes
I added the sanity check of "begin <= end" in StringPiece construction, even though it ...
9 years ago (2011-12-17 18:12:54 UTC) #59
erikwright (departed)
http://codereview.chromium.org/8921006/diff/44001/base/string_piece.h File base/string_piece.h (right): http://codereview.chromium.org/8921006/diff/44001/base/string_piece.h#newcode65 base/string_piece.h:65: : ptr_(&(*begin)), length_((end > begin) ? (size_type)(end - begin) ...
9 years ago (2011-12-17 18:17:01 UTC) #60
Ted Vessenes
This might be philosophical, but the code should probably use >=, so that a zero ...
9 years ago (2011-12-17 18:24:21 UTC) #61
erikwright (departed)
On 2011/12/17 18:24:21, tedv wrote: > This might be philosophical, but the code should probably ...
9 years ago (2011-12-17 18:28:27 UTC) #62
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/tedvessenes@gmail.com/8921006/45004
9 years ago (2011-12-17 18:54:44 UTC) #63
commit-bot: I haz the power
Change committed as 114929
9 years ago (2011-12-17 21:35:30 UTC) #64
Ryan Sleevi
This got reverted for making the ASAN bots red, reporting buffer overflows. Looks like there ...
9 years ago (2011-12-17 22:31:07 UTC) #65
erikwright (departed)
On 2011/12/17 22:31:07, Ryan Sleevi wrote: > This got reverted for making the ASAN bots ...
9 years ago (2011-12-18 00:48:44 UTC) #66
Ted Vessenes
On 2011/12/18 00:48:44, erikwright wrote: > It looks like the build containing the revert similarly ...
9 years ago (2011-12-18 01:02:02 UTC) #67
Ryan Sleevi
On 2011/12/18 00:48:44, erikwright wrote: > On 2011/12/17 22:31:07, Ryan Sleevi wrote: > > This ...
9 years ago (2011-12-18 06:33:52 UTC) #68
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/tedvessenes@gmail.com/8921006/45004
9 years ago (2011-12-18 15:50:57 UTC) #69
commit-bot: I haz the power
Change committed as 114944
9 years ago (2011-12-18 17:16:30 UTC) #70
Ted Vessenes
I've uploaded fixes for compiler breakage on Chrome OS. As apparently cros bots are not ...
9 years ago (2011-12-18 23:53:36 UTC) #71
battre
On 2011/12/18 23:53:36, tedv wrote: > I've uploaded fixes for compiler breakage on Chrome OS. ...
9 years ago (2011-12-19 09:46:20 UTC) #72
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/tedvessenes@gmail.com/8921006/40004
9 years ago (2011-12-19 14:21:06 UTC) #73
commit-bot: I haz the power
9 years ago (2011-12-19 16:10:57 UTC) #74
Change committed as 114993

Powered by Google App Engine
This is Rietveld 408576698