Title: [245576] branches/safari-608.1.24.20-branch/Source
Revision
245576
Author
[email protected]
Date
2019-05-21 10:30:17 -0700 (Tue, 21 May 2019)

Log Message

Cherry-pick r245336. rdar://problem/50865946

    Make LOG_WITH_STREAM more efficient
    https://bugs.webkit.org/show_bug.cgi?id=197905

    Reviewed by Alex Christensen.
    Source/WebCore:

    No longer need to conditionalize ClipRects logging on the channel being enabled
    since LOG_WITH_STREAM fix the performance problem.

    Convert some RenderLayerCompositor logging to use LOG_WITH_STREAM.

    * rendering/RenderLayer.cpp:
    (WebCore::RenderLayer::calculateClipRects const):
    (WebCore::clipRectsLogEnabled): Deleted.
    * rendering/RenderLayerCompositor.cpp:
    (WebCore::RenderLayerCompositor::computeCompositingRequirements):
    (WebCore::RenderLayerCompositor::traverseUnchangedSubtree):

    Source/WebCore/PAL:

    Make the LOG_WITH_STREAM macro check that the log channel is enabled before
    building the stream.

    * pal/LogMacros.h:

    Source/WTF:

    Add a streamable Repeat() class that can be used to output a series of characters.
    This is useful for indenting output.

    * wtf/text/TextStream.h:
    (WTF::TextStream::repeat::repeat):
    (WTF::TextStream::operator<<):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245336 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-608.1.24.20-branch/Source/WTF/ChangeLog (245575 => 245576)


--- branches/safari-608.1.24.20-branch/Source/WTF/ChangeLog	2019-05-21 17:30:13 UTC (rev 245575)
+++ branches/safari-608.1.24.20-branch/Source/WTF/ChangeLog	2019-05-21 17:30:17 UTC (rev 245576)
@@ -1,3 +1,57 @@
+2019-05-21  Kocsen Chung  <[email protected]>
+
+        Cherry-pick r245336. rdar://problem/50865946
+
+    Make LOG_WITH_STREAM more efficient
+    https://bugs.webkit.org/show_bug.cgi?id=197905
+    
+    Reviewed by Alex Christensen.
+    Source/WebCore:
+    
+    No longer need to conditionalize ClipRects logging on the channel being enabled
+    since LOG_WITH_STREAM fix the performance problem.
+    
+    Convert some RenderLayerCompositor logging to use LOG_WITH_STREAM.
+    
+    * rendering/RenderLayer.cpp:
+    (WebCore::RenderLayer::calculateClipRects const):
+    (WebCore::clipRectsLogEnabled): Deleted.
+    * rendering/RenderLayerCompositor.cpp:
+    (WebCore::RenderLayerCompositor::computeCompositingRequirements):
+    (WebCore::RenderLayerCompositor::traverseUnchangedSubtree):
+    
+    Source/WebCore/PAL:
+    
+    Make the LOG_WITH_STREAM macro check that the log channel is enabled before
+    building the stream.
+    
+    * pal/LogMacros.h:
+    
+    Source/WTF:
+    
+    Add a streamable Repeat() class that can be used to output a series of characters.
+    This is useful for indenting output.
+    
+    * wtf/text/TextStream.h:
+    (WTF::TextStream::repeat::repeat):
+    (WTF::TextStream::operator<<):
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245336 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-05-15  Simon Fraser  <[email protected]>
+
+            Make LOG_WITH_STREAM more efficient
+            https://bugs.webkit.org/show_bug.cgi?id=197905
+
+            Reviewed by Alex Christensen.
+
+            Add a streamable repeat() class that can be used to output a series of characters.
+            This is useful for indenting output.
+
+            * wtf/text/TextStream.h:
+            (WTF::TextStream::repeat::repeat):
+            (WTF::TextStream::operator<<):
+
 2019-05-08  Zan Dobersek  <[email protected]>
 
         [GLib] Rework WPE RunLoopSourcePriority values

Modified: branches/safari-608.1.24.20-branch/Source/WTF/wtf/text/TextStream.h (245575 => 245576)


--- branches/safari-608.1.24.20-branch/Source/WTF/wtf/text/TextStream.h	2019-05-21 17:30:13 UTC (rev 245575)
+++ branches/safari-608.1.24.20-branch/Source/WTF/wtf/text/TextStream.h	2019-05-21 17:30:17 UTC (rev 245576)
@@ -102,6 +102,22 @@
         return (*func)(*this);
     }
 
