Changeset 261876 in webkit
- Timestamp:
- May 19, 2020, 11:41:14 AM (5 years ago)
- Location:
- trunk/Source
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r261874 r261876 1 2020-05-19 Simon Fraser <simon.fraser@apple.com> 2 3 Push a PlatformDisplayID to scrolling trees, and allow the scrolling thread to get displayDidRefresh notifications 4 https://bugs.webkit.org/show_bug.cgi?id=211034 5 6 Reviewed by Sam Weinig. 7 8 As work towards scrolling thread synchronization with main thread (webkit.org/b210884), allow 9 ScrollingTree to get a displayDidRefresh() call on the scrolling thread. Each 10 tree is associated with a Page which is associated with a display, so the ScrollingTree 11 needs to have a PlatformDisplayID to know which notifications to respond to. 12 13 Eventually, displayDidRefresh() will be used to trigger layer updates on the scrolling 14 thread if the main thread is periodically unresponsive. 15 16 * page/Page.cpp: 17 (WebCore::Page::scrollingCoordinator): 18 (WebCore::Page::windowScreenDidChange): 19 * page/scrolling/AsyncScrollingCoordinator.cpp: 20 (WebCore::AsyncScrollingCoordinator::windowScreenDidChange): 21 * page/scrolling/AsyncScrollingCoordinator.h: 22 * page/scrolling/ScrollingCoordinator.h: 23 (WebCore::ScrollingCoordinator::windowScreenDidChange): 24 * page/scrolling/ScrollingTree.cpp: 25 (WebCore::ScrollingTree::windowScreenDidChange): 26 (WebCore::ScrollingTree::displayID): 27 * page/scrolling/ScrollingTree.h: 28 (WebCore::ScrollingTree::displayDidRefresh): 29 * page/scrolling/ThreadedScrollingTree.cpp: 30 (WebCore::ThreadedScrollingTree::displayDidRefresh): 31 * page/scrolling/ThreadedScrollingTree.h: 32 1 33 2020-05-19 Simon Fraser <simon.fraser@apple.com> 2 34 -
trunk/Source/WebCore/page/Page.cpp
r261741 r261876 435 435 if (!m_scrollingCoordinator) 436 436 m_scrollingCoordinator = ScrollingCoordinator::create(this); 437 438 m_scrollingCoordinator->windowScreenDidChange(m_displayID); 437 439 } 438 440 … … 1120 1122 frame->document()->windowScreenDidChange(displayID); 1121 1123 } 1124 1125 if (m_scrollingCoordinator) 1126 m_scrollingCoordinator->windowScreenDidChange(displayID); 1122 1127 1123 1128 renderingUpdateScheduler().windowScreenDidChange(displayID); -
trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp
r261849 r261876 817 817 } 818 818 819 void AsyncScrollingCoordinator::windowScreenDidChange(PlatformDisplayID displayID) 820 { 821 if (m_scrollingTree) 822 m_scrollingTree->windowScreenDidChange(displayID); 823 } 824 819 825 bool AsyncScrollingCoordinator::isRubberBandInProgress() const 820 826 { -
trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h
r261052 r261876 139 139 WEBCORE_EXPORT bool hasSynchronousScrollingReasons(ScrollingNodeID) const final; 140 140 141 WEBCORE_EXPORT void windowScreenDidChange(PlatformDisplayID) final; 142 141 143 virtual void scheduleTreeStateCommit() = 0; 142 144 -
trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h
r261539 r261876 69 69 #endif 70 70 71 using PlatformDisplayID = uint32_t; 72 71 73 class ScrollingCoordinator : public ThreadSafeRefCounted<ScrollingCoordinator> { 72 74 public: … … 180 182 virtual void scrollableAreaScrollbarLayerDidChange(ScrollableArea&, ScrollbarOrientation) { } 181 183 184 virtual void windowScreenDidChange(PlatformDisplayID) { } 185 182 186 static String synchronousScrollingReasonsAsText(OptionSet<SynchronousScrollingReason>); 183 187 String synchronousScrollingReasonsAsText() const; -
trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp
r261849 r261876 528 528 } 529 529 530 void ScrollingTree::windowScreenDidChange(PlatformDisplayID displayID) 531 { 532 LockHolder locker(m_treeStateMutex); 533 m_treeState.displayID = displayID; 534 } 535 536 PlatformDisplayID ScrollingTree::displayID() 537 { 538 LockHolder locker(m_treeStateMutex); 539 return m_treeState.displayID; 540 } 541 530 542 void ScrollingTree::setScrollingPerformanceLoggingEnabled(bool flag) 531 543 { -
trunk/Source/WebCore/page/scrolling/ScrollingTree.h
r261602 r261876 55 55 class ScrollingTreeScrollingNode; 56 56 enum class EventListenerRegionType : uint8_t; 57 using PlatformDisplayID = uint32_t; 57 58 58 59 class ScrollingTree : public ThreadSafeRefCounted<ScrollingTree> { … … 179 180 virtual void unlockLayersForHitTesting() { } 180 181 182 void windowScreenDidChange(PlatformDisplayID); 183 PlatformDisplayID displayID(); 184 181 185 protected: 182 186 FloatPoint mainFrameScrollPosition() const; … … 217 221 EventTrackingRegions eventTrackingRegions; 218 222 FloatPoint mainFrameScrollPosition; 223 PlatformDisplayID displayID { 0 }; 219 224 bool mainFrameIsRubberBanding { false }; 220 225 bool mainFrameIsScrollSnapping { false }; -
trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.cpp
r261849 r261876 203 203 #endif 204 204 205 void ThreadedScrollingTree::displayDidRefresh(PlatformDisplayID displayID) 206 { 207 if (displayID != this->displayID()) 208 return; 209 210 // We're on the EventDispatcher thread here. 211 212 #if ENABLE(SCROLLING_THREAD) 213 ScrollingThread::dispatch([protectedThis = makeRef(*this)]() { 214 protectedThis->displayDidRefreshOnScrollingThread(); 215 }); 216 #endif 217 } 218 219 void ThreadedScrollingTree::displayDidRefreshOnScrollingThread() 220 { 221 ASSERT(ScrollingThread::isCurrentThread()); 222 } 223 205 224 } // namespace WebCore 206 225 -
trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.h
r261427 r261876 56 56 void invalidate() override; 57 57 58 WEBCORE_EXPORT void displayDidRefresh(PlatformDisplayID); 59 58 60 protected: 59 61 explicit ThreadedScrollingTree(AsyncScrollingCoordinator&); … … 77 79 void propagateSynchronousScrollingReasons(const HashSet<ScrollingNodeID>&) override; 78 80 81 void displayDidRefreshOnScrollingThread(); 82 79 83 RefPtr<AsyncScrollingCoordinator> m_scrollingCoordinator; 80 84 }; -
trunk/Source/WebKit/ChangeLog
r261875 r261876 1 2020-05-19 Simon Fraser <simon.fraser@apple.com> 2 3 Push a PlatformDisplayID to scrolling trees, and allow the scrolling thread to get displayDidRefresh notifications 4 https://bugs.webkit.org/show_bug.cgi?id=211034 5 6 Reviewed by Sam Weinig. 7 8 Prep work for webkit.org/b210884. 9 10 Have EventDispatcher call displayDidRefresh() on each scrolling tree it knows about. It calls this 11 on the EventDispatcher thread; the scrolling tree is responsible for bouncing that to the scrolling thread. 12 13 * WebProcess/WebPage/EventDispatcher.cpp: 14 (WebKit::EventDispatcher::displayDidRefreshOnScrollingThread): 15 (WebKit::EventDispatcher::displayWasRefreshed): 16 * WebProcess/WebPage/EventDispatcher.h: 17 1 18 2020-05-19 Wenson Hsieh <wenson_hsieh@apple.com> 2 19 -
trunk/Source/WebKit/WebProcess/WebPage/EventDispatcher.cpp
r260614 r261876 266 266 void EventDispatcher::displayWasRefreshed(PlatformDisplayID displayID) 267 267 { 268 #if ENABLE(SCROLLING_THREAD) 269 LockHolder locker(m_scrollingTreesMutex); 270 for (auto keyValuePair : m_scrollingTrees) 271 keyValuePair.value->displayDidRefresh(displayID); 272 #endif 273 268 274 RunLoop::main().dispatch([displayID]() { 269 275 DisplayRefreshMonitorManager::sharedManager().displayWasUpdated(displayID); -
trunk/Source/WebKit/WebProcess/WebPage/EventDispatcher.h
r260614 r261876 103 103 #endif 104 104 105 #if ENABLE(SCROLLING_THREAD) 106 void displayDidRefreshOnScrollingThread(WebCore::PlatformDisplayID); 107 #endif 108 105 109 Ref<WorkQueue> m_queue; 106 110
Note:
See TracChangeset
for help on using the changeset viewer.