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

Issue 8236002: Create StringOrdinal to allow placement of strings in sorted lists (Closed)

Created:
9 years, 2 months ago by csharp
Modified:
9 years, 1 month ago
CC:
chromium-reviews, Paweł Hajdan Jr., SteveT, tfarina
Visibility:
Public.

Description

Create StringOrdinal to allow placement of strings in sorted lists The StringOrdinal class is intended to allow sorted lists of strings to be treated as floating point numbers, and can be used to create a value to be sorted into any index location, allowing an element to change it's index without any other elements having to change their index value. BUG=94662 TEST=Unit tests created in chrome/common/string_ordinal_unittest.cc Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=107566

Patch Set 1 #

Total comments: 19

Patch Set 2 : Adjusting code to comply with code review requests #

Total comments: 8

Patch Set 3 : Fixing issue with StringIndex overflow #

Patch Set 4 : Adding unit test for overflow #

Patch Set 5 : Changing StringIndex to a class #

Total comments: 30

Patch Set 6 : Cleanup of StringIndex #

Patch Set 7 : Add comment about copy and assignment of StringIndex #

Total comments: 25

Patch Set 8 : Changing StringIndex to StringOrdinal and making code review changes. #

Total comments: 45

Patch Set 9 : Adjusting code to comply with code review comments #

Total comments: 19

Patch Set 10 : Modifying DropUnneededDigits logic and code review changes #

Total comments: 9

Patch Set 11 : Small cleanup #

Total comments: 10

Patch Set 12 : Reverting some lines #

Patch Set 13 : Removing temporary string from DropUnneededDigits #

Total comments: 8

Patch Set 14 : Clarifying name of GetLengthWithTrailingZeros #

Total comments: 8

Patch Set 15 : Fixing out of bounds issue in GetLengthWithoutTrailingZeros #

Patch Set 16 : Clearer comment for AddHalf failing and extra test for its loop #

Total comments: 4

Patch Set 17 : Fixing StringOrdinal comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+431 lines, -0 lines) Patch
M chrome/chrome_common.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/chrome_tests.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +1 line, -0 lines 0 comments Download
A chrome/common/string_ordinal.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +72 lines, -0 lines 0 comments Download
A chrome/common/string_ordinal.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +240 lines, -0 lines 0 comments Download
A chrome/common/string_ordinal_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +116 lines, -0 lines 0 comments Download

Messages

