RESOLVED FIXED Bug 197905
Make LOG_WITH_STREAM more efficient
https://bugs.webkit.org/show_bug.cgi?id=197905
Summary Make LOG_WITH_STREAM more efficient
Simon Fraser (smfr)
Reported 2019-05-14 23:15:38 PDT
Make LOG_WITH_STREAM more efficient
Attachments
Patch (8.83 KB, patch)
2019-05-14 23:18 PDT, Simon Fraser (smfr)
achristensen: review+
Patch (9.45 KB, patch)
2019-05-15 09:52 PDT, Simon Fraser (smfr)
no flags
Simon Fraser (smfr)
Comment 1 2019-05-14 23:18:44 PDT
Alex Christensen
Comment 2 2019-05-15 07:48:13 PDT
Comment on attachment 369929 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=369929&action=review > Source/WTF/wtf/text/TextStream.h:109 > + struct repeat { > + repeat(char inCharacter, unsigned inWidth) > + : width(inWidth) > + , character(inCharacter) > + { } I think this should be named Repeat. I think initializer lists could be used instead of this constructor. > Source/WebCore/PAL/pal/LogMacros.h:35 > + if (JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, channel).state == WTFLogChannelState::On) { \ This seems like an obvious check we should've done before.
Simon Fraser (smfr)
Comment 3 2019-05-15 08:41:54 PDT
(In reply to Alex Christensen from comment #2) > Comment on attachment 369929 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=369929&action=review > > > Source/WTF/wtf/text/TextStream.h:109 > > + struct repeat { > > + repeat(char inCharacter, unsigned inWidth) > > + : width(inWidth) > > + , character(inCharacter) > > + { } > > I think this should be named Repeat. > I think initializer lists could be used instead of this constructor. So the call site would look like: stream << Repeat({' ', 10}) << "foopy" ?
Alex Christensen
Comment 4 2019-05-15 09:03:05 PDT
(In reply to Simon Fraser (smfr) from comment #3) stream << Repeat {' ', 10} << "foopy"
Simon Fraser (smfr)
Comment 5 2019-05-15 09:24:08 PDT
Sadly the compiler doesn't like initializers inside a macro invocation: /rendering/RenderLayerCompositor.cpp:1176:69: error: too many arguments provided to function-like macro invocation LOG_WITH_STREAM(Compositing, stream << TextStream::Repeat {' ', compositingState.depth * 2} << &layer << " computeCompositingRequirements - willBeComposited " << willBeComposited << " (backing provider candidate " << backingSharingState.backingProviderCandidate() << ")");
Simon Fraser (smfr)
Comment 6 2019-05-15 09:52:11 PDT
Simon Fraser (smfr)
Comment 7 2019-05-15 11:54:28 PDT
Radar WebKit Bug Importer
Comment 8 2019-05-15 11:58:02 PDT
Note You need to log in before you can comment on or make changes to this bug.