- Revision
- 103191
- Author
- [email protected]
- Date
- 2011-12-18 14:28:49 -0800 (Sun, 18 Dec 2011)
Log Message
Set the main frame view scroll position asynchronously
https://bugs.webkit.org/show_bug.cgi?id=74823
Reviewed by Sam Weinig.
Source/_javascript_Core:
* _javascript_Core.exp:
Source/WebCore:
* page/ScrollingCoordinator.cpp:
(WebCore::ScrollingCoordinator::ScrollingCoordinator):
Initialize m_didDispatchDidUpdateMainFrameScrollPosition to false.
(WebCore::ScrollingCoordinator::didUpdateMainFrameScrollPosition):
Get the scroll position, reset m_didDispatchDidUpdateMainFrameScrollPosition to false and
then call FrameView::setScrollOffset to update the scroll position.
* page/ScrollingCoordinator.h:
* page/mac/ScrollingCoordinatorMac.mm:
(WebCore::ScrollingCoordinator::scrollByOnScrollingThread):
Update the scroll position and dispatch ScrollingCoordinator::didUpdateMainFrameScrollPosition on
the main thread if needed.
Source/WebKit2:
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
Don't make the background red.
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (103190 => 103191)
--- trunk/Source/_javascript_Core/ChangeLog 2011-12-18 22:21:05 UTC (rev 103190)
+++ trunk/Source/_javascript_Core/ChangeLog 2011-12-18 22:28:49 UTC (rev 103191)
@@ -1,3 +1,12 @@
+2011-12-18 Anders Carlsson <[email protected]>
+
+ Set the main frame view scroll position asynchronously
+ https://bugs.webkit.org/show_bug.cgi?id=74823
+
+ Reviewed by Sam Weinig.
+
+ * _javascript_Core.exp:
+
2011-12-10 Andreas Kling <[email protected]>
OpaqueJSClass: Remove RVCT2 workarounds.
Modified: trunk/Source/_javascript_Core/_javascript_Core.exp (103190 => 103191)
--- trunk/Source/_javascript_Core/_javascript_Core.exp 2011-12-18 22:21:05 UTC (rev 103190)
+++ trunk/Source/_javascript_Core/_javascript_Core.exp 2011-12-18 22:28:49 UTC (rev 103191)
@@ -436,6 +436,7 @@
__ZN3WTF15ThreadConditionD1Ev
__ZN3WTF15charactersToIntEPKtmPb
__ZN3WTF16callOnMainThreadEPFvPvES0_
+__ZN3WTF16callOnMainThreadERKNS_8FunctionIFvvEEE
__ZN3WTF16codePointCompareERKNS_6StringES2_
__ZN3WTF16codePointCompareEPKNS_10StringImplES2_
__ZN3WTF16fastZeroedMallocEm
Modified: trunk/Source/WebCore/ChangeLog (103190 => 103191)
--- trunk/Source/WebCore/ChangeLog 2011-12-18 22:21:05 UTC (rev 103190)
+++ trunk/Source/WebCore/ChangeLog 2011-12-18 22:28:49 UTC (rev 103191)
@@ -1,3 +1,24 @@
+2011-12-18 Anders Carlsson <[email protected]>
+
+ Set the main frame view scroll position asynchronously
+ https://bugs.webkit.org/show_bug.cgi?id=74823
+
+ Reviewed by Sam Weinig.
+
+ * page/ScrollingCoordinator.cpp:
+ (WebCore::ScrollingCoordinator::ScrollingCoordinator):
+ Initialize m_didDispatchDidUpdateMainFrameScrollPosition to false.
+
+ (WebCore::ScrollingCoordinator::didUpdateMainFrameScrollPosition):
+ Get the scroll position, reset m_didDispatchDidUpdateMainFrameScrollPosition to false and
+ then call FrameView::setScrollOffset to update the scroll position.
+
+ * page/ScrollingCoordinator.h:
+ * page/mac/ScrollingCoordinatorMac.mm:
+ (WebCore::ScrollingCoordinator::scrollByOnScrollingThread):
+ Update the scroll position and dispatch ScrollingCoordinator::didUpdateMainFrameScrollPosition on
+ the main thread if needed.
+
2011-12-18 Andreas Kling <[email protected]>
JSC/HTMLCollection: Optimize canGetItemsForName().
Modified: trunk/Source/WebCore/page/ScrollingCoordinator.cpp (103190 => 103191)
--- trunk/Source/WebCore/page/ScrollingCoordinator.cpp 2011-12-18 22:21:05 UTC (rev 103190)
+++ trunk/Source/WebCore/page/ScrollingCoordinator.cpp 2011-12-18 22:28:49 UTC (rev 103191)
@@ -47,6 +47,7 @@
ScrollingCoordinator::ScrollingCoordinator(Page* page)
: m_page(page)
+ , m_didDispatchDidUpdateMainFrameScrollPosition(false)
{
}
@@ -103,6 +104,27 @@
return true;
}
+void ScrollingCoordinator::didUpdateMainFrameScrollPosition()
+{
+ ASSERT(isMainThread());
+
+ if (!m_page)
+ return;
+
+ IntPoint scrollPosition;
+
+ {
+ MutexLocker locker(m_mainFrameGeometryMutex);
+ ASSERT(m_didDispatchDidUpdateMainFrameScrollPosition);
+
+ scrollPosition = m_mainFrameScrollPosition;
+ m_didDispatchDidUpdateMainFrameScrollPosition = false;
+ }
+
+ if (FrameView* frameView = m_page->mainFrame()->view())
+ frameView->setScrollOffset(scrollPosition);
+}
+
} // namespace WebCore
#endif // ENABLE(THREADED_SCROLLING)
Modified: trunk/Source/WebCore/page/ScrollingCoordinator.h (103190 => 103191)
--- trunk/Source/WebCore/page/ScrollingCoordinator.h 2011-12-18 22:21:05 UTC (rev 103190)
+++ trunk/Source/WebCore/page/ScrollingCoordinator.h 2011-12-18 22:28:49 UTC (rev 103191)
@@ -71,6 +71,8 @@
static bool isScrollingThread();
static void dispatchOnScrollingThread(const Function<void()>&);
+ // The following functions can only be called from the main thread.
+ void didUpdateMainFrameScrollPosition();
// The following functions can only be called from the scrolling thread.
void scrollByOnScrollingThread(const IntSize& offset);
@@ -87,6 +89,9 @@
#if PLATFORM(MAC)
RetainPtr<PlatformLayer> m_mainFrameScrollLayer;
#endif
+
+ bool m_didDispatchDidUpdateMainFrameScrollPosition;
+ IntPoint m_mainFrameScrollPosition;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/page/mac/ScrollingCoordinatorMac.mm (103190 => 103191)
--- trunk/Source/WebCore/page/mac/ScrollingCoordinatorMac.mm 2011-12-18 22:21:05 UTC (rev 103190)
+++ trunk/Source/WebCore/page/mac/ScrollingCoordinatorMac.mm 2011-12-18 22:28:49 UTC (rev 103191)
@@ -201,6 +201,12 @@
scrollPosition = scrollPosition.shrunkTo(maximumScrollPosition);
updateMainFrameScrollLayerPositionOnScrollingThread(-scrollPosition);
+
+ m_mainFrameScrollPosition = scrollPosition;
+ if (!m_didDispatchDidUpdateMainFrameScrollPosition) {
+ callOnMainThread(bind(&ScrollingCoordinator::didUpdateMainFrameScrollPosition, this));
+ m_didDispatchDidUpdateMainFrameScrollPosition = true;
+ }
}
void ScrollingCoordinator::updateMainFrameScrollLayerPositionOnScrollingThread(const FloatPoint& scrollLayerPosition)
Modified: trunk/Source/WebKit2/ChangeLog (103190 => 103191)
--- trunk/Source/WebKit2/ChangeLog 2011-12-18 22:21:05 UTC (rev 103190)
+++ trunk/Source/WebKit2/ChangeLog 2011-12-18 22:28:49 UTC (rev 103191)
@@ -1,3 +1,14 @@
+2011-12-18 Anders Carlsson <[email protected]>
+
+ Set the main frame view scroll position asynchronously
+ https://bugs.webkit.org/show_bug.cgi?id=74823
+
+ Reviewed by Sam Weinig.
+
+ * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
+ (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
+ Don't make the background red.
+
2011-12-18 Sam Weinig <[email protected]>
Move timestamp down from PlatformEvent subclasses to the base class
Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm (103190 => 103191)
--- trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm 2011-12-18 22:21:05 UTC (rev 103190)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm 2011-12-18 22:28:49 UTC (rev 103191)
@@ -75,9 +75,6 @@
m_rootLayer.get().opaque = YES;
m_rootLayer.get().geometryFlipped = YES;
- // Give the root layer a background color so it's visible on screen.
- m_rootLayer.get().backgroundColor = CGColorCreateGenericRGB(1, 0, 0, 1);
-
mach_port_t serverPort = WebProcess::shared().compositingRenderServerPort();
m_remoteLayerClient = WKCARemoteLayerClientMakeWithServerPort(serverPort);
WKCARemoteLayerClientSetLayer(m_remoteLayerClient.get(), m_rootLayer.get());