Total messages: 44 (0 generated)
csharp1
One thing I'm not sure about in this code is that the middle string will ...
9 years, 2 months ago (2011-10-11 15:47:35 UTC) #1
akalin
http://codereview.chromium.org/8236002/diff/1/chrome/common/string_index.cc File chrome/common/string_index.cc (right): http://codereview.chromium.org/8236002/diff/1/chrome/common/string_index.cc#newcode7 chrome/common/string_index.cc:7: StringIndex::StringIndex(): kMaxDigitValue(kMaxDigit - kZeroDigit), surely you don't need these ...
9 years, 2 months ago (2011-10-11 19:34:39 UTC) #2
akalin
On 2011/10/11 15:47:35, csharp1 wrote: > One thing I'm not sure about in this code ...
9 years, 2 months ago (2011-10-11 19:34:54 UTC) #3
csharp1
I've made most of the changes you suggested but I've failure right now so I ...
9 years, 2 months ago (2011-10-11 21:46:03 UTC) #4
akalin
http://codereview.chromium.org/8236002/diff/1/chrome/common/string_index.cc File chrome/common/string_index.cc (right): http://codereview.chromium.org/8236002/diff/1/chrome/common/string_index.cc#newcode25 chrome/common/string_index.cc:25: ++value[position - 1]; On 2011/10/11 21:46:03, csharp1 wrote: > ...
9 years, 2 months ago (2011-10-11 22:00:24 UTC) #5
csharp1
Ok, I've made the changes requested and have all the tests passing. I also ended ...
9 years, 2 months ago (2011-10-12 15:31:12 UTC) #6
akalin
http://codereview.chromium.org/8236002/diff/1/chrome/common/string_index.cc File chrome/common/string_index.cc (right): http://codereview.chromium.org/8236002/diff/1/chrome/common/string_index.cc#newcode25 chrome/common/string_index.cc:25: ++value[position - 1]; On 2011/10/12 15:31:12, csharp1 wrote: > ...
9 years, 2 months ago (2011-10-12 18:13:07 UTC) #7
akalin
http://codereview.chromium.org/8236002/diff/8001/chrome/common/string_index.cc File chrome/common/string_index.cc (right): http://codereview.chromium.org/8236002/diff/8001/chrome/common/string_index.cc#newcode27 chrome/common/string_index.cc:27: DCHECK(value[position - 1] <= kMaxDigit); as I mentioned previously, ...
9 years, 2 months ago (2011-10-12 18:50:14 UTC) #8
csharp1
http://codereview.chromium.org/8236002/diff/1/chrome/common/string_index.cc File chrome/common/string_index.cc (right): http://codereview.chromium.org/8236002/diff/1/chrome/common/string_index.cc#newcode25 chrome/common/string_index.cc:25: ++value[position - 1]; Ok, I made a unit test ...
9 years, 2 months ago (2011-10-12 18:52:46 UTC) #9
csharp1
http://codereview.chromium.org/8236002/diff/14001/chrome/common/string_index.cc File chrome/common/string_index.cc (right): http://codereview.chromium.org/8236002/diff/14001/chrome/common/string_index.cc#newcode108 chrome/common/string_index.cc:108: if (add_half && EqualValueIndexs(middle_string,start.ToString())) { Note that if middle_string.length() ...
9 years, 2 months ago (2011-10-13 16:07:07 UTC) #10
akalin
more comments http://codereview.chromium.org/8236002/diff/14001/chrome/common/string_index.cc File chrome/common/string_index.cc (right): http://codereview.chromium.org/8236002/diff/14001/chrome/common/string_index.cc#newcode10 chrome/common/string_index.cc:10: static const std::string kInvalidStringIndex = ""; static ...
9 years, 2 months ago (2011-10-14 10:16:29 UTC) #11
csharp1
I didn't change string_index_ to constant because if I do, then the class is no ...
9 years, 2 months ago (2011-10-14 16:52:36 UTC) #12
akalin
On Fri, Oct 14, 2011 at 9:52 AM, <csharp@google.com> wrote: > I didn't change string_index_ ...
9 years, 2 months ago (2011-10-14 20:33:04 UTC) #13
akalin
More comments. http://codereview.chromium.org/8236002/diff/21001/chrome/common/string_index.cc File chrome/common/string_index.cc (right): http://codereview.chromium.org/8236002/diff/21001/chrome/common/string_index.cc#newcode13 chrome/common/string_index.cc:13: static const char kZeroDigit = 'A'; no ...
9 years, 2 months ago (2011-10-17 22:25:24 UTC) #14
csharp1
Changes made and I've made the switch to lower case, however as a side effect ...
9 years, 2 months ago (2011-10-18 15:04:12 UTC) #15
tfarina
On 2011/10/18 15:04:12, csharp1 wrote: > Changes made and I've made the switch to lower ...
9 years, 2 months ago (2011-10-18 17:06:31 UTC) #16
tfarina
A meta question: what is the use case of this API? Should we check in ...
9 years, 2 months ago (2011-10-18 17:10:54 UTC) #17
akalin
On 2011/10/18 17:10:54, tfarina wrote: > A meta question: what is the use case of ...
9 years, 2 months ago (2011-10-18 17:15:49 UTC) #18
akalin
More comments http://codereview.chromium.org/8236002/diff/25001/chrome/common/string_ordinal.cc File chrome/common/string_ordinal.cc (right): http://codereview.chromium.org/8236002/diff/25001/chrome/common/string_ordinal.cc#newcode19 chrome/common/string_ordinal.cc:19: const int kMidDigitValue = kMidDigit - kZeroDigit; ...
9 years, 2 months ago (2011-10-18 17:59:26 UTC) #19
csharp1
Latest version upload with changes made in response to comment.
9 years, 2 months ago (2011-10-18 19:05:53 UTC) #20
akalin
On 2011/10/18 19:05:53, csharp1 wrote: > Latest version upload with changes made in response to ...
9 years, 2 months ago (2011-10-20 05:03:32 UTC) #21
akalin
Looking much better. Few more comments. http://codereview.chromium.org/8236002/diff/30003/chrome/common/string_ordinal.cc File chrome/common/string_ordinal.cc (right): http://codereview.chromium.org/8236002/diff/30003/chrome/common/string_ordinal.cc#newcode28 chrome/common/string_ordinal.cc:28: // Remove all ...
9 years, 2 months ago (2011-10-20 05:25:49 UTC) #22
tfarina
http://codereview.chromium.org/8236002/diff/30003/chrome/common/string_ordinal.cc File chrome/common/string_ordinal.cc (right): http://codereview.chromium.org/8236002/diff/30003/chrome/common/string_ordinal.cc#newcode72 chrome/common/string_ordinal.cc:72: std::string DropUnneededDigits(const std::string& value, On 2011/10/20 05:25:49, akalin wrote: ...
9 years, 2 months ago (2011-10-20 12:58:40 UTC) #23
tfarina
http://codereview.chromium.org/8236002/diff/30003/chrome/common/string_ordinal.h File chrome/common/string_ordinal.h (right): http://codereview.chromium.org/8236002/diff/30003/chrome/common/string_ordinal.h#newcode29 chrome/common/string_ordinal.h:29: StringOrdinal(); I think it would be less confusing to ...
9 years, 2 months ago (2011-10-20 13:02:35 UTC) #24
csharp
Changes made and code update. Only thing I'm not certain of is the change I ...
9 years, 2 months ago (2011-10-20 14:35:32 UTC) #25
tfarina
http://codereview.chromium.org/8236002/diff/38002/chrome/common/string_ordinal.cc File chrome/common/string_ordinal.cc (right): http://codereview.chromium.org/8236002/diff/38002/chrome/common/string_ordinal.cc#newcode14 chrome/common/string_ordinal.cc:14: // Constants I think you can remove this comment. ...
9 years, 2 months ago (2011-10-20 14:54:35 UTC) #26
csharp1
Changes made and uploaded. On 2011/10/20 14:54:35, tfarina wrote: > http://codereview.chromium.org/8236002/diff/38002/chrome/common/string_ordinal.cc > File chrome/common/string_ordinal.cc (right): ...
9 years, 2 months ago (2011-10-20 15:50:13 UTC) #27
akalin
Thaigo, do you mind if I handle this review alone? Too many cooks and all. ...
9 years, 2 months ago (2011-10-20 18:44:30 UTC) #28
akalin
http://codereview.chromium.org/8236002/diff/40001/chrome/common/string_ordinal.cc File chrome/common/string_ordinal.cc (right): http://codereview.chromium.org/8236002/diff/40001/chrome/common/string_ordinal.cc#newcode47 chrome/common/string_ordinal.cc:47: // the previous index values had an odd difference, ...
9 years, 2 months ago (2011-10-20 19:06:51 UTC) #29
akalin
LGTM after comments and green tryjobs http://codereview.chromium.org/8236002/diff/43002/chrome/common/string_ordinal.cc File chrome/common/string_ordinal.cc (right): http://codereview.chromium.org/8236002/diff/43002/chrome/common/string_ordinal.cc#newcode38 chrome/common/string_ordinal.cc:38: return end_position + ...
9 years, 2 months ago (2011-10-20 19:47:54 UTC) #30
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/csharp@chromium.org/8236002/42007
9 years, 2 months ago (2011-10-24 13:10:05 UTC) #31
commit-bot: I haz the power
The commit queue went berserk retrying too often for a seemingly flaky test. Builder is ...
9 years, 2 months ago (2011-10-24 14:12:20 UTC) #32
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/csharp@chromium.org/8236002/42007
9 years, 2 months ago (2011-10-24 17:04:54 UTC) #33
MAD
Some drive by comments, helping find why the win try bots were failing... BYE MAD ...
9 years, 2 months ago (2011-10-25 15:13:28 UTC) #34
akalin
Chris, can you fix these in a separate CL? http://codereview.chromium.org/8236002/diff/42007/chrome/common/string_ordinal.cc File chrome/common/string_ordinal.cc (right): http://codereview.chromium.org/8236002/diff/42007/chrome/common/string_ordinal.cc#newcode35 chrome/common/string_ordinal.cc:35: ...
9 years, 2 months ago (2011-10-25 17:22:19 UTC) #35
akalin
Oops, didn't realize this hasn't been checked in yet. I guess fix it in this ...
9 years, 2 months ago (2011-10-25 17:22:58 UTC) #36
MAD
Yeah, we were not able to commit it because of try bot errors, and so ...
9 years, 2 months ago (2011-10-25 17:28:07 UTC) #37
csharp1
Ok, the bug has been fixed. I slightly changed the way the code removes the ...
9 years, 2 months ago (2011-10-25 18:50:47 UTC) #38
csharp1
Ok, I add an extra test that uses the internal loop in AddHalf a few ...
9 years, 1 month ago (2011-10-26 14:37:45 UTC) #39
akalin
Still LGTM. Are the trybots still failing? Can you give a link to the failing ...
9 years, 1 month ago (2011-10-26 18:36:41 UTC) #40
MAD
Yeah, it was just it's own unit test that was failing on Windows because of ...
9 years, 1 month ago (2011-10-26 19:22:01 UTC) #41
csharp
Updated some comments and I'll try submitting this again tomorrow morning. Hopefully it'll go through ...
9 years, 1 month ago (2011-10-26 19:59:17 UTC) #42
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/csharp@chromium.org/8236002/57001
9 years, 1 month ago (2011-10-27 13:02:27 UTC) #43
commit-bot: I haz the power
9 years, 1 month ago (2011-10-27 14:35:40 UTC) #44
Change committed as 107566

Powered by Google App Engine
This is Rietveld 408576698