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

Issue 2046353002: Use a Vector for the buffer in StringBuilder. (Closed)

Created:
4 years, 6 months ago by esprehn
Modified:
4 years, 5 months ago
Reviewers:
haraken, hajimehoshi
CC:
blink-reviews, blink-reviews-wtf_chromium.org, chromium-reviews, Mikhail
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Use a Vector for the buffer in StringBuilder. The string overallocation strategy of StringBuilder doesn't really make sense since we need to create a copy at the end now that StringImpl::reallocate was removed by https://codereview.chromium.org/1390033003 We probably should add back an optimization that forcibly sets the length of the String and uses overallocation to avoid doing a string copy in every StringBuilder, but until we decide to do that lets switch to using a Vector for the buffer since it can handle growing the buffer automatically for us and makes the code in StringBuilder much simpler. Committed: https://crrev.com/23e9098e1bfaa078916ed64a4c6b6f6bd7b00d1b Cr-Commit-Position: refs/heads/master@{#402638}

Patch Set 1 #

Patch Set 2 : m_is8Bit being false doesn't mean there's a 16bit buffer #

Patch Set 3 : Keep m_string alive when creating the buffer. #

Patch Set 4 : resize() must adjust buffer too. #

Patch Set 5 : rebase. #

Total comments: 12
Unified diffs Side-by-side diffs Delta from patch set Stats (+174 lines, -408 lines) Patch
M third_party/WebKit/Source/wtf/text/StringBuilder.h View 1 2 3 6 chunks +61 lines, -133 lines 6 comments Download
M third_party/WebKit/Source/wtf/text/StringBuilder.cpp View 1 2 3 3 chunks +112 lines, -262 lines 6 comments Download
M third_party/WebKit/Source/wtf/text/StringBuilderTest.cpp View 4 chunks +1 line, -13 lines 0 comments Download

Messages

Total messages: 35 (14 generated)
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2046353002/1
4 years, 6 months ago (2016-06-08 07:18:13 UTC) #2
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2046353002/20001
4 years, 6 months ago (2016-06-08 07:31:43 UTC) #4
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: linux_chromium_chromeos_ozone_rel_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_chromeos_ozone_rel_ng/builds/182601)
4 years, 6 months ago (2016-06-08 08:10:51 UTC) #6
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2046353002/40001
4 years, 6 months ago (2016-06-08 08:25:56 UTC) #8
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: linux_chromium_chromeos_rel_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_chromeos_rel_ng/builds/225120)
4 years, 6 months ago (2016-06-08 09:00:02 UTC) #10
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2046353002/60001
4 years, 6 months ago (2016-06-08 15:28:23 UTC) #12
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: linux_chromium_chromeos_rel_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_chromeos_rel_ng/builds/225326)
4 years, 6 months ago (2016-06-08 16:52:30 UTC) #14
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2046353002/80001
4 years, 6 months ago (2016-06-24 21:56:06 UTC) #18
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
4 years, 6 months ago (2016-06-24 23:40:49 UTC) #21
esprehn
Ping
4 years, 5 months ago (2016-06-27 05:09:20 UTC) #22
hajimehoshi
https://codereview.chromium.org/2046353002/diff/80001/third_party/WebKit/Source/wtf/text/StringBuilder.h File third_party/WebKit/Source/wtf/text/StringBuilder.h (right): https://codereview.chromium.org/2046353002/diff/80001/third_party/WebKit/Source/wtf/text/StringBuilder.h#newcode233 third_party/WebKit/Source/wtf/text/StringBuilder.h:233: void* m_buffer; Where is |m_buffer| used now?
4 years, 5 months ago (2016-06-27 06:13:21 UTC) #23
esprehn
https://codereview.chromium.org/2046353002/diff/80001/third_party/WebKit/Source/wtf/text/StringBuilder.h File third_party/WebKit/Source/wtf/text/StringBuilder.h (right): https://codereview.chromium.org/2046353002/diff/80001/third_party/WebKit/Source/wtf/text/StringBuilder.h#newcode233 third_party/WebKit/Source/wtf/text/StringBuilder.h:233: void* m_buffer; On 2016/06/27 at 06:13:20, hajimehoshi wrote: > ...
4 years, 5 months ago (2016-06-27 06:15:15 UTC) #24
haraken
Mostly looks good. https://codereview.chromium.org/2046353002/diff/80001/third_party/WebKit/Source/wtf/text/StringBuilder.cpp File third_party/WebKit/Source/wtf/text/StringBuilder.cpp (right): https://codereview.chromium.org/2046353002/diff/80001/third_party/WebKit/Source/wtf/text/StringBuilder.cpp#newcode86 third_party/WebKit/Source/wtf/text/StringBuilder.cpp:86: delete m_buffer8; Can we use OwnPtr ...
4 years, 5 months ago (2016-06-27 06:36:01 UTC) #25
hajimehoshi
https://codereview.chromium.org/2046353002/diff/80001/third_party/WebKit/Source/wtf/text/StringBuilder.cpp File third_party/WebKit/Source/wtf/text/StringBuilder.cpp (right): https://codereview.chromium.org/2046353002/diff/80001/third_party/WebKit/Source/wtf/text/StringBuilder.cpp#newcode86 third_party/WebKit/Source/wtf/text/StringBuilder.cpp:86: delete m_buffer8; On 2016/06/27 06:36:01, haraken wrote: > > ...
4 years, 5 months ago (2016-06-27 06:38:02 UTC) #26
esprehn
I would have to not use a union and make it one pointer larger to ...
4 years, 5 months ago (2016-06-27 23:36:40 UTC) #27
haraken
LGTM
4 years, 5 months ago (2016-06-28 02:11:10 UTC) #28
hajimehoshi
lgtm https://codereview.chromium.org/2046353002/diff/80001/third_party/WebKit/Source/wtf/text/StringBuilder.cpp File third_party/WebKit/Source/wtf/text/StringBuilder.cpp (right): https://codereview.chromium.org/2046353002/diff/80001/third_party/WebKit/Source/wtf/text/StringBuilder.cpp#newcode86 third_party/WebKit/Source/wtf/text/StringBuilder.cpp:86: delete m_buffer8; On 2016/06/27 23:36:40, esprehn wrote: > ...
4 years, 5 months ago (2016-06-28 05:01:35 UTC) #29
esprehn
On 2016/06/28 at 05:01:35, hajimehoshi wrote: > lgtm > > https://codereview.chromium.org/2046353002/diff/80001/third_party/WebKit/Source/wtf/text/StringBuilder.cpp > File third_party/WebKit/Source/wtf/text/StringBuilder.cpp (right): ...
4 years, 5 months ago (2016-06-28 22:55:14 UTC) #30
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2046353002/80001
4 years, 5 months ago (2016-06-28 22:57:06 UTC) #32
commit-bot: I haz the power
Committed patchset #5 (id:80001)
4 years, 5 months ago (2016-06-29 01:49:45 UTC) #33
commit-bot: I haz the power
4 years, 5 months ago (2016-06-29 01:52:17 UTC) #35
Message was sent while issue was closed.
Patchset 5 (id:??) landed as
https://crrev.com/23e9098e1bfaa078916ed64a4c6b6f6bd7b00d1b
Cr-Commit-Position: refs/heads/master@{#402638}

Powered by Google App Engine
This is Rietveld 408576698