When the WebContent process is blocked from accessing the WindowServer, the call...
authorpvollan@apple.com <pvollan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 19 Mar 2018 18:04:39 +0000 (18:04 +0000)
committerpvollan@apple.com <pvollan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 19 Mar 2018 18:04:39 +0000 (18:04 +0000)
commitf49d1864daedfc86bfe878c9106ba4e9af3b460c
tree1ea555b6bdd2ce12343e089f1a8da2802b05d66f
parente484b3dd132ac06bbddd4ef686e72217e1527a6d
When the WebContent process is blocked from accessing the WindowServer, the call CVDisplayLinkCreateWithCGDisplay will fail.
https://bugs.webkit.org/show_bug.cgi?id=183604
<rdar://problem/38305109>

Reviewed by Brent Fulgham.

Source/WebCore:

The call to CVDisplayLinkCreateWithCGDisplay can instead be made in the UIProcess. Notify the WebContent process
about display updates by sending a message from the UIProcess on each screen update. This patch adds an extra
IPC step when notifying the WebContent process about display updates. However, the MotionMark benchmark shows no
performance regression when running it with this patch. A possible explanation for this is that the high priority
display link thread is now running in the UIProcess instead of the WebContent process, which means there will be
more available CPU resources for the WebContent process. A run loop observer is added to make sure that only one
display callback (for each display observer) is executed in a single iteration of the run loop. This will make
sure we are not filling the IPC message queue with unhandled display link messages.

No new tests, covered by existing tests.

* platform/graphics/DisplayRefreshMonitor.h:
(WebCore::DisplayRefreshMonitor::displayLinkFired):
* platform/graphics/DisplayRefreshMonitorManager.cpp:
(WebCore::DisplayRefreshMonitorManager::displayWasUpdated):
* platform/graphics/DisplayRefreshMonitorManager.h:
* platform/graphics/mac/DisplayRefreshMonitorMac.h:

Source/WebKit:

* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/mac/DisplayLink.cpp: Added.
(WebKit::DisplayLink::DisplayLink):
(WebKit::DisplayLink::~DisplayLink):
(WebKit::DisplayLink::displayLinkCallback):
* UIProcess/mac/DisplayLink.h: Added.
* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::startDisplayRefreshMonitor):
(WebKit::WebPageProxy::stopDisplayRefreshMonitor):
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/WebPage/DrawingArea.cpp:
(WebKit::DrawingArea::createDisplayRefreshMonitor):
* WebProcess/WebPage/DrawingArea.h:
* WebProcess/WebPage/DrawingArea.messages.in:
* WebProcess/WebPage/mac/DrawingAreaMac.cpp: Added.
(WebKit::DisplayRefreshMonitorMac::create):
(WebKit::DisplayRefreshMonitorMac::DisplayRefreshMonitorMac):
(WebKit::DisplayRefreshMonitorMac::~DisplayRefreshMonitorMac):
(WebKit::DisplayRefreshMonitorMac::requestRefreshCallback):
(WebKit::DisplayRefreshMonitorMac::displayLinkFired):
(WebKit::DrawingArea::screenWasRefreshed):
(WebKit::DrawingArea::createDisplayRefreshMonitor):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@229707 268f45cc-cd09-0410-ab3c-d52691b4dbfc
17 files changed:
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/DisplayRefreshMonitor.h
Source/WebCore/platform/graphics/DisplayRefreshMonitorManager.cpp
Source/WebCore/platform/graphics/DisplayRefreshMonitorManager.h
Source/WebCore/platform/graphics/ios/DisplayRefreshMonitorIOS.h
Source/WebCore/platform/graphics/mac/DisplayRefreshMonitorMac.h
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/WebPageProxy.h
Source/WebKit/UIProcess/WebPageProxy.messages.in
Source/WebKit/UIProcess/mac/DisplayLink.cpp [new file with mode: 0644]
Source/WebKit/UIProcess/mac/DisplayLink.h [new file with mode: 0644]
Source/WebKit/UIProcess/mac/WebPageProxyMac.mm
Source/WebKit/WebKit.xcodeproj/project.pbxproj
Source/WebKit/WebProcess/WebPage/DrawingArea.cpp
Source/WebKit/WebProcess/WebPage/DrawingArea.h
Source/WebKit/WebProcess/WebPage/DrawingArea.messages.in
Source/WebKit/WebProcess/WebPage/mac/DrawingAreaMac.cpp [new file with mode: 0644]