Add support for hosting layers in the window server in WebKit2
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 5 Mar 2012 22:53:43 +0000 (22:53 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 5 Mar 2012 22:53:43 +0000 (22:53 +0000)
commite63e544cba68a57a48bcd3090f9972b9ef09e97a
tree9d00f5bd660d5863bb505e5dbe8b1d2ca67188c7
parent2a100384e9450664dd261e44bb890b357c5d81b6
Add support for hosting layers in the window server in WebKit2
<rdar://problem/10400246>
https://bugs.webkit.org/show_bug.cgi?id=80310

Reviewed by Anders Carlsson.

Source/JavaScriptCore:

* wtf/Platform.h:
Add HAVE_LAYER_HOSTING_IN_WINDOW_SERVER.

Source/WebKit2:

This currently only works if you are using TiledCoreAnimation drawing model.

* Platform/mac/LayerHostingContext.h: Renamed from Source/WebKit2/Platform/mac/RemoteLayerClient.h.
* Platform/mac/LayerHostingContext.mm: Renamed from Source/WebKit2/Platform/mac/RemoteLayerClient.mm.
(WebKit::LayerHostingContext::createForPort):
(WebKit::LayerHostingContext::LayerHostingContext):
(WebKit::LayerHostingContext::createForWindowServer):
(WebKit::LayerHostingContext::~LayerHostingContext):
(WebKit::LayerHostingContext::setRootLayer):
(WebKit::LayerHostingContext::rootLayer):
(WebKit::LayerHostingContext::contextID):
(WebKit::LayerHostingContext::invalidate):
Renamed RemoteLayerClient to LayerHostingContext and add ability to use the window server
as the remote context.

* PluginProcess/PluginControllerProxy.cpp:
* PluginProcess/PluginControllerProxy.h:
* PluginProcess/mac/PluginControllerProxyMac.mm:
Update for new names.

* Shared/LayerTreeContext.h:
Add LayerHostingMode enum.

* UIProcess/PageClient.h:
* UIProcess/API/mac/PageClientImpl.h:
* UIProcess/API/mac/PageClientImpl.mm:
(WebKit::PageClientImpl::layerHostingMode):
(WebKit::PageClientImpl::updateAcceleratedCompositingMode):
Add PageClient access points to get the current layer hosting mode,
and a hook to tell the underlying view that the layer hosting context
has changed.

* UIProcess/API/mac/WKViewInternal.h:
* UIProcess/API/mac/WKView.mm:
(-[WKView _updateAcceleratedCompositingMode:WebKit::]):
Implement responding to a new layer hosting context as a simple
exit and re-entrance of compositing.

* UIProcess/DrawingAreaProxy.h:
(WebKit::DrawingAreaProxy::layerHostingModeDidChange):
(WebKit::DrawingAreaProxy::updateAcceleratedCompositingMode):
* UIProcess/DrawingAreaProxy.messages.in:
* UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
(TiledCoreAnimationDrawingAreaProxy):
* UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
(WebKit::TiledCoreAnimationDrawingAreaProxy::layerHostingModeDidChange):
(WebKit::TiledCoreAnimationDrawingAreaProxy::updateAcceleratedCompositingMode):
Pipe layer hosting changes around.

* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::layerHostingMode):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::WebPageProxy):
(WebKit::WebPageProxy::viewStateDidChange):
Cache the current layer hosting mode so we don't overzealously
tell the WebProcess to reset its context. Re-check layer hosting
mode each time we are added/removed from a window.

* WebProcess/FullScreen/mac/WebFullScreenManagerMac.h:
* WebProcess/FullScreen/mac/WebFullScreenManagerMac.mm:
Update for new names.

* WebProcess/WebPage/DrawingArea.h:
(WebKit::DrawingArea::setDeviceScaleFactor):
(WebKit::DrawingArea::setLayerHostingMode):
* WebProcess/WebPage/DrawingArea.messages.in:
Pipe layer hosting changes around.

* WebProcess/WebPage/ca/mac/LayerTreeHostCAMac.h:
* WebProcess/WebPage/ca/mac/LayerTreeHostCAMac.mm:
(WebKit::LayerTreeHostCAMac::~LayerTreeHostCAMac):
(WebKit::LayerTreeHostCAMac::platformInitialize):
(WebKit::LayerTreeHostCAMac::invalidate):
Update for new names.

* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
(WebKit::TiledCoreAnimationDrawingArea::setLayerHostingMode):
Respond to a change in the layer hosting mode by invalidating our old context,
making a new one of the right type, and informing the UIProcess of our new context.

* WebKit2.xcodeproj/project.pbxproj:
Add new files.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@109804 268f45cc-cd09-0410-ab3c-d52691b4dbfc
37 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/wtf/Platform.h
Source/WebKit2/ChangeLog
Source/WebKit2/Platform/mac/LayerHostingContext.h [moved from Source/WebKit2/Platform/mac/RemoteLayerClient.h with 64% similarity]
Source/WebKit2/Platform/mac/LayerHostingContext.mm [moved from Source/WebKit2/Platform/mac/RemoteLayerClient.mm with 56% similarity]
Source/WebKit2/PluginProcess/PluginControllerProxy.cpp
Source/WebKit2/PluginProcess/PluginControllerProxy.h
Source/WebKit2/PluginProcess/mac/PluginControllerProxyMac.mm
Source/WebKit2/Shared/LayerTreeContext.h
Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp
Source/WebKit2/UIProcess/API/efl/PageClientImpl.h
Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp
Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h
Source/WebKit2/UIProcess/API/mac/PageClientImpl.h
Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm
Source/WebKit2/UIProcess/API/mac/WKView.mm
Source/WebKit2/UIProcess/API/mac/WKViewInternal.h
Source/WebKit2/UIProcess/DrawingAreaProxy.h
Source/WebKit2/UIProcess/DrawingAreaProxy.messages.in
Source/WebKit2/UIProcess/PageClient.h
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/UIProcess/WebPageProxy.h
Source/WebKit2/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h
Source/WebKit2/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm
Source/WebKit2/UIProcess/qt/QtPageClient.cpp
Source/WebKit2/UIProcess/qt/QtPageClient.h
Source/WebKit2/UIProcess/win/WebView.cpp
Source/WebKit2/UIProcess/win/WebView.h
Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
Source/WebKit2/WebProcess/FullScreen/mac/WebFullScreenManagerMac.h
Source/WebKit2/WebProcess/FullScreen/mac/WebFullScreenManagerMac.mm
Source/WebKit2/WebProcess/WebPage/DrawingArea.h
Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in
Source/WebKit2/WebProcess/WebPage/ca/mac/LayerTreeHostCAMac.h
Source/WebKit2/WebProcess/WebPage/ca/mac/LayerTreeHostCAMac.mm
Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h
Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm