⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 259597 in webkit


Ignore:
Timestamp:
Apr 6, 2020, 2:59:37 PM (6 years ago)
Author:
Simon Fraser
Message:

Make ScrollableArea TextStream-loggable
https://bugs.webkit.org/show_bug.cgi?id=210042

Reviewed by Darin Adler.

ScrollableArea is a pure virtual base class, so has to dump via a virtual function,
so add debugDescription() and implement it in derived classes.

Make the common pattern be that operator<<(TextStream&, ...) calls debugDescription.

Source/WebCore:

  • page/Frame.cpp:

(WebCore::Frame::debugDescription const):
(WebCore::operator<<):

  • page/Frame.h:
  • page/FrameView.cpp:

(WebCore::FrameView::debugDescription const):
(WebCore::operator<<):

  • page/FrameView.h:
  • platform/ScrollView.cpp:

(WebCore::ScrollView::debugDescription const):

  • platform/ScrollView.h:
  • platform/ScrollableArea.cpp:

(WebCore::operator<<):

  • platform/ScrollableArea.h:
  • rendering/RenderLayer.cpp:

(WebCore::RenderLayer::debugDescription const):
(WebCore::RenderLayer::calculateClipRects const):

  • rendering/RenderLayer.h:
  • rendering/RenderLayerCompositor.cpp:

(WebCore::RenderLayerCompositor::updateCompositingLayers):

  • rendering/RenderListBox.cpp:

(WebCore::RenderListBox::debugDescription const):

  • rendering/RenderListBox.h:

Source/WebKit:

  • UIProcess/win/WebPopupMenuProxyWin.cpp:

(WebKit::WebPopupMenuProxyWin::debugDescription const):

  • UIProcess/win/WebPopupMenuProxyWin.h:
  • WebProcess/Plugins/PDF/PDFPlugin.h:
  • WebProcess/Plugins/PDF/PDFPlugin.mm:

(WebKit::PDFPlugin::debugDescription const):

