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

Issue 1916303004: CFX_ByteString::Reserve(), ReleaseBuffer() fixes. (Closed)

Created:
4 years, 7 months ago by Tom Sepez
Modified:
4 years, 7 months ago
Reviewers:
Lei Zhang
CC:
pdfium-reviews_googlegroups.com
Base URL:
https://pdfium.googlesource.com/pdfium.git@master
Target Ref:
refs/heads/master
Project:
pdfium
Visibility:
Public.

Description

CFX_ByteString::Reserve(), ReleaseBuffer() fixes. Also identical fixes for CFX_WideString. Reserve() on an empty string would not actually reserve a buffer. Currently unused, but there are places where this would really help. ReleaseBuffer() would rarely return memory to the system, since it would short-circuit thinking it could operate in place. Tune the algorithm slightly so that we hold on when the savings is small. Bounds check release buffer args rather than just asserting. Add tests for all of these. Committed: https://pdfium.googlesource.com/pdfium/+/518fd4c5ababbfbf28e010a9c27098e8f6669e4b

Patch Set 1 #

Patch Set 2 : Assert private copy, saner behaviour with out-of-bounds args. #

Total comments: 2

Patch Set 3 : Remove stray TrimLeft() #

Unified diffs Side-by-side diffs Delta from patch set Stats (+170 lines, -6 lines) Patch
M core/fxcrt/fx_basic_bstring.cpp View 1 1 chunk +8 lines, -3 lines 0 comments Download
M core/fxcrt/fx_basic_bstring_unittest.cpp View 1 chunk +77 lines, -0 lines 0 comments Download
M core/fxcrt/fx_basic_wstring.cpp View 1 1 chunk +8 lines, -3 lines 0 comments Download
M core/fxcrt/fx_basic_wstring_unittest.cpp View 1 2 1 chunk +77 lines, -0 lines 0 comments Download

Messages

Total messages: 12 (7 generated)
Tom Sepez
Lei, I think the lesson is never write your own STL replacement.
4 years, 7 months ago (2016-04-26 18:20:03 UTC) #4
Lei Zhang
lgtm https://codereview.chromium.org/1916303004/diff/20001/core/fxcrt/fx_basic_wstring_unittest.cpp File core/fxcrt/fx_basic_wstring_unittest.cpp (right): https://codereview.chromium.org/1916303004/diff/20001/core/fxcrt/fx_basic_wstring_unittest.cpp#newcode608 core/fxcrt/fx_basic_wstring_unittest.cpp:608: str.TrimLeft(); The bytestring version doesn't have this. Intentional?
4 years, 7 months ago (2016-04-26 18:51:12 UTC) #5
Tom Sepez
https://codereview.chromium.org/1916303004/diff/20001/core/fxcrt/fx_basic_wstring_unittest.cpp File core/fxcrt/fx_basic_wstring_unittest.cpp (right): https://codereview.chromium.org/1916303004/diff/20001/core/fxcrt/fx_basic_wstring_unittest.cpp#newcode608 core/fxcrt/fx_basic_wstring_unittest.cpp:608: str.TrimLeft(); On 2016/04/26 18:51:12, Lei Zhang wrote: > The ...
4 years, 7 months ago (2016-04-26 18:57:11 UTC) #7
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1916303004/40001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1916303004/40001
4 years, 7 months ago (2016-04-26 18:58:39 UTC) #10
commit-bot: I haz the power
4 years, 7 months ago (2016-04-26 19:13:20 UTC) #12
Message was sent while issue was closed.
Committed patchset #3 (id:40001) as
https://pdfium.googlesource.com/pdfium/+/518fd4c5ababbfbf28e010a9c27098e8f666...

Powered by Google App Engine
This is Rietveld 408576698