+    struct Repeat {
+        Repeat(unsigned inWidth, char inCharacter)
+            : width(inWidth), character(inCharacter)
+        { }
+        unsigned width { 0 };
+        char character { ' ' };
+    };
+
+    TextStream& operator<<(const Repeat& repeated)
+    {
+        for (unsigned i = 0; i < repeated.width; ++i)
+            m_text.append(repeated.character);
+
+        return *this;
+    }
+
     class IndentScope {
     public:
         IndentScope(TextStream& ts, int amount = 1)

Modified: branches/safari-608.1.24.20-branch/Source/WebCore/ChangeLog (245575 => 245576)


--- branches/safari-608.1.24.20-branch/Source/WebCore/ChangeLog	2019-05-21 17:30:13 UTC (rev 245575)
+++ branches/safari-608.1.24.20-branch/Source/WebCore/ChangeLog	2019-05-21 17:30:17 UTC (rev 245576)
@@ -1,5 +1,64 @@
 2019-05-21  Kocsen Chung  <[email protected]>
 
+        Cherry-pick r245336. rdar://problem/50865946
+
+    Make LOG_WITH_STREAM more efficient
+    https://bugs.webkit.org/show_bug.cgi?id=197905
+    
+    Reviewed by Alex Christensen.
+    Source/WebCore:
+    
+    No longer need to conditionalize ClipRects logging on the channel being enabled
+    since LOG_WITH_STREAM fix the performance problem.
+    
+    Convert some RenderLayerCompositor logging to use LOG_WITH_STREAM.
+    
+    * rendering/RenderLayer.cpp:
+    (WebCore::RenderLayer::calculateClipRects const):
+    (WebCore::clipRectsLogEnabled): Deleted.
+    * rendering/RenderLayerCompositor.cpp:
+    (WebCore::RenderLayerCompositor::computeCompositingRequirements):
+    (WebCore::RenderLayerCompositor::traverseUnchangedSubtree):
+    
+    Source/WebCore/PAL:
+    
+    Make the LOG_WITH_STREAM macro check that the log channel is enabled before
+    building the stream.
+    
+    * pal/LogMacros.h:
+    
+    Source/WTF:
+    
+    Add a streamable Repeat() class that can be used to output a series of characters.
+    This is useful for indenting output.
+    
+    * wtf/text/TextStream.h:
+    (WTF::TextStream::repeat::repeat):
+    (WTF::TextStream::operator<<):
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245336 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-05-15  Simon Fraser  <[email protected]>
+
+            Make LOG_WITH_STREAM more efficient
+            https://bugs.webkit.org/show_bug.cgi?id=197905
+
+            Reviewed by Alex Christensen.
+
+            No longer need to conditionalize ClipRects logging on the channel being enabled
+            since LOG_WITH_STREAM fix the performance problem.
+
+            Convert some RenderLayerCompositor logging to use LOG_WITH_STREAM.
+
+            * rendering/RenderLayer.cpp:
+            (WebCore::RenderLayer::calculateClipRects const):
+            (WebCore::clipRectsLogEnabled): Deleted.
+            * rendering/RenderLayerCompositor.cpp:
+            (WebCore::RenderLayerCompositor::computeCompositingRequirements):
+            (WebCore::RenderLayerCompositor::traverseUnchangedSubtree):
+
+2019-05-21  Kocsen Chung  <[email protected]>
+
         Cherry-pick r245326. rdar://problem/50865946
 
     Move RenderLayerCompositor's OverlapMap to its own file

Modified: branches/safari-608.1.24.20-branch/Source/WebCore/PAL/ChangeLog (245575 => 245576)


--- branches/safari-608.1.24.20-branch/Source/WebCore/PAL/ChangeLog	2019-05-21 17:30:13 UTC (rev 245575)
+++ branches/safari-608.1.24.20-branch/Source/WebCore/PAL/ChangeLog	2019-05-21 17:30:17 UTC (rev 245576)
@@ -1,3 +1,55 @@
+2019-05-21  Kocsen Chung  <[email protected]>
+
+        Cherry-pick r245336. rdar://problem/50865946
+
+    Make LOG_WITH_STREAM more efficient
+    https://bugs.webkit.org/show_bug.cgi?id=197905
+    
+    Reviewed by Alex Christensen.
+    Source/WebCore:
+    
+    No longer need to conditionalize ClipRects logging on the channel being enabled
+    since LOG_WITH_STREAM fix the performance problem.
+    
+    Convert some RenderLayerCompositor logging to use LOG_WITH_STREAM.
+    
+    * rendering/RenderLayer.cpp:
+    (WebCore::RenderLayer::calculateClipRects const):
+    (WebCore::clipRectsLogEnabled): Deleted.
+    * rendering/RenderLayerCompositor.cpp:
+    (WebCore::RenderLayerCompositor::computeCompositingRequirements):
+    (WebCore::RenderLayerCompositor::traverseUnchangedSubtree):
+    
+    Source/WebCore/PAL:
+    
+    Make the LOG_WITH_STREAM macro check that the log channel is enabled before
+    building the stream.
+    
+    * pal/LogMacros.h:
+    
+    Source/WTF:
+    
+    Add a streamable Repeat() class that can be used to output a series of characters.
+    This is useful for indenting output.
+    
+    * wtf/text/TextStream.h:
+    (WTF::TextStream::repeat::repeat):
+    (WTF::TextStream::operator<<):
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245336 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-05-15  Simon Fraser  <[email protected]>
+
+            Make LOG_WITH_STREAM more efficient
+            https://bugs.webkit.org/show_bug.cgi?id=197905
+
+            Reviewed by Alex Christensen.
+
+            Make the LOG_WITH_STREAM macro check that the log channel is enabled before
+            building the stream.
+
+            * pal/LogMacros.h:
+
 2019-05-12  Babak Shafiei  <[email protected]>
 
         Cherry-pick r245183. rdar://problem/50065100

Modified: branches/safari-608.1.24.20-branch/Source/WebCore/PAL/pal/LogMacros.h (245575 => 245576)


--- branches/safari-608.1.24.20-branch/Source/WebCore/PAL/pal/LogMacros.h	2019-05-21 17:30:13 UTC (rev 245575)
+++ branches/safari-608.1.24.20-branch/Source/WebCore/PAL/pal/LogMacros.h	2019-05-21 17:30:17 UTC (rev 245576)
@@ -32,9 +32,11 @@
 #else
 
 #define LOG_WITH_STREAM(channel, commands) do { \
-        WTF::TextStream stream(WTF::TextStream::LineMode::SingleLine); \
-        commands; \
-        WTFLog(&JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, channel), "%s", stream.release().utf8().data()); \
+        if (JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, channel).state == WTFLogChannelState::On) { \
+            WTF::TextStream stream(WTF::TextStream::LineMode::SingleLine); \
+            commands; \
+            WTFLog(&JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, channel), "%s", stream.release().utf8().data()); \
+        } \
     } while (0)
 
 #endif // !LOG_DISABLED

