Make LOG_WITH_STREAM more efficient
Created attachment 369929 [details] Patch
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.
(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" ?
(In reply to Simon Fraser (smfr) from comment #3) stream << Repeat {' ', 10} << "foopy"
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() << ")");
Created attachment 369961 [details] Patch
https://trac.webkit.org/r245336
<rdar://problem/50820136>