Diff
Modified: trunk/Source/WebCore/ChangeLog (127836 => 127837)
--- trunk/Source/WebCore/ChangeLog 2012-09-07 07:04:46 UTC (rev 127836)
+++ trunk/Source/WebCore/ChangeLog 2012-09-07 07:45:49 UTC (rev 127837)
@@ -1,3 +1,70 @@
+2012-09-07 Tim Horton <timothy_hor...@apple.com>
+
+ Add optional debug logging when we fall into/out of threaded scrolling
+ https://bugs.webkit.org/show_bug.cgi?id=93898
+ <rdar://problem/12089098>
+
+ Reviewed by Simon Fraser.
+
+ Add logging when we enter and exit the threaded scrolling mode, and logs the reasons we
+ fall into main-thread scrolling.
+
+ The logging output looks like this:
+ SCROLLING: Switching to main-thread scrolling mode. Time: 15843.554718 Reason(s): viewport-constrained objects
+ SCROLLING: Switching to threaded scrolling mode. Time: 15844.550866
+ SCROLLING: Switching to main-thread scrolling mode. Time: 15845.551214 Reason(s): viewport-constrained objects
+ SCROLLING: Switching to threaded scrolling mode. Time: 15846.552619
+ SCROLLING: Switching to main-thread scrolling mode. Time: 15847.553587 Reason(s): viewport-constrained objects
+ SCROLLING: Switching to threaded scrolling mode. Time: 15848.554084
+
+ No new tests, as this is just debugging logging.
+
+ * WebCore.xcodeproj/project.pbxproj:
+ Expose ScrollingTreeState.h as a private header.
+
+ * page/scrolling/ScrollingCoordinator.cpp:
+ (WebCore::ScrollingCoordinator::frameViewHasSlowRepaintObjectsDidChange):
+ (WebCore::ScrollingCoordinator::frameViewFixedObjectsDidChange):
+ (WebCore::ScrollingCoordinator::frameViewRootLayerDidChange):
+ (WebCore::ScrollingCoordinator::setForceMainThreadScrollLayerPositionUpdates):
+ (WebCore::ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThreadReason):
+ * page/scrolling/ScrollingCoordinator.h:
+ (ScrollingCoordinator):
+ * page/scrolling/ScrollingCoordinatorNone.cpp:
+ (WebCore::ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThreadReason):
+ * page/scrolling/ScrollingTreeNode.cpp:
+ (WebCore::ScrollingTreeNode::ScrollingTreeNode):
+ (WebCore::ScrollingTreeNode::update):
+ * page/scrolling/ScrollingTreeNode.h:
+ (WebCore::ScrollingTreeNode::shouldUpdateScrollLayerPositionOnMainThreadReason):
+ (ScrollingTreeNode):
+ * page/scrolling/ScrollingTreeState.cpp:
+ (WebCore::ScrollingTreeState::ScrollingTreeState):
+ (WebCore::ScrollingTreeState::setShouldUpdateScrollLayerPositionOnMainThreadReason):
+ * page/scrolling/ScrollingTreeState.h:
+ (WebCore::ScrollingTreeState::shouldUpdateScrollLayerPositionOnMainThreadReason):
+ * page/scrolling/chromium/ScrollingCoordinatorChromium.cpp:
+ (WebCore::ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThreadReason):
+ Rename updateShouldUpdateScrollLayerPositionOnMainThread to updateShouldUpdateScrollLayerPositionOnMainThreadReason (and related).
+
+ * page/scrolling/ScrollingCoordinator.cpp:
+ (WebCore::ScrollingCoordinator::hasNonLayerViewportConstrainedObjects):
+ Renamed from hasNonLayerFixedObjects to match the rest of the renames going on.
+ (WebCore::ScrollingCoordinator::updateShouldUpdateScrollLayerPositionOnMainThreadReason):
+ Construct a bitfield describing the reasons we fall into main-thread scrolling mode.
+
+ * page/scrolling/ScrollingTreeState.h:
+ (ScrollingTreeState):
+ Add ReasonsForUpdatingScrollLayerPositionOnMainThread enum, with the current reasons that we might fallback to main-thread scrolling.
+
+ * page/scrolling/mac/ScrollingTreeNodeMac.mm:
+ (WebCore):
+ (WebCore::ScrollingTreeNodeMac::update): Log every time scrolling mode changes.
+ (WebCore::ScrollingTreeNodeMac::scrollPosition):
+ (WebCore::ScrollingTreeNodeMac::setScrollPositionWithoutContentEdgeConstraints):
+ (WebCore::ScrollingTreeNodeMac::setScrollLayerPosition):
+ (WebCore::logThreadedScrollingMode): Pretty-print the scrolling mode and shouldUpdateScrollLayerPositionOnMainThreadReason.
+
2012-09-06 Patrick Gansterer <par...@webkit.org>
Build fix for WinCE after r127801.
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (127836 => 127837)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2012-09-07 07:04:46 UTC (rev 127836)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2012-09-07 07:45:49 UTC (rev 127837)
@@ -511,7 +511,7 @@
1AAADDA314DB409F00AF64B3 /* ScrollingTree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AAADDA114DB409F00AF64B3 /* ScrollingTree.cpp */; };
1AAADDA414DB409F00AF64B3 /* ScrollingTree.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AAADDA214DB409F00AF64B3 /* ScrollingTree.h */; settings = {ATTRIBUTES = (Private, ); }; };
1AAADDBE14DC640700AF64B3 /* ScrollingTreeState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AAADDBC14DC640600AF64B3 /* ScrollingTreeState.cpp */; };
- 1AAADDBF14DC640700AF64B3 /* ScrollingTreeState.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AAADDBD14DC640600AF64B3 /* ScrollingTreeState.h */; };
+ 1AAADDBF14DC640700AF64B3 /* ScrollingTreeState.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AAADDBD14DC640600AF64B3 /* ScrollingTreeState.h */; settings = {ATTRIBUTES = (Private, ); }; };
1AAADDDA14DC74EC00AF64B3 /* ScrollingTreeStateMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AAADDD814DC74EC00AF64B3 /* ScrollingTreeStateMac.mm */; };
1AAADDE314DC8C8F00AF64B3 /* ScrollingTreeNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AAADDE114DC8C8F00AF64B3 /* ScrollingTreeNode.cpp */; };
1AAADDE414DC8C8F00AF64B3 /* ScrollingTreeNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AAADDE214DC8C8F00AF64B3 /* ScrollingTreeNode.h */; };
Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp (127836 => 127837)
--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp 2012-09-07 07:04:46 UTC (rev 127836)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp 2012-09-07 07:45:49 UTC (rev 127837)
@@ -36,7 +36,6 @@
#include "Region.h"
#include "RenderView.h"
#include "ScrollAnimator.h"
-#include "ScrollingTreeState.h"
#include <wtf/MainThread.h>
#if USE(ACCELERATED_COMPOSITING)
@@ -46,6 +45,7 @@
#if ENABLE(THREADED_SCROLLING)
#include "ScrollingThread.h"
#include "ScrollingTree.h"
+#include "ScrollingTreeState.h"
#include <wtf/Functional.h>
#include <wtf/PassRefPtr.h>
#endif
@@ -192,7 +192,7 @@
if (!coordinatesScrollingForFrameView(frameView))
return;
- updateShouldUpdateScrollLayerPositionOnMainThread();
+ updateShouldUpdateScrollLayerPositionOnMainThreadReason();
}
void ScrollingCoordinator::frameViewFixedObjectsDidChange(FrameView* frameView)
@@ -203,7 +203,7 @@
if (!coordinatesScrollingForFrameView(frameView))
return;
- updateShouldUpdateScrollLayerPositionOnMainThread();
+ updateShouldUpdateScrollLayerPositionOnMainThreadReason();
}
static GraphicsLayer* scrollLayerForFrameView(FrameView* frameView)
@@ -232,7 +232,7 @@
frameViewLayoutUpdated(frameView);
recomputeWheelEventHandlerCount();
- updateShouldUpdateScrollLayerPositionOnMainThread();
+ updateShouldUpdateScrollLayerPositionOnMainThreadReason();
setScrollLayer(scrollLayerForFrameView(frameView));
}
@@ -359,7 +359,7 @@
setWheelEventHandlerCount(wheelEventHandlerCount);
}
-bool ScrollingCoordinator::hasNonLayerFixedObjects(FrameView* frameView)
+bool ScrollingCoordinator::hasNonLayerViewportConstrainedObjects(FrameView* frameView)
{
const FrameView::ViewportConstrainedObjectSet* viewportConstrainedObjects = frameView->viewportConstrainedObjects();
if (!viewportConstrainedObjects)
@@ -380,15 +380,26 @@
#endif
}
-void ScrollingCoordinator::updateShouldUpdateScrollLayerPositionOnMainThread()
+void ScrollingCoordinator::updateShouldUpdateScrollLayerPositionOnMainThreadReason()
{
+#if ENABLE(THREADED_SCROLLING)
FrameView* frameView = m_page->mainFrame()->view();
- setShouldUpdateScrollLayerPositionOnMainThread(m_forceMainThreadScrollLayerPositionUpdates
- || frameView->hasSlowRepaintObjects()
- || (!supportsFixedPositionLayers() && frameView->hasViewportConstrainedObjects())
- || (supportsFixedPositionLayers() && hasNonLayerFixedObjects(frameView))
- || m_page->mainFrame()->document()->isImageDocument());
+ ReasonForUpdatingScrollLayerPositionOnMainThreadFlags reasonsForUpdatingScrollLayerPositionOnMainThread = (ReasonForUpdatingScrollLayerPositionOnMainThreadFlags)0;
+
+ if (m_forceMainThreadScrollLayerPositionUpdates)
+ reasonsForUpdatingScrollLayerPositionOnMainThread |= ScrollingTreeState::ForcedOnMainThread;
+ if (frameView->hasSlowRepaintObjects())
+ reasonsForUpdatingScrollLayerPositionOnMainThread |= ScrollingTreeState::HasSlowRepaintObjects;
+ if (!supportsFixedPositionLayers() && frameView->hasViewportConstrainedObjects())
+ reasonsForUpdatingScrollLayerPositionOnMainThread |= ScrollingTreeState::HasNonCompositedViewportConstrainedObjects;
+ if (supportsFixedPositionLayers() && hasNonLayerViewportConstrainedObjects(frameView))
+ reasonsForUpdatingScrollLayerPositionOnMainThread |= ScrollingTreeState::HasNonLayerViewportConstrainedObjects;
+ if (m_page->mainFrame()->document()->isImageDocument())
+ reasonsForUpdatingScrollLayerPositionOnMainThread |= ScrollingTreeState::IsImageDocument;
+
+ setShouldUpdateScrollLayerPositionOnMainThreadReason(reasonsForUpdatingScrollLayerPositionOnMainThread);
+#endif
}
void ScrollingCoordinator::setForceMainThreadScrollLayerPositionUpdates(bool forceMainThreadScrollLayerPositionUpdates)
@@ -397,7 +408,7 @@
return;
m_forceMainThreadScrollLayerPositionUpdates = forceMainThreadScrollLayerPositionUpdates;
- updateShouldUpdateScrollLayerPositionOnMainThread();
+ updateShouldUpdateScrollLayerPositionOnMainThreadReason();
}
#if ENABLE(THREADED_SCROLLING)
@@ -435,16 +446,18 @@
scheduleTreeStateCommit();
}
-void ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThread(bool shouldUpdateScrollLayerPositionOnMainThread)
+#if ENABLE(THREADED_SCROLLING)
+void ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThreadReason(ReasonForUpdatingScrollLayerPositionOnMainThreadFlags reasons)
{
// The FrameView's GraphicsLayer is likely to be out-of-synch with the PlatformLayer
// at this point. So we'll update it before we switch back to main thread scrolling
// in order to avoid layer positioning bugs.
- if (shouldUpdateScrollLayerPositionOnMainThread)
+ if (reasons)
updateMainFrameScrollLayerPosition();
- m_scrollingTreeState->setShouldUpdateScrollLayerPositionOnMainThread(shouldUpdateScrollLayerPositionOnMainThread);
+ m_scrollingTreeState->setShouldUpdateScrollLayerPositionOnMainThreadReason(reasons);
scheduleTreeStateCommit();
}
+#endif
void ScrollingCoordinator::scheduleTreeStateCommit()
{
Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h (127836 => 127837)
--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h 2012-09-07 07:04:46 UTC (rev 127836)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h 2012-09-07 07:45:49 UTC (rev 127837)
@@ -34,6 +34,7 @@
#include <wtf/Forward.h>
#if ENABLE(THREADED_SCROLLING)
+#include "ScrollingTreeState.h"
#include <wtf/ThreadSafeRefCounted.h>
#include <wtf/Threading.h>
#endif
@@ -131,8 +132,8 @@
explicit ScrollingCoordinator(Page*);
void recomputeWheelEventHandlerCount();
- bool hasNonLayerFixedObjects(FrameView*);
- void updateShouldUpdateScrollLayerPositionOnMainThread();
+ bool hasNonLayerViewportConstrainedObjects(FrameView*);
+ void updateShouldUpdateScrollLayerPositionOnMainThreadReason();
void setScrollLayer(GraphicsLayer*);
void setNonFastScrollableRegion(const Region&);
@@ -155,7 +156,9 @@
void setScrollParameters(const ScrollParameters&);
void setWheelEventHandlerCount(unsigned);
- void setShouldUpdateScrollLayerPositionOnMainThread(bool);
+#if ENABLE(THREADED_SCROLLING)
+ void setShouldUpdateScrollLayerPositionOnMainThreadReason(ReasonForUpdatingScrollLayerPositionOnMainThreadFlags);
+#endif
void updateMainFrameScrollLayerPosition();
Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinatorNone.cpp (127836 => 127837)
--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinatorNone.cpp 2012-09-07 07:04:46 UTC (rev 127836)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinatorNone.cpp 2012-09-07 07:45:49 UTC (rev 127837)
@@ -67,9 +67,11 @@
{
}
-void ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThread(bool)
+#if ENABLE(THREADED_SCROLLING)
+void ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThreadReason(ReasonForUpdatingScrollLayerPositionOnMainThreadFlags)
{
}
+#endif
bool ScrollingCoordinator::supportsFixedPositionLayers() const
{
Modified: trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp (127836 => 127837)
--- trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp 2012-09-07 07:04:46 UTC (rev 127836)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp 2012-09-07 07:45:49 UTC (rev 127837)
@@ -224,7 +224,7 @@
m_scrollingPerformanceLoggingEnabled = flag;
}
-bool ScrollingTree::scrollingPeformanceLoggingEnabled()
+bool ScrollingTree::scrollingPerformanceLoggingEnabled()
{
return m_scrollingPerformanceLoggingEnabled;
}
Modified: trunk/Source/WebCore/page/scrolling/ScrollingTree.h (127836 => 127837)
--- trunk/Source/WebCore/page/scrolling/ScrollingTree.h 2012-09-07 07:04:46 UTC (rev 127836)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTree.h 2012-09-07 07:45:49 UTC (rev 127837)
@@ -98,7 +98,7 @@
#endif
void setScrollingPerformanceLoggingEnabled(bool flag);
- bool scrollingPeformanceLoggingEnabled();
+ bool scrollingPerformanceLoggingEnabled();
private:
explicit ScrollingTree(ScrollingCoordinator*);
Modified: trunk/Source/WebCore/page/scrolling/ScrollingTreeNode.cpp (127836 => 127837)
--- trunk/Source/WebCore/page/scrolling/ScrollingTreeNode.cpp 2012-09-07 07:04:46 UTC (rev 127836)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTreeNode.cpp 2012-09-07 07:45:49 UTC (rev 127837)
@@ -34,7 +34,7 @@
ScrollingTreeNode::ScrollingTreeNode(ScrollingTree* scrollingTree)
: m_scrollingTree(scrollingTree)
- , m_shouldUpdateScrollLayerPositionOnMainThread(false)
+ , m_shouldUpdateScrollLayerPositionOnMainThreadReason(0)
, m_horizontalScrollElasticity(ScrollElasticityNone)
, m_verticalScrollElasticity(ScrollElasticityNone)
, m_hasEnabledHorizontalScrollbar(false)
@@ -56,8 +56,8 @@
if (state->changedProperties() & ScrollingTreeState::ContentsSize)
m_contentsSize = state->contentsSize();
- if (state->changedProperties() & ScrollingTreeState::ShouldUpdateScrollLayerPositionOnMainThread)
- m_shouldUpdateScrollLayerPositionOnMainThread = state->shouldUpdateScrollLayerPositionOnMainThread();
+ if (state->changedProperties() & ScrollingTreeState::ShouldUpdateScrollLayerPositionOnMainThreadReason)
+ m_shouldUpdateScrollLayerPositionOnMainThreadReason = state->shouldUpdateScrollLayerPositionOnMainThreadReason();
if (state->changedProperties() & ScrollingTreeState::HorizontalScrollElasticity)
m_horizontalScrollElasticity = state->horizontalScrollElasticity();
Modified: trunk/Source/WebCore/page/scrolling/ScrollingTreeNode.h (127836 => 127837)
--- trunk/Source/WebCore/page/scrolling/ScrollingTreeNode.h 2012-09-07 07:04:46 UTC (rev 127836)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTreeNode.h 2012-09-07 07:45:49 UTC (rev 127837)
@@ -30,6 +30,7 @@
#include "IntRect.h"
#include "ScrollTypes.h"
+#include "ScrollingTreeState.h"
#include <wtf/PassOwnPtr.h>
namespace WebCore {
@@ -47,7 +48,7 @@
virtual void handleWheelEvent(const PlatformWheelEvent&) = 0;
virtual void setScrollPosition(const IntPoint&) = 0;
- bool shouldUpdateScrollLayerPositionOnMainThread() const { return m_shouldUpdateScrollLayerPositionOnMainThread; }
+ ReasonForUpdatingScrollLayerPositionOnMainThreadFlags shouldUpdateScrollLayerPositionOnMainThreadReason() const { return m_shouldUpdateScrollLayerPositionOnMainThreadReason; }
protected:
explicit ScrollingTreeNode(ScrollingTree*);
@@ -74,7 +75,7 @@
IntSize m_contentsSize;
IntPoint m_scrollOrigin;
- bool m_shouldUpdateScrollLayerPositionOnMainThread;
+ ReasonForUpdatingScrollLayerPositionOnMainThreadFlags m_shouldUpdateScrollLayerPositionOnMainThreadReason;
ScrollElasticity m_horizontalScrollElasticity;
ScrollElasticity m_verticalScrollElasticity;
Modified: trunk/Source/WebCore/page/scrolling/ScrollingTreeState.cpp (127836 => 127837)
--- trunk/Source/WebCore/page/scrolling/ScrollingTreeState.cpp 2012-09-07 07:04:46 UTC (rev 127836)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTreeState.cpp 2012-09-07 07:45:49 UTC (rev 127837)
@@ -38,7 +38,7 @@
ScrollingTreeState::ScrollingTreeState()
: m_changedProperties(0)
, m_wheelEventHandlerCount(0)
- , m_shouldUpdateScrollLayerPositionOnMainThread(false)
+ , m_shouldUpdateScrollLayerPositionOnMainThreadReason(0)
, m_horizontalScrollElasticity(ScrollElasticityNone)
, m_verticalScrollElasticity(ScrollElasticityNone)
, m_hasEnabledHorizontalScrollbar(false)
@@ -88,13 +88,13 @@
m_changedProperties |= WheelEventHandlerCount;
}
-void ScrollingTreeState::setShouldUpdateScrollLayerPositionOnMainThread(bool shouldUpdateScrollLayerPositionOnMainThread)
+void ScrollingTreeState::setShouldUpdateScrollLayerPositionOnMainThreadReason(ReasonForUpdatingScrollLayerPositionOnMainThreadFlags reasons)
{
- if (m_shouldUpdateScrollLayerPositionOnMainThread == shouldUpdateScrollLayerPositionOnMainThread)
+ if ((bool)m_shouldUpdateScrollLayerPositionOnMainThreadReason == (bool)reasons)
return;
- m_shouldUpdateScrollLayerPositionOnMainThread = shouldUpdateScrollLayerPositionOnMainThread;
- m_changedProperties |= ShouldUpdateScrollLayerPositionOnMainThread;
+ m_shouldUpdateScrollLayerPositionOnMainThreadReason = reasons;
+ m_changedProperties |= ShouldUpdateScrollLayerPositionOnMainThreadReason;
}
void ScrollingTreeState::setHorizontalScrollElasticity(ScrollElasticity horizontalScrollElasticity)
Modified: trunk/Source/WebCore/page/scrolling/ScrollingTreeState.h (127836 => 127837)
--- trunk/Source/WebCore/page/scrolling/ScrollingTreeState.h 2012-09-07 07:04:46 UTC (rev 127836)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTreeState.h 2012-09-07 07:45:49 UTC (rev 127837)
@@ -40,6 +40,8 @@
namespace WebCore {
+typedef unsigned ReasonForUpdatingScrollLayerPositionOnMainThreadFlags;
+
// The ScrollingTreeState object keeps track of the current state of scrolling related properties.
// Whenever any properties change, the scrolling coordinator will be informed and will update the state
// and schedule a timer that will clone the new state and send it over to the scrolling thread, avoiding locking.
@@ -54,7 +56,7 @@
ContentsSize = 1 << 1,
NonFastScrollableRegion = 1 << 2,
WheelEventHandlerCount = 1 << 3,
- ShouldUpdateScrollLayerPositionOnMainThread = 1 << 4,
+ ShouldUpdateScrollLayerPositionOnMainThreadReason = 1 << 4,
HorizontalScrollElasticity = 1 << 5,
VerticalScrollElasticity = 1 << 6,
HasEnabledHorizontalScrollbar = 1 << 7,
@@ -66,6 +68,14 @@
RequestedScrollPosition = 1 << 13,
};
+ enum ReasonForUpdatingScrollLayerPositionOnMainThread {
+ ForcedOnMainThread = 1 << 0,
+ HasSlowRepaintObjects = 1 << 1,
+ HasNonCompositedViewportConstrainedObjects = 1 << 2,
+ HasNonLayerViewportConstrainedObjects = 1 << 3,
+ IsImageDocument = 1 << 4
+ };
+
bool hasChangedProperties() const { return m_changedProperties; }
unsigned changedProperties() const { return m_changedProperties; }
@@ -81,8 +91,8 @@
unsigned wheelEventHandlerCount() const { return m_wheelEventHandlerCount; }
void setWheelEventHandlerCount(unsigned);
- bool shouldUpdateScrollLayerPositionOnMainThread() const { return m_shouldUpdateScrollLayerPositionOnMainThread; }
- void setShouldUpdateScrollLayerPositionOnMainThread(bool);
+ ReasonForUpdatingScrollLayerPositionOnMainThreadFlags shouldUpdateScrollLayerPositionOnMainThreadReason() const { return m_shouldUpdateScrollLayerPositionOnMainThreadReason; }
+ void setShouldUpdateScrollLayerPositionOnMainThreadReason(ReasonForUpdatingScrollLayerPositionOnMainThreadFlags);
ScrollElasticity horizontalScrollElasticity() const { return m_horizontalScrollElasticity; }
void setHorizontalScrollElasticity(ScrollElasticity);
@@ -126,7 +136,7 @@
unsigned m_wheelEventHandlerCount;
- bool m_shouldUpdateScrollLayerPositionOnMainThread;
+ ReasonForUpdatingScrollLayerPositionOnMainThreadFlags m_shouldUpdateScrollLayerPositionOnMainThreadReason;
ScrollElasticity m_horizontalScrollElasticity;
ScrollElasticity m_verticalScrollElasticity;
Modified: trunk/Source/WebCore/page/scrolling/chromium/ScrollingCoordinatorChromium.cpp (127836 => 127837)
--- trunk/Source/WebCore/page/scrolling/chromium/ScrollingCoordinatorChromium.cpp 2012-09-07 07:04:46 UTC (rev 127836)
+++ trunk/Source/WebCore/page/scrolling/chromium/ScrollingCoordinatorChromium.cpp 2012-09-07 07:45:49 UTC (rev 127837)
@@ -221,13 +221,15 @@
m_private->scrollLayer()->setHaveWheelEventHandlers(wheelEventHandlerCount > 0);
}
-void ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThread(bool should)
+#if ENABLE(THREADED_SCROLLING)
+void ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThreadReason(ReasonForUpdatingScrollLayerPositionOnMainThreadFlags reasons)
{
// We won't necessarily get a setScrollLayer() call before this one, so grab the root ourselves.
setScrollLayer(scrollLayerForFrameView(m_page->mainFrame()->view()));
if (m_private->scrollLayer())
- m_private->scrollLayer()->setShouldScrollOnMainThread(should);
+ m_private->scrollLayer()->setShouldScrollOnMainThread(reasons);
}
+#endif
bool ScrollingCoordinator::supportsFixedPositionLayers() const
{
Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeMac.mm (127836 => 127837)
--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeMac.mm 2012-09-07 07:04:46 UTC (rev 127836)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeMac.mm 2012-09-07 07:45:49 UTC (rev 127837)
@@ -62,7 +62,7 @@
RetainPtr<CGColorRef> backgroundColor;
- if (m_rootNode->shouldUpdateScrollLayerPositionOnMainThread())
+ if (m_rootNode->shouldUpdateScrollLayerPositionOnMainThreadReason())
backgroundColor = adoptCF(CGColorCreateGenericRGB(1, 0, 0, .7));
{
Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeNodeMac.mm (127836 => 127837)
--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeNodeMac.mm 2012-09-07 07:04:46 UTC (rev 127836)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeNodeMac.mm 2012-09-07 07:45:49 UTC (rev 127837)
@@ -37,9 +37,13 @@
#include <wtf/CurrentTime.h>
#include <wtf/Deque.h>
+#include <wtf/text/StringBuilder.h>
+#include <wtf/text/CString.h>
namespace WebCore {
+static void logThreadedScrollingMode(unsigned reasonsForUpdatingScrollLayerPositionOnMainThread);
+
PassOwnPtr<ScrollingTreeNode> ScrollingTreeNode::create(ScrollingTree* scrollingTree)
{
return adoptPtr(new ScrollingTreeNodeMac(scrollingTree));
@@ -70,15 +74,22 @@
if (state->changedProperties() & (ScrollingTreeState::ScrollLayer | ScrollingTreeState::ContentsSize | ScrollingTreeState::ViewportRect))
updateMainFramePinState(scrollPosition());
- if ((state->changedProperties() & ScrollingTreeState::ShouldUpdateScrollLayerPositionOnMainThread) && shouldUpdateScrollLayerPositionOnMainThread()) {
- // We're transitioning to the slow "update scroll layer position on the main thread" mode.
- // Initialize the probable main thread scroll position with the current scroll layer position.
- if (state->changedProperties() & ScrollingTreeState::RequestedScrollPosition)
- m_probableMainThreadScrollPosition = state->requestedScrollPosition();
- else {
- CGPoint scrollLayerPosition = m_scrollLayer.get().position;
- m_probableMainThreadScrollPosition = IntPoint(-scrollLayerPosition.x, -scrollLayerPosition.y);
+ if ((state->changedProperties() & ScrollingTreeState::ShouldUpdateScrollLayerPositionOnMainThreadReason)) {
+ unsigned reasonsForUpdatingScrollLayerPositionOnMainThread = this->shouldUpdateScrollLayerPositionOnMainThreadReason();
+
+ if (reasonsForUpdatingScrollLayerPositionOnMainThread) {
+ // We're transitioning to the slow "update scroll layer position on the main thread" mode.
+ // Initialize the probable main thread scroll position with the current scroll layer position.
+ if (state->changedProperties() & ScrollingTreeState::RequestedScrollPosition)
+ m_probableMainThreadScrollPosition = state->requestedScrollPosition();
+ else {
+ CGPoint scrollLayerPosition = m_scrollLayer.get().position;
+ m_probableMainThreadScrollPosition = IntPoint(-scrollLayerPosition.x, -scrollLayerPosition.y);
+ }
}
+
+ if (scrollingTree()->scrollingPerformanceLoggingEnabled())
+ logThreadedScrollingMode(reasonsForUpdatingScrollLayerPositionOnMainThread);
}
}
@@ -225,7 +236,7 @@
IntPoint ScrollingTreeNodeMac::scrollPosition() const
{
- if (shouldUpdateScrollLayerPositionOnMainThread())
+ if (shouldUpdateScrollLayerPositionOnMainThreadReason())
return m_probableMainThreadScrollPosition;
CGPoint scrollLayerPosition = m_scrollLayer.get().position;
@@ -240,7 +251,7 @@
setScrollPositionWithoutContentEdgeConstraints(newScrollPosition);
- if (scrollingTree()->scrollingPeformanceLoggingEnabled())
+ if (scrollingTree()->scrollingPerformanceLoggingEnabled())
logExposedUnfilledArea();
}
@@ -248,7 +259,7 @@
{
updateMainFramePinState(scrollPosition);
- if (shouldUpdateScrollLayerPositionOnMainThread()) {
+ if (shouldUpdateScrollLayerPositionOnMainThreadReason()) {
m_probableMainThreadScrollPosition = scrollPosition;
scrollingTree()->updateMainFrameScrollPositionAndScrollLayerPosition(scrollPosition);
return;
@@ -260,7 +271,7 @@
void ScrollingTreeNodeMac::setScrollLayerPosition(const IntPoint& position)
{
- ASSERT(!shouldUpdateScrollLayerPositionOnMainThread());
+ ASSERT(!shouldUpdateScrollLayerPositionOnMainThreadReason());
m_scrollLayer.get().position = CGPointMake(-position.x() + scrollOrigin().x(), -position.y() + scrollOrigin().y());
}
@@ -330,6 +341,30 @@
printf("SCROLLING: Exposed tileless area. Time: %f Unfilled Pixels: %u\n", WTF::monotonicallyIncreasingTime(), unfilledArea);
}
+static void logThreadedScrollingMode(unsigned reasonsForUpdatingScrollLayerPositionOnMainThread)
+{
+ if (reasonsForUpdatingScrollLayerPositionOnMainThread) {
+ StringBuilder reasonsDescription;
+
+ if (reasonsForUpdatingScrollLayerPositionOnMainThread & ScrollingTreeState::ForcedOnMainThread)
+ reasonsDescription.append("forced,");
+ if (reasonsForUpdatingScrollLayerPositionOnMainThread & ScrollingTreeState::HasSlowRepaintObjects)
+ reasonsDescription.append("slow-repaint objects,");
+ if (reasonsForUpdatingScrollLayerPositionOnMainThread & ScrollingTreeState::HasNonCompositedViewportConstrainedObjects)
+ reasonsDescription.append("viewport-constrained objects,");
+ if (reasonsForUpdatingScrollLayerPositionOnMainThread & ScrollingTreeState::HasNonLayerViewportConstrainedObjects)
+ reasonsDescription.append("non-layer viewport-constrained objects,");
+ if (reasonsForUpdatingScrollLayerPositionOnMainThread & ScrollingTreeState::IsImageDocument)
+ reasonsDescription.append("image document,");
+
+ // Strip the trailing comma.
+ String reasonsDescriptionTrimmed = reasonsDescription.toString().left(reasonsDescription.length() - 1);
+
+ WTFLogAlways("SCROLLING: Switching to main-thread scrolling mode. Time: %f Reason(s): %s\n", WTF::monotonicallyIncreasingTime(), reasonsDescriptionTrimmed.ascii().data());
+ } else
+ WTFLogAlways("SCROLLING: Switching to threaded scrolling mode. Time: %f\n", WTF::monotonicallyIncreasingTime());
+}
+
} // namespace WebCore
#endif // ENABLE(THREADED_SCROLLING)
Modified: trunk/Source/WebKit2/ChangeLog (127836 => 127837)
--- trunk/Source/WebKit2/ChangeLog 2012-09-07 07:04:46 UTC (rev 127836)
+++ trunk/Source/WebKit2/ChangeLog 2012-09-07 07:45:49 UTC (rev 127837)
@@ -1,3 +1,17 @@
+2012-09-07 Tim Horton <timothy_hor...@apple.com>
+
+ Add optional debug logging when we fall into/out of threaded scrolling
+ https://bugs.webkit.org/show_bug.cgi?id=93898
+ <rdar://problem/12089098>
+
+ Reviewed by Simon Fraser.
+
+ Update the scrolling tree's scrollingPerformanceLoggingEnabled preference
+ before the early-return if we don't have layer debugging borders on.
+
+ * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
+ (WebKit::TiledCoreAnimationDrawingArea::updatePreferences):
+
2012-09-06 Jinwoo Song <jinwoo7.s...@samsung.com>
Deploy StringBuilder in more places in WebKit2
Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm (127836 => 127837)
--- trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm 2012-09-07 07:04:46 UTC (rev 127836)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm 2012-09-07 07:45:49 UTC (rev 127837)
@@ -208,6 +208,9 @@
void TiledCoreAnimationDrawingArea::updatePreferences()
{
+ bool scrollingPerformanceLoggingEnabled = m_webPage->scrollingPerformanceLoggingEnabled();
+ ScrollingThread::dispatch(bind(&ScrollingTree::setScrollingPerformanceLoggingEnabled, m_webPage->corePage()->scrollingCoordinator()->scrollingTree(), scrollingPerformanceLoggingEnabled));
+
bool showDebugBorders = m_webPage->corePage()->settings()->showDebugBorders();
if (showDebugBorders == !!m_debugInfoLayer)
@@ -221,10 +224,7 @@
m_debugInfoLayer = nullptr;
}
- bool scrollingPerformanceLoggingEnabled = m_webPage->scrollingPerformanceLoggingEnabled();
-
ScrollingThread::dispatch(bind(&ScrollingTree::setDebugRootLayer, m_webPage->corePage()->scrollingCoordinator()->scrollingTree(), m_debugInfoLayer));
- ScrollingThread::dispatch(bind(&ScrollingTree::setScrollingPerformanceLoggingEnabled, m_webPage->corePage()->scrollingCoordinator()->scrollingTree(), scrollingPerformanceLoggingEnabled));
}
void TiledCoreAnimationDrawingArea::dispatchAfterEnsuringUpdatedScrollPosition(const Function<void ()>& functionRef)