Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make sure that the layer hosting mode is up-to-date when reconnecting…
… to a new web process

https://bugs.webkit.org/show_bug.cgi?id=87421
<rdar://problem/11510337>

Reviewed by Beth Dakin.

Send over the layer hosting mode as part of the web page creation parameters and create the right
layer hosting context based on the mode.

* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::encode):
(WebKit::WebPageCreationParameters::decode):
* Shared/WebPageCreationParameters.h:
(WebPageCreationParameters):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::creationParameters):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage):
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
(TiledCoreAnimationDrawingArea):
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
(WebKit::TiledCoreAnimationDrawingArea::setLayerHostingMode):
(WebKit):
(WebKit::TiledCoreAnimationDrawingArea::updateLayerHostingContext):

Canonical link: https://commits.webkit.org/105195@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@118439 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Anders Carlsson committed May 24, 2012
1 parent 6edfad8 commit c81418c
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 26 deletions.
28 changes: 28 additions & 0 deletions Source/WebKit2/ChangeLog
@@ -1,3 +1,31 @@
2012-05-24 Anders Carlsson <andersca@apple.com>

Make sure that the layer hosting mode is up-to-date when reconnecting to a new web process
https://bugs.webkit.org/show_bug.cgi?id=87421
<rdar://problem/11510337>

Reviewed by Beth Dakin.

Send over the layer hosting mode as part of the web page creation parameters and create the right
layer hosting context based on the mode.

* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::encode):
(WebKit::WebPageCreationParameters::decode):
* Shared/WebPageCreationParameters.h:
(WebPageCreationParameters):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::creationParameters):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage):
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
(TiledCoreAnimationDrawingArea):
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
(WebKit::TiledCoreAnimationDrawingArea::setLayerHostingMode):
(WebKit):
(WebKit::TiledCoreAnimationDrawingArea::updateLayerHostingContext):

2012-05-24 John Mellor <johnme@chromium.org>

Font Boosting: Add compile flag and runtime setting
Expand Down
3 changes: 3 additions & 0 deletions Source/WebKit2/Shared/WebPageCreationParameters.cpp
Expand Up @@ -60,6 +60,7 @@ void WebPageCreationParameters::encode(CoreIPC::ArgumentEncoder* encoder) const

#if PLATFORM(MAC)
encoder->encode(isSmartInsertDeleteEnabled);
encoder->encodeEnum(layerHostingMode);
#endif