Location:
trunk/Source
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r259595 r259597  
     12020-04-06  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Make ScrollableArea TextStream-loggable
     4        https://bugs.webkit.org/show_bug.cgi?id=210042
     5
     6        Reviewed by Darin Adler.
     7
     8        ScrollableArea is a pure virtual base class, so has to dump via a virtual function,
     9        so add debugDescription() and implement it in derived classes.
     10
     11        Make the common pattern be that operator<<(TextStream&, ...) calls debugDescription.
     12
     13        * page/Frame.cpp:
     14        (WebCore::Frame::debugDescription const):
     15        (WebCore::operator<<):
     16        * page/Frame.h:
     17        * page/FrameView.cpp:
     18        (WebCore::FrameView::debugDescription const):
     19        (WebCore::operator<<):
     20        * page/FrameView.h:
     21        * platform/ScrollView.cpp:
     22        (WebCore::ScrollView::debugDescription const):
     23        * platform/ScrollView.h:
     24        * platform/ScrollableArea.cpp:
     25        (WebCore::operator<<):
     26        * platform/ScrollableArea.h:
     27        * rendering/RenderLayer.cpp:
     28        (WebCore::RenderLayer::debugDescription const):
     29        (WebCore::RenderLayer::calculateClipRects const):
     30        * rendering/RenderLayer.h:
     31        * rendering/RenderLayerCompositor.cpp:
     32        (WebCore::RenderLayerCompositor::updateCompositingLayers):
     33        * rendering/RenderListBox.cpp:
     34        (WebCore::RenderListBox::debugDescription const):
     35        * rendering/RenderListBox.h:
     36
    1372020-04-06  Jack Lee  <shihchieh_lee@apple.com>
    238
  • trunk/Source/WebCore/page/Frame.cpp

    r259523 r259597  
    104104#include "runtime_root.h"
    105105#include <JavaScriptCore/RegularExpression.h>
     106#include <wtf/HexNumber.h>
    106107#include <wtf/RefCountedLeakCounter.h>
    107108#include <wtf/StdLibExtras.h>
     
    10591060}
    10601061
     1062String Frame::debugDescription() const
     1063{
     1064    StringBuilder builder;
     1065
     1066    builder.append("Frame 0x"_s, hex(reinterpret_cast<uintptr_t>(this), Lowercase));
     1067    if (isMainFrame())
     1068        builder.append(" (main frame)"_s);
     1069
     1070    if (auto document = this->document())
     1071        builder.append(' ', document->documentURI());
     1072   
     1073    return builder.toString();
     1074}
     1075
    10611076TextStream& operator<<(TextStream& ts, const Frame& frame)
    10621077{
    1063     ts << "Frame " << &frame << " view " << frame.view() << " (is main frame " << frame.isMainFrame() << ") " << (frame.document() ? frame.document()->documentURI() : emptyString());
     1078    ts << frame.debugDescription();
    10641079    return ts;
    10651080}
  • trunk/Source/WebCore/page/Frame.h

    r259335 r259597  
    191191    bool requestDOMPasteAccess();
    192192
     193    String debugDescription() const;
     194
    193195// ======== All public functions below this point are candidates to move out of Frame into another class. ========
    194196
  • trunk/Source/WebCore/page/FrameView.cpp

    r259575 r259597  
    104104#include "VisualViewport.h"
    105105#include "WheelEventTestMonitor.h"
    106 #include <wtf/text/TextStream.h>
    107 
     106#include <wtf/HexNumber.h>
    108107#include <wtf/IsoMallocInlines.h>
    109108#include <wtf/MemoryPressureHandler.h>
     
    111110#include <wtf/SetForScope.h>
    112111#include <wtf/SystemTracing.h>
     112#include <wtf/text/TextStream.h>
    113113
    114114#if USE(COORDINATED_GRAPHICS)
     
    14241424    if (frame().isMainFrame())
    14251425        builder.appendLiteral("Main");
    1426     builder.appendLiteral("FrameView: ");
    1427     builder.append(message);
     1426    builder.append("FrameView: ", message);
    14281427    document->addConsoleMessage(MessageSource::Other, MessageLevel::Debug, builder.toString());
     1428}
     1429
     1430String FrameView::debugDescription() const
     1431{
     1432    return makeString("FrameView 0x", hex(reinterpret_cast<uintptr_t>(this), Lowercase), ' ', frame().debugDescription());
    14291433}
    14301434
     
    54595463TextStream& operator<<(TextStream& ts, const FrameView& view)
    54605464{
    5461     ts << "FrameView " << &view << " frame " << view.frame();
     5465    ts << view.debugDescription();
    54625466    return ts;
    54635467}
  • trunk/Source/WebCore/page/FrameView.h

    r259335 r259597  
    665665    bool inUpdateEmbeddedObjects() const { return m_inUpdateEmbeddedObjects; }
    666666
     667    String debugDescription() const final;
     668
    667669protected:
    668670    bool scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect) final;
  • trunk/Source/WebCore/platform/ScrollView.cpp

    r256911 r259597  
    3636#include "Scrollbar.h"
    3737#include "ScrollbarTheme.h"
     38#include <wtf/HexNumber.h>
    3839#include <wtf/StdLibExtras.h>
    3940#include <wtf/text/TextStream.h>
     
    15331534}
    15341535
     1536String ScrollView::debugDescription() const
     1537{
     1538    return makeString("ScrollView 0x", hex(reinterpret_cast<uintptr_t>(this), Lowercase));
     1539}
     1540
    15351541#if !PLATFORM(COCOA)
    15361542
     
    15431549}
    15441550
    1545 #endif
    1546 
    1547 #if !PLATFORM(COCOA)
    1548 
    15491551void ScrollView::platformSetScrollbarsSuppressed(bool)
    15501552{
     
    15581560{
    15591561}
    1560 
    1561 #endif
    1562 
    1563 #if !PLATFORM(COCOA)
    15641562
    15651563void ScrollView::platformSetScrollbarModes()
     
    16531651}
    16541652
    1655 #endif
    1656 
    1657 }
     1653#endif // !PLATFORM(COCOA)
     1654
     1655}
  • trunk/Source/WebCore/platform/ScrollView.h

    r259333 r259597  
    450450
    451451    bool isScrollView() const final { return true; }
     452    String debugDescription() const override;
    452453
    453454    void init();
  • trunk/Source/WebCore/platform/ScrollableArea.cpp

    r255957 r259597  
    770770}
    771771
     772TextStream& operator<<(TextStream& ts, const ScrollableArea& scrollableArea)
     773{
     774    ts << scrollableArea.debugDescription();
     775    return ts;
     776}
     777
    772778} // namespace WebCore
  • trunk/Source/WebCore/platform/ScrollableArea.h

    r259333 r259597  
    3232#include <wtf/WeakPtr.h>
    3333
     34namespace WTF {
     35class TextStream;
     36}
     37
    3438namespace WebCore {
    3539
     
    346350
    347351    virtual bool shouldPlaceBlockDirectionScrollbarOnLeft() const = 0;
     352   
     353    virtual String debugDescription() const = 0;
    348354
    349355protected:
     
    415421};
    416422
     423WTF::TextStream& operator<<(WTF::TextStream&, const ScrollableArea&);
     424
    417425} // namespace WebCore
  • trunk/Source/WebCore/platform/win/PopupMenuWin.cpp

    r246488 r259597  
    5050#include "TextRun.h"
    5151#include "WebCoreInstanceHandle.h"
     52#include <wtf/HexNumber.h>
    5253#include <wtf/WindowsExtras.h>
     54#include <wtf/text/StringBuilder.h>
    5355
    5456#include <windows.h>
     
    10831085}
    10841086
     1087String PopupMenuWin::debugDescription() const
     1088{
     1089    return makeString("PopupMenuWin 0x", hex(reinterpret_cast<uintptr_t>(this), Lowercase));
     1090}
     1091
    10851092AccessiblePopupMenu::AccessiblePopupMenu(const PopupMenuWin& popupMenu)
    10861093    : m_popupMenu(popupMenu)
  • trunk/Source/WebCore/platform/win/PopupMenuWin.h

    r246488 r259597  
    4949
    5050    static LPCWSTR popupClassName();
     51
     52    String debugDescription() const final;
    5153
    5254private:
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r259557 r259597  
    128128#include "WheelEventTestMonitor.h"
    129129#include <stdio.h>
     130#include <wtf/HexNumber.h>
    130131#include <wtf/MonotonicTime.h>
    131132#include <wtf/StdLibExtras.h>
     
    36263627}
    36273628
     3629String RenderLayer::debugDescription() const
     3630{
     3631    StringBuilder builder;
     3632    builder.append("RenderLayer 0x"_s, hex(reinterpret_cast<uintptr_t>(this), Lowercase), ' ', size().width(), 'x', size().height());
     3633
     3634    if (transform())
     3635        builder.append(" has transform"_s);
     3636
     3637    if (hasFilter())
     3638        builder.append(" has filter"_s);
     3639
     3640    if (hasBackdropFilter())
     3641        builder.append(" has backdrop filter"_s);
     3642
     3643    if (hasBlendMode())
     3644        builder.append(" has blend mode"_s);
     3645
     3646    if (isolatesBlending())
     3647        builder.append(" isolates blending"_s);
     3648
     3649    if (isComposited()) {
     3650        // Oh for better StringBuilder/TextStream integration.
     3651        TextStream stream;
     3652        stream << *backing();
     3653        builder.append(stream.release());
     3654    }
     3655
     3656    return builder.toString();
     3657}
     3658
    36283659int RenderLayer::verticalScrollbarWidth(OverlayScrollbarSizeRelevancy relevancy) const
    36293660{
     
    70127043TextStream& operator<<(TextStream& ts, const RenderLayer& layer)
    70137044{
    7014     ts << "RenderLayer " << &layer << " " << layer.size();
    7015     if (layer.transform())
    7016         ts << " has transform";
    7017     if (layer.hasFilter())
    7018         ts << " has filter";
    7019     if (layer.hasBackdropFilter())
    7020         ts << " has backdrop filter";
    7021     if (layer.hasBlendMode())
    7022         ts << " has blend mode";
    7023     if (layer.isolatesBlending())
    7024         ts << " isolates blending";
    7025     if (layer.isComposited())
    7026         ts << " " << *layer.backing();
     7045    ts << layer.debugDescription();
    70277046    return ts;
    70287047}
  • trunk/Source/WebCore/rendering/RenderLayer.h

    r259333 r259597  
    927927    void invalidateEventRegion();
    928928
     929    String debugDescription() const final;
     930
    929931private:
    930932
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp

    r259015 r259597  
    711711bool RenderLayerCompositor::updateCompositingLayers(CompositingUpdateType updateType, RenderLayer* updateRoot)
    712712{
    713     LOG_WITH_STREAM(Compositing, stream << "RenderLayerCompositor " << this << " updateCompositingLayers " << updateType << " contentLayersCount " << m_contentLayersCount);
     713    LOG_WITH_STREAM(Compositing, stream << "RenderLayerCompositor " << this << " [" << m_renderView.frameView() << "] updateCompositingLayers " << updateType << " contentLayersCount " << m_contentLayersCount);
    714714
    715715    TraceScope tracingScope(CompositingUpdateStart, CompositingUpdateEnd);
  • trunk/Source/WebCore/rendering/RenderListBox.cpp

    r259445 r259597  
    911911}
    912912
     913String RenderListBox::debugDescription() const
     914{
     915    return RenderObject::debugDescription();
     916}
     917
    913918Ref<Scrollbar> RenderListBox::createScrollbar()
    914919{
  • trunk/Source/WebCore/rendering/RenderListBox.h

    r259333 r259597  
    142142    bool usesMockScrollAnimator() const final;
    143143    void logMockScrollAnimatorMessage(const String&) const final;
     144    String debugDescription() const final;
    144145
    145146    // NOTE: This should only be called by the overridden setScrollOffset from ScrollableArea.
  • trunk/Source/WebKit/ChangeLog

    r259591 r259597  
     12020-04-06  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Make ScrollableArea TextStream-loggable
     4        https://bugs.webkit.org/show_bug.cgi?id=210042
     5
     6        Reviewed by Darin Adler.
     7
     8        ScrollableArea is a pure virtual base class, so has to dump via a virtual function,
     9        so add debugDescription() and implement it in derived classes.
     10
     11        Make the common pattern be that operator<<(TextStream&, ...) calls debugDescription.
     12
     13        * UIProcess/win/WebPopupMenuProxyWin.cpp:
     14        (WebKit::WebPopupMenuProxyWin::debugDescription const):
     15        * UIProcess/win/WebPopupMenuProxyWin.h:
     16        * WebProcess/Plugins/PDF/PDFPlugin.h:
     17        * WebProcess/Plugins/PDF/PDFPlugin.mm:
     18        (WebKit::PDFPlugin::debugDescription const):
     19
    1202020-04-06  Commit Queue  <commit-queue@webkit.org>
    221
  • trunk/Source/WebKit/UIProcess/win/WebPopupMenuProxyWin.cpp

    r249921 r259597  
    4242#include <WebCore/WebCoreInstanceHandle.h>
    4343#include <windowsx.h>
     44#include <wtf/HexNumber.h>
     45#include <wtf/text/StringBuilder.h>
    4446
    4547#if USE(DIRECT2D)
     
    10341036}
    10351037#endif
     1038
     1039String WebPopupMenuProxyWin::debugDescription() const
     1040{
     1041    return makeString("WebPopupMenuProxyWin 0x", hex(reinterpret_cast<uintptr_t>(this), Lowercase));
     1042}
     1043
    10361044} // namespace WebKit
  • trunk/Source/WebKit/UIProcess/win/WebPopupMenuProxyWin.h

    r249921 r259597  
    5959
    6060    void hide() { hidePopupMenu(); }
     61
     62    String debugDescription() const final;
    6163
    6264private:
  • trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.h

    r259333 r259597  
    247247    bool forceUpdateScrollbarsOnMainThreadForPerformanceTesting() const final;
    248248    bool shouldPlaceBlockDirectionScrollbarOnLeft() const final { return false; }
     249    String debugDescription() const final;
    249250
    250251    // PDFPlugin functions.
  • trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm

    r258477 r259597  
    9090#import <pal/spi/cg/CoreGraphicsSPI.h>
    9191#import <pal/spi/mac/NSMenuSPI.h>
     92#import <wtf/HexNumber.h>
    9293#import <wtf/UUID.h>
    9394#import <wtf/WTFSemaphore.h>
     
    12821283   
    12831284    return point;
     1285}
     1286
     1287String PDFPlugin::debugDescription() const
     1288{
     1289    return makeString("PDFPlugin 0x", hex(reinterpret_cast<uintptr_t>(this), Lowercase));
    12841290}
    12851291
Note: See TracChangeset for help on using the changeset viewer.