Modified: branches/safari-608.1.24.20-branch/Source/WebCore/rendering/RenderLayer.cpp (245575 => 245576)


--- branches/safari-608.1.24.20-branch/Source/WebCore/rendering/RenderLayer.cpp	2019-05-21 17:30:13 UTC (rev 245575)
+++ branches/safari-608.1.24.20-branch/Source/WebCore/rendering/RenderLayer.cpp	2019-05-21 17:30:17 UTC (rev 245576)
@@ -280,10 +280,6 @@
     return ts;
 }
 
-static bool clipRectsLogEnabled()
-{
-    return LogClipRects.state == WTFLogChannelState::On;
-}
 #endif
 
 RenderLayer::RenderLayer(RenderLayerModelObject& rendererLayerModelObject)
@@ -5621,10 +5617,7 @@
         }
     }
 
-#if !LOG_DISABLED
-    if (clipRectsLogEnabled())
-        LOG_WITH_STREAM(ClipRects, stream << "RenderLayer " << this << " calculateClipRects " << clipRects);
-#endif
+    LOG_WITH_STREAM(ClipRects, stream << "RenderLayer " << this << " calculateClipRects " << clipRects);
 }
 
 Ref<ClipRects> RenderLayer::parentClipRects(const ClipRectsContext& clipRectsContext) const
@@ -5670,10 +5663,7 @@
     if (parentRects->fixed() && &clipRectsContext.rootLayer->renderer() == &view && !backgroundClipRect.isInfinite())
         backgroundClipRect.moveBy(view.frameView().scrollPositionForFixedPosition());
 