#if PLATFORM(WIN)
Expand Down Expand Up @@ -121,6 +122,8 @@ bool WebPageCreationParameters::decode(CoreIPC::ArgumentDecoder* decoder, WebPag
#if PLATFORM(MAC)
if (!decoder->decode(parameters.isSmartInsertDeleteEnabled))
return false;
if (!decoder->decodeEnum(parameters.layerHostingMode))
return false;
#endif

#if PLATFORM(WIN)
Expand Down
1 change: 1 addition & 0 deletions Source/WebKit2/Shared/WebPageCreationParameters.h
Expand Up @@ -82,6 +82,7 @@ struct WebPageCreationParameters {

#if PLATFORM(MAC)
bool isSmartInsertDeleteEnabled;
LayerHostingMode layerHostingMode;
#endif

#if PLATFORM(WIN)
Expand Down
1 change: 1 addition & 0 deletions Source/WebKit2/UIProcess/WebPageProxy.cpp
Expand Up @@ -3463,6 +3463,7 @@ WebPageCreationParameters WebPageProxy::creationParameters() const

#if PLATFORM(MAC)
parameters.isSmartInsertDeleteEnabled = m_isSmartInsertDeleteEnabled;
parameters.layerHostingMode = m_layerHostingMode;
#endif

#if PLATFORM(WIN)
Expand Down
2 changes: 1 addition & 1 deletion Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Expand Up @@ -192,7 +192,7 @@ WebPage::WebPage(uint64_t pageID, const WebPageCreationParameters& parameters)
#if PLATFORM(MAC)
, m_windowIsVisible(false)
, m_isSmartInsertDeleteEnabled(parameters.isSmartInsertDeleteEnabled)
, m_layerHostingMode(LayerHostingModeDefault)
, m_layerHostingMode(parameters.layerHostingMode)
, m_keyboardEventBeingInterpreted(0)
#elif PLATFORM(WIN)
, m_nativeWindow(parameters.nativeWindow)
Expand Down
Expand Up @@ -86,6 +86,8 @@ class TiledCoreAnimationDrawingArea : public DrawingArea, WebCore::GraphicsLayer
virtual void setDeviceScaleFactor(float) OVERRIDE;
virtual void setLayerHostingMode(uint32_t) OVERRIDE;

void updateLayerHostingContext();

void setRootCompositingLayer(CALayer *);

void createPageOverlayLayer();
Expand All @@ -95,7 +97,6 @@ class TiledCoreAnimationDrawingArea : public DrawingArea, WebCore::GraphicsLayer
WebCore::LayerFlushScheduler m_layerFlushScheduler;

OwnPtr<LayerHostingContext> m_layerHostingContext;
LayerHostingMode m_layerHostingMode;

RetainPtr<CALayer> m_rootLayer;
RetainPtr<CALayer> m_pendingRootCompositingLayer;
Expand Down
Expand Up @@ -83,8 +83,7 @@ + (void)synchronize;
m_rootLayer.get().opaque = YES;
m_rootLayer.get().geometryFlipped = YES;

m_layerHostingContext = LayerHostingContext::createForPort(WebProcess::shared().compositingRenderServerPort());
m_layerHostingContext->setRootLayer(m_rootLayer.get());
updateLayerHostingContext();

LayerTreeContext layerTreeContext;
layerTreeContext.contextID = m_layerHostingContext->contextID();
Expand Down Expand Up @@ -352,34 +351,40 @@ + (void)synchronize;
void TiledCoreAnimationDrawingArea::setLayerHostingMode(uint32_t opaqueLayerHostingMode)
{
LayerHostingMode layerHostingMode = static_cast<LayerHostingMode>(opaqueLayerHostingMode);
if (layerHostingMode != m_layerHostingContext->layerHostingMode()) {
// The mode has changed.

// First, invalidate the old hosting context.
if (layerHostingMode == m_webPage->layerHostingMode())
return;

m_webPage->setLayerHostingMode(layerHostingMode);

updateLayerHostingContext();

// Finally, inform the UIProcess that the context has changed.
LayerTreeContext layerTreeContext;
layerTreeContext.contextID = m_layerHostingContext->contextID();
m_webPage->send(Messages::DrawingAreaProxy::UpdateAcceleratedCompositingMode(0, layerTreeContext));
}

void TiledCoreAnimationDrawingArea::updateLayerHostingContext()
{
// Invalidate the old context.
if (m_layerHostingContext) {
m_layerHostingContext->invalidate();
m_layerHostingContext = nullptr;
}

// Create a new context and set it up.
switch (layerHostingMode) {
case LayerHostingModeDefault:
m_layerHostingContext = LayerHostingContext::createForPort(WebProcess::shared().compositingRenderServerPort());
break;
// Create a new context and set it up.
switch (m_webPage->layerHostingMode()) {
case LayerHostingModeDefault:
m_layerHostingContext = LayerHostingContext::createForPort(WebProcess::shared().compositingRenderServerPort());
break;
#if HAVE(LAYER_HOSTING_IN_WINDOW_SERVER)
case LayerHostingModeInWindowServer:
m_layerHostingContext = LayerHostingContext::createForWindowServer();
break;
case LayerHostingModeInWindowServer:
m_layerHostingContext = LayerHostingContext::createForWindowServer();
break;
#endif
}

m_layerHostingContext->setRootLayer(m_rootLayer.get());

m_webPage->setLayerHostingMode(layerHostingMode);

// Finally, inform the UIProcess that the context has changed.
LayerTreeContext layerTreeContext;
layerTreeContext.contextID = m_layerHostingContext->contextID();
m_webPage->send(Messages::DrawingAreaProxy::UpdateAcceleratedCompositingMode(0, layerTreeContext));
}

m_layerHostingContext->setRootLayer(m_rootLayer.get());
}

void TiledCoreAnimationDrawingArea::setRootCompositingLayer(CALayer *layer)
Expand Down

0 comments on commit c81418c

Please sign in to comment.