RESOLVED FIXED Bug 194485
Switch uses of StringBuilder with String::format for hex numbers to use HexNumber.h instead
https://bugs.webkit.org/show_bug.cgi?id=194485
Summary Switch uses of StringBuilder with String::format for hex numbers to use HexNu...
Darin Adler
Reported 2019-02-10 16:18:21 PST
Switch uses of StringBuilder with String::format for hex numbers to use HexNumber.h instead
Attachments
Patch (26.95 KB, patch)
2019-02-10 16:29 PST, Darin Adler
no flags
Patch (26.95 KB, patch)
2019-02-10 16:37 PST, Darin Adler
dbates: review+
Darin Adler
Comment 1 2019-02-10 16:29:31 PST Comment hidden (obsolete)
Darin Adler
Comment 2 2019-02-10 16:37:18 PST
Darin Adler
Comment 3 2019-02-10 19:41:04 PST
Adding some people to the cc list who have shown interest in this work recently. Patch is compiling and passing all tests so ready to review.
Daniel Bates
Comment 4 2019-02-10 20:16:43 PST
Comment on attachment 361650 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=361650&action=review > Source/JavaScriptCore/heap/HeapSnapshotBuilder.cpp:438 > + json.appendLiteral(",\""); No need to change this. Just had a thought, raw string to avoid escaping? R"(,")" :/ > Source/JavaScriptCore/heap/HeapSnapshotBuilder.cpp:440 > + json.appendLiteral("\",\""); Raw string? R"(",")"? Again, :/ (still feeling these raw strings out) > Source/WTF/wtf/HexNumber.h:55 > + auto unsignedNumber = static_cast<typename std::make_unsigned<NumberType>::type>(number); Nothing to change. Just a thought, we still need typename? I thought C++14 was going to save us. Maybe that's C++17 or C++20. > Source/WTF/wtf/HexNumber.h:70 > + auto unsignedNumber = static_cast<typename std::make_unsigned<NumberType>::type>(number); Ditto. > Source/WebCore/css/parser/CSSParserToken.cpp:397 > + break; Nice! I don't like returning void either. Did you see <https://lists.webkit.org/pipermail/webkit-dev/2019-February/030439.html>? Your voice was noticeably absent. Opinions appreciated :) > Source/WebKit/UIProcess/WebBackForwardList.cpp:488 > + builder.append(m_currentIndex ? "YES" : "NO"); appendLiteral()?
Darin Adler
Comment 5 2019-02-10 22:01:25 PST
Comment on attachment 361650 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=361650&action=review Thank you for your review and your thoughtful comments. >> Source/JavaScriptCore/heap/HeapSnapshotBuilder.cpp:438 >> + json.appendLiteral(",\""); > > No need to change this. Just had a thought, raw string to avoid escaping? R"(,")" :/ Never heard of a raw string before. I’d prefer not to use it for the first time here, but it seems like a reasonable thing to do later, revisiting all the places with \" to see if they can be made better. >> Source/WTF/wtf/HexNumber.h:55 >> + auto unsignedNumber = static_cast<typename std::make_unsigned<NumberType>::type>(number); > > Nothing to change. Just a thought, we still need typename? I thought C++14 was going to save us. Maybe that's C++17 or C++20. According to <https://en.cppreference.com/w/cpp/language/dependent_name> this will be resolved in C++20, which we can’t yet depend on in WebKit. I realize on reflection we can use make_unsigned_t instead of make_unsigned. I prefer to leave this as-is now and revisit this and all other call sites where we use make_unsigned in a separate patch. >> Source/WebCore/css/parser/CSSParserToken.cpp:397 >> + break; > > Nice! I don't like returning void either. Did you see <https://lists.webkit.org/pipermail/webkit-dev/2019-February/030439.html>? Your voice was noticeably absent. Opinions appreciated :) I did see it. I didn’t feel that I needed to comment. Our style has been to not return void. I might make a different choice in my own project but WebKit has been consistent on this for some time and I am simply following suit. That’s what the conversation on webkit-dev also seemed to conclude without my voice. >> Source/WebKit/UIProcess/WebBackForwardList.cpp:488 >> + builder.append(m_currentIndex ? "YES" : "NO"); > > appendLiteral()? It would need to be two calls to appendLiteral; the expression is not a literal. I prefer to leave it like this.
Darin Adler
Comment 6 2019-02-10 22:02:08 PST
Radar WebKit Bug Importer
Comment 7 2019-02-10 22:03:40 PST
Note You need to log in before you can comment on or make changes to this bug.