-#if !LOG_DISABLED
-    if (clipRectsLogEnabled())
-        LOG_WITH_STREAM(ClipRects, stream << "RenderLayer " << this << " backgroundClipRect with context " << clipRectsContext << " returning " << backgroundClipRect);
-#endif
+    LOG_WITH_STREAM(ClipRects, stream << "RenderLayer " << this << " backgroundClipRect with context " << clipRectsContext << " returning " << backgroundClipRect);
     return backgroundClipRect;
 }
 

Modified: branches/safari-608.1.24.20-branch/Source/WebCore/rendering/RenderLayerCompositor.cpp (245575 => 245576)


--- branches/safari-608.1.24.20-branch/Source/WebCore/rendering/RenderLayerCompositor.cpp	2019-05-21 17:30:13 UTC (rev 245575)
+++ branches/safari-608.1.24.20-branch/Source/WebCore/rendering/RenderLayerCompositor.cpp	2019-05-21 17:30:17 UTC (rev 245576)
@@ -138,7 +138,7 @@
 #if ENABLE(CSS_COMPOSITING)
         childState.hasNotIsolatedCompositedBlendingDescendants = false; // FIXME: should this only be reset for stacking contexts?
 #endif
-#if ENABLE(TREE_DEBUGGING)
+#if !LOG_DISABLED
         childState.depth = depth + 1;
 #endif
         return childState;
@@ -167,8 +167,8 @@
 #if ENABLE(CSS_COMPOSITING)
     bool hasNotIsolatedCompositedBlendingDescendants { false };
 #endif
-#if ENABLE(TREE_DEBUGGING)
-    int depth { 0 };
+#if !LOG_DISABLED
+    unsigned depth { 0 };
 #endif
 };
 
@@ -830,9 +830,7 @@
         return;
     }
 
-#if ENABLE(TREE_DEBUGGING)
-    LOG(Compositing, "%*p %s computeCompositingRequirements (backing provider candidate %p)", 12 + compositingState.depth * 2, &layer, layer.isNormalFlowOnly() ? "n" : "s", backingSharingState.backingProviderCandidate());
-#endif
+    LOG_WITH_STREAM(Compositing, stream << TextStream::Repeat(compositingState.depth * 2, ' ') << &layer << (layer.isNormalFlowOnly() ? " n" : " s") << " computeCompositingRequirements (backing provider candidate " << backingSharingState.backingProviderCandidate() << ")");
 
     // FIXME: maybe we can avoid updating all remaining layers in paint order.
     compositingState.fullPaintOrderTraversalRequired |= layer.needsCompositingRequirementsTraversal();
@@ -1060,13 +1058,10 @@
         layer.setNeedsCompositingLayerConnection();
     }
 
-#if ENABLE(TREE_DEBUGGING)
-    LOG(Compositing, "%*p computeCompositingRequirements - willBeComposited %d (backing provider candidate %p)", 12 + compositingState.depth * 2, &layer, willBeComposited, backingSharingState.backingProviderCandidate());
-#endif
-
     layer.clearCompositingRequirementsTraversalState();
-    
     overlapMap.geometryMap().popMappingsToAncestor(ancestorLayer);
+
+    LOG_WITH_STREAM(Compositing, stream << TextStream::Repeat(compositingState.depth * 2, ' ') << &layer << " computeCompositingRequirements - willBeComposited " << willBeComposited << " (backing provider candidate " << backingSharingState.backingProviderCandidate() << ")");
 }
 
 // We have to traverse unchanged layers to fill in the overlap map.
@@ -1076,9 +1071,7 @@
     ASSERT(!layer.hasDescendantNeedingCompositingRequirementsTraversal());
     ASSERT(!layer.needsCompositingRequirementsTraversal());
 
-#if ENABLE(TREE_DEBUGGING)
-    LOG(Compositing, "%*p traverseUnchangedSubtree", 12 + compositingState.depth * 2, &layer);
-#endif
+    LOG_WITH_STREAM(Compositing, stream << TextStream::Repeat(compositingState.depth * 2, ' ') << &layer << (layer.isNormalFlowOnly() ? " n" : " s") << " traverseUnchangedSubtree");
 
     layer.updateDescendantDependentFlags();
     layer.updateLayerListsIfNeeded();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to