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

Issue 2226863003: [DevTools] Reduce API surface of String16. (Closed)

Created:
4 years, 4 months ago by dgozman
Modified:
4 years, 4 months ago
CC:
apavlov+blink_chromium.org, blink-reviews, caseq+blink_chromium.org, chromium-reviews, devtools-reviews_chromium.org, kozyatinskiy+blink_chromium.org, lushnikov+blink_chromium.org, pfeldman+blink_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

[DevTools] Reduce API surface of String16. Also, do not mention WTF::String anywhere except for String16WTF. Drive-by: improved performance of String16Builder. BUG=580337 Committed: https://crrev.com/16523d99c644c8513ad586eaca935fa2bea877b1 Cr-Commit-Position: refs/heads/master@{#411882}

Patch Set 1 #

Total comments: 5

Patch Set 2 : Stgring16Base #

Patch Set 3 : exports #

Total comments: 3

Patch Set 4 : snprintf #

Patch Set 5 : rebase #

Patch Set 6 : win compile #

Total comments: 5

Patch Set 7 : wrong vector usage #

Total comments: 17

Patch Set 8 : fixed review comments #

Patch Set 9 : rebased #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+404 lines, -562 lines) Patch
M third_party/WebKit/LayoutTests/inspector/console/console-log-side-effects-expected.txt View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/inspector/ThreadDebugger.h View 1 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/inspector/ThreadDebugger.cpp View 2 chunks +5 lines, -5 lines 0 comments Download
M third_party/WebKit/Source/platform/blink_platform.gypi View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/platform/inspector_protocol/Array.h View 1 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/platform/inspector_protocol/DispatcherBase.cpp View 1 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/platform/inspector_protocol/Maybe.h View 2 chunks +2 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/platform/inspector_protocol/Parser.cpp View 1 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/platform/inspector_protocol/String16.h View 1 2 3 4 5 6 7 1 chunk +170 lines, -0 lines 0 comments Download
A third_party/WebKit/Source/platform/inspector_protocol/String16.cpp View 1 2 3 4 5 6 7 1 chunk +101 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/inspector_protocol/String16STL.h View 1 2 3 4 5 6 7 4 chunks +26 lines, -187 lines 0 comments Download
M third_party/WebKit/Source/platform/inspector_protocol/String16STL.cpp View 1 5 chunks +3 lines, -186 lines 0 comments Download
M third_party/WebKit/Source/platform/inspector_protocol/String16WTF.h View 1 2 3 4 2 chunks +45 lines, -88 lines 2 comments Download
M third_party/WebKit/Source/platform/inspector_protocol/String16WTF.cpp View 1 1 chunk +0 lines, -47 lines 0 comments Download
M third_party/WebKit/Source/platform/inspector_protocol/ValueConversions.h View 2 chunks +3 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/platform/inspector_protocol/Values.cpp View 1 1 chunk +3 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/platform/v8_inspector/V8Console.cpp View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/platform/v8_inspector/V8ConsoleMessage.cpp View 1 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/platform/v8_inspector/V8Debugger.cpp View 1 2 3 4 2 chunks +5 lines, -5 lines 0 comments Download
M third_party/WebKit/Source/platform/v8_inspector/V8DebuggerScript.cpp View 1 2 3 4 2 chunks +7 lines, -6 lines 0 comments Download
M third_party/WebKit/Source/platform/v8_inspector/V8HeapProfilerAgentImpl.cpp View 1 2 chunks +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/platform/v8_inspector/V8InspectorImpl.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/platform/v8_inspector/V8InspectorSessionImpl.cpp View 1 1 chunk +5 lines, -5 lines 0 comments Download
M third_party/WebKit/Source/platform/v8_inspector/V8StackTraceImpl.cpp View 1 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/platform/v8_inspector/V8StringUtil.cpp View 1 2 3 4 5 6 7 8 7 chunks +15 lines, -11 lines 0 comments Download
M third_party/WebKit/Source/platform/v8_inspector/v8_inspector.gyp View 1 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 48 (22 generated)
dgozman
Take a look please.
4 years, 4 months ago (2016-08-09 01:34:21 UTC) #2
kozy
https://codereview.chromium.org/2226863003/diff/1/third_party/WebKit/Source/platform/inspector_protocol/String16STL.h File third_party/WebKit/Source/platform/inspector_protocol/String16STL.h (right): https://codereview.chromium.org/2226863003/diff/1/third_party/WebKit/Source/platform/inspector_protocol/String16STL.h#newcode115 third_party/WebKit/Source/platform/inspector_protocol/String16STL.h:115: // This class should not be ever instantiated, so ...
4 years, 4 months ago (2016-08-09 16:40:37 UTC) #3
pfeldman
https://codereview.chromium.org/2226863003/diff/1/third_party/WebKit/Source/platform/inspector_protocol/String16.h File third_party/WebKit/Source/platform/inspector_protocol/String16.h (right): https://codereview.chromium.org/2226863003/diff/1/third_party/WebKit/Source/platform/inspector_protocol/String16.h#newcode21 third_party/WebKit/Source/platform/inspector_protocol/String16.h:21: PLATFORM_EXPORT bool isASCIISpace(UChar); Looks like String16Base others inherit from ...
4 years, 4 months ago (2016-08-09 17:20:39 UTC) #4
dgozman
PTAL, addressed all comments.
4 years, 4 months ago (2016-08-10 23:21:50 UTC) #5
pfeldman
https://codereview.chromium.org/2226863003/diff/40001/third_party/WebKit/Source/platform/inspector_protocol/String16.cpp File third_party/WebKit/Source/platform/inspector_protocol/String16.cpp (right): https://codereview.chromium.org/2226863003/diff/40001/third_party/WebKit/Source/platform/inspector_protocol/String16.cpp#newcode18 third_party/WebKit/Source/platform/inspector_protocol/String16.cpp:18: std::sprintf(buffer, "%d", number); Please check whether we can use ...
4 years, 4 months ago (2016-08-11 00:30:32 UTC) #10
dgozman
https://codereview.chromium.org/2226863003/diff/40001/third_party/WebKit/Source/platform/inspector_protocol/String16.cpp File third_party/WebKit/Source/platform/inspector_protocol/String16.cpp (right): https://codereview.chromium.org/2226863003/diff/40001/third_party/WebKit/Source/platform/inspector_protocol/String16.cpp#newcode18 third_party/WebKit/Source/platform/inspector_protocol/String16.cpp:18: std::sprintf(buffer, "%d", number); On 2016/08/11 00:30:32, pfeldman wrote: > ...
4 years, 4 months ago (2016-08-11 00:33:37 UTC) #11
dgozman
PTAL https://codereview.chromium.org/2226863003/diff/40001/third_party/WebKit/Source/platform/inspector_protocol/String16.cpp File third_party/WebKit/Source/platform/inspector_protocol/String16.cpp (right): https://codereview.chromium.org/2226863003/diff/40001/third_party/WebKit/Source/platform/inspector_protocol/String16.cpp#newcode18 third_party/WebKit/Source/platform/inspector_protocol/String16.cpp:18: std::sprintf(buffer, "%d", number); On 2016/08/11 00:30:32, pfeldman wrote: ...
4 years, 4 months ago (2016-08-11 02:59:53 UTC) #12
pfeldman
lgtm
4 years, 4 months ago (2016-08-12 17:41:35 UTC) #18
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/2226863003/80001
4 years, 4 months ago (2016-08-12 17:42:06 UTC) #19
commit-bot: I haz the power
Try jobs failed on following builders: android_arm64_dbg_recipe on master.tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/android_arm64_dbg_recipe/builds/111689)
4 years, 4 months ago (2016-08-12 18:04:45 UTC) #21
kozy
lgtm
4 years, 4 months ago (2016-08-12 18:17:37 UTC) #22
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/2226863003/100001
4 years, 4 months ago (2016-08-12 18:45:55 UTC) #25
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_asan_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_asan_rel_ng/builds/209081)
4 years, 4 months ago (2016-08-12 21:51:54 UTC) #27
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/2226863003/120001
4 years, 4 months ago (2016-08-12 23:56:26 UTC) #30
commit-bot: I haz the power
Try jobs failed on following builders: android_arm64_dbg_recipe on master.tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/android_arm64_dbg_recipe/builds/112031) android_clang_dbg_recipe on master.tryserver.chromium.android (JOB_FAILED, ...
4 years, 4 months ago (2016-08-13 00:00:25 UTC) #32
caseq
https://codereview.chromium.org/2226863003/diff/100001/third_party/WebKit/Source/platform/inspector_protocol/String16.h File third_party/WebKit/Source/platform/inspector_protocol/String16.h (right): https://codereview.chromium.org/2226863003/diff/100001/third_party/WebKit/Source/platform/inspector_protocol/String16.h#newcode40 third_party/WebKit/Source/platform/inspector_protocol/String16.h:40: static char buffer[50]; shouldn't we support multiple threads? ;-) ...
4 years, 4 months ago (2016-08-13 00:01:09 UTC) #34
caseq
https://codereview.chromium.org/2226863003/diff/120001/third_party/WebKit/LayoutTests/inspector/console/console-log-side-effects-expected.txt File third_party/WebKit/LayoutTests/inspector/console/console-log-side-effects-expected.txt (right): https://codereview.chromium.org/2226863003/diff/120001/third_party/WebKit/LayoutTests/inspector/console/console-log-side-effects-expected.txt#newcode10 third_party/WebKit/LayoutTests/inspector/console/console-log-side-effects-expected.txt:10: CONSOLE MESSAGE: line 26: -4.242e-11 is this change intentional? ...
4 years, 4 months ago (2016-08-13 00:28:54 UTC) #35
dgozman
https://codereview.chromium.org/2226863003/diff/100001/third_party/WebKit/Source/platform/inspector_protocol/String16.h File third_party/WebKit/Source/platform/inspector_protocol/String16.h (right): https://codereview.chromium.org/2226863003/diff/100001/third_party/WebKit/Source/platform/inspector_protocol/String16.h#newcode40 third_party/WebKit/Source/platform/inspector_protocol/String16.h:40: static char buffer[50]; On 2016/08/13 00:01:09, caseq wrote: > ...
4 years, 4 months ago (2016-08-13 04:49:59 UTC) #36
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/2226863003/160001
4 years, 4 months ago (2016-08-13 04:50:14 UTC) #39
commit-bot: I haz the power
Committed patchset #9 (id:160001)
4 years, 4 months ago (2016-08-13 06:27:11 UTC) #40
commit-bot: I haz the power
Patchset 9 (id:??) landed as https://crrev.com/16523d99c644c8513ad586eaca935fa2bea877b1 Cr-Commit-Position: refs/heads/master@{#411882}
4 years, 4 months ago (2016-08-13 06:28:46 UTC) #42
esprehn
I might suggest just removing the operator+ entirely btw, it causes bad copies everywhere it's ...
4 years, 4 months ago (2016-08-15 20:46:52 UTC) #44
dgozman
https://codereview.chromium.org/2226863003/diff/160001/third_party/WebKit/Source/platform/inspector_protocol/String16WTF.h File third_party/WebKit/Source/platform/inspector_protocol/String16WTF.h (right): https://codereview.chromium.org/2226863003/diff/160001/third_party/WebKit/Source/platform/inspector_protocol/String16WTF.h#newcode67 third_party/WebKit/Source/platform/inspector_protocol/String16WTF.h:67: inline String16 operator+(const String16& a, const char* b) { ...
4 years, 4 months ago (2016-08-15 21:05:14 UTC) #45
caseq
On 2016/08/15 20:46:52, esprehn wrote: > The STL one is also going to be slow ...
4 years, 4 months ago (2016-08-15 21:06:42 UTC) #46
esprehn
On 2016/08/15 at 21:06:42, caseq wrote: > On 2016/08/15 20:46:52, esprehn wrote: > > The ...
4 years, 4 months ago (2016-08-16 02:25:20 UTC) #47
caseq
4 years, 4 months ago (2016-08-16 23:50:52 UTC) #48
Message was sent while issue was closed.
On 2016/08/16 02:25:20, esprehn wrote:
> On 2016/08/15 at 21:06:42, caseq wrote:
> > On 2016/08/15 20:46:52, esprehn wrote:
> > > The STL one is also going to be slow since you're not reusing the same
> string so
> > > the overallocation inside std::string is defeated.
> > > 
> > > ex.
> > > 
> > > a + b + c + d
> > > 
> > > makes 2 unneeded copies.
> > 
> > not trying to defend string::operator+ in anyway, but I think STL is doing
> fine here -- (a + b) is going to produce an rvalue ref with the following +'s
> being effectively appends(), and string capacity is preserved by the moving
> constructor.
> 
> Are you sure? String16's operator+ returns another String16, so doing:
> 
> a + b + c is a + b, which does: String16(a.impl() + b.impl()); which is
> String16(std::basic_string<UChar> + std::basic_string<UChar>) which then calls
> String16(const std::basic_string<UChar>& impl) : m_impl(impl) which creates a
> copy when assigning the m_impl object. We then do temporary + c which does the
> same thing and you get the final value. I don't think a const
> std::basic_string<UChar>& turns into a move() into m_impl, I think that would
> mutate the referenced object.

Apologies, I thought we're talking of actual STL strings as opposed to
String16's that wrap std::string. The latter will have extra allocs now because
we don't seem to have operator+ overloads for rvalue refs (so would be easy to
fix if we need to), but my understanding is that Dmitry is going to switch
generator to directly use underlying string types, either eliminating String16
altogether or leaving it only as a collection of static utility methods -- so
only bare strings should matter long term.

Powered by Google App Engine
This is Rietveld 408576698