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

Issue 8659047: De-duplicate common code from StringPiece, StringPiece16, and their tests. (Closed)

Created:
9 years ago by erikwright (departed)
Modified:
9 years ago
Reviewers:
brettw
CC:
chromium-reviews, Paweł Hajdan Jr., jshin+watch_chromium.org, brettw-cc_chromium.org, hans
Visibility:
Public.

Description

Extract common code from StringPiece and StringPiece16 into a templated base class. Convert copy-and-pasted unit tests into TYPED_TESTs. The motivation is that I wish to add constructors for string::iterator ranges and I don't want to do it twice. The motivation for adding the string::iterator range constructors is to reduce the number of overloads in string_number_conversions.h . BUG=87634 TEST= Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=114242 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=115616

Patch Set 1 #

Total comments: 6

Patch Set 2 : Continued work. #

Patch Set 3 : internal namespace, remove unused non-const iterator types. #

Patch Set 4 : Fix constructor initializer list style, de-duplicate test code. #

Patch Set 5 : Make method order closer to original, for simpler diff. #

Patch Set 6 : Rebase to remove some of the files committed in other CLs. #

Patch Set 7 : rebase. #

Patch Set 8 : Incremental StringPiece forward decl conversions. #

Patch Set 9 : Rebase. #

Total comments: 2

Patch Set 10 : Rebase, integrate the addition of iterator range constructor, and fix Clang issue. #

Patch Set 11 : Comment on assymetry. #

Patch Set 12 : Modify StringPiece to include only inline methods, delegating to free functions to do the work. #

Patch Set 13 : Fix two bugs introduced during refactoring. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+549 lines, -524 lines) Patch
M base/i18n/case_conversion.h View 1 chunk +1 line, -0 lines 0 comments Download
M base/logging.h View 1 1 chunk +2 lines, -1 line 0 comments Download
M base/string_piece.h View 1 2 3 4 5 6 7 8 9 10 11 12 5 chunks +224 lines, -135 lines 0 comments Download
M base/string_piece.cc View 1 2 3 4 5 6 7 8 9 10 11 12 3 chunks +127 lines, -91 lines 0 comments Download
M base/string_piece_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 8 chunks +194 lines, -292 lines 0 comments Download
M base/utf_offset_string_conversions.h View 1 chunk +1 line, -5 lines 0 comments Download

Messages

Total messages: 20 (0 generated)
erikwright (departed)
Hi Brett, Some time ago we spoke about string_to_number_conversions, and removing the various overloaded signatures ...
9 years ago (2011-11-29 19:38:28 UTC) #1
brettw
I think this will make the two templates get instantiated in every .o file that ...
9 years ago (2011-12-01 20:29:24 UTC) #2
erikwright (departed)
PTAL. In particular, I fixed an inconsistency where StringPiece was a subclass of BasicStringPiece whereas ...
9 years ago (2011-12-06 15:52:06 UTC) #3
erikwright (departed)
On 2011/12/06 15:52:06, erikwright wrote: > PTAL. > > In particular, I fixed an inconsistency ...
9 years ago (2011-12-07 14:54:20 UTC) #4
brettw
Not being able to forward declare StringPiece in a reasonable way seems like a very ...
9 years ago (2011-12-07 22:31:54 UTC) #5
erikwright (departed)
On 2011/12/07 22:31:54, brettw wrote: > Not being able to forward declare StringPiece in a ...
9 years ago (2011-12-12 18:17:31 UTC) #6
erikwright (departed)
I should clarify that, including test targets there are 12 that go from forward-declaration only ...
9 years ago (2011-12-12 18:51:36 UTC) #7
brettw
On 2011/12/12 18:17:31, erikwright wrote: > Furthermore, there are serious negative consequences to having two ...
9 years ago (2011-12-12 18:59:52 UTC) #8
brettw
lgtm
9 years ago (2011-12-12 20:19:28 UTC) #9
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/erikwright@chromium.org/8659047/36001
9 years ago (2011-12-13 16:55:49 UTC) #10
commit-bot: I haz the power
Try job failure for 8659047-36001 (retry) on linux_clang for step "compile" (clobber build). It's a ...
9 years ago (2011-12-13 17:23:43 UTC) #11
Nico
http://codereview.chromium.org/8659047/diff/36001/base/string_piece.h File base/string_piece.h (right): http://codereview.chromium.org/8659047/diff/36001/base/string_piece.h#newcode239 base/string_piece.h:239: extern template class BasicStringPiece<std::string>; hans@ points out that declaring ...
9 years ago (2011-12-19 21:58:26 UTC) #12
erikwright (departed)
http://codereview.chromium.org/8659047/diff/36001/base/string_piece.h File base/string_piece.h (right): http://codereview.chromium.org/8659047/diff/36001/base/string_piece.h#newcode239 base/string_piece.h:239: extern template class BasicStringPiece<std::string>; On 2011/12/19 21:58:26, Nico wrote: ...
9 years ago (2011-12-20 15:26:41 UTC) #13
Nico
> Hmm. OK. The other concern would be the method definitions being duplicated in > ...
9 years ago (2011-12-20 20:54:11 UTC) #14
erikwright (departed)
On 2011/12/20 20:54:11, Nico wrote: > > Hmm. OK. The other concern would be the ...
9 years ago (2011-12-20 21:16:00 UTC) #15
erikwright (departed)
Hi Brett, The win_shared bots did not like this patch, for reasons that are unclear ...
9 years ago (2011-12-22 02:29:23 UTC) #16
brettw
I guess that seems OK. Do you think there will be more bloat as a ...
9 years ago (2011-12-22 18:43:08 UTC) #17
erikwright (departed)
My intuition is that it will be the same. I would expect methods of this ...
9 years ago (2011-12-22 19:05:09 UTC) #18
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/erikwright@chromium.org/8659047/56001
9 years ago (2011-12-22 19:09:08 UTC) #19
commit-bot: I haz the power
9 years ago (2011-12-22 21:54:54 UTC) #20
Change committed as 115616

Powered by Google App Engine
This is Rietveld 408576698