Diff
Modified: trunk/Source/WebKit2/ChangeLog (113639 => 113640)
--- trunk/Source/WebKit2/ChangeLog 2012-04-09 23:28:25 UTC (rev 113639)
+++ trunk/Source/WebKit2/ChangeLog 2012-04-09 23:45:43 UTC (rev 113640)
@@ -1,5 +1,74 @@
2012-04-09 No'am Rosenthal <[email protected]>
+ [Qt][WK2] Sync the layer's state and the layer's children separately
+ https://bugs.webkit.org/show_bug.cgi?id=82534
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Switched the WebLayerInfo struct, which includes a single layer's state,
+ to use only POD types that can be serialized via SimpleArgumentCoder.
+ To allow POD-serialization, we serialize the children IDs in a seperate
+ message (SetLayerChildren), and only when the tree layout has actually
+ been modified.
+
+ * Shared/WebLayerTreeInfo.cpp:
+ (WebKit::WebLayerInfo::encode):
+ (WebKit::WebLayerInfo::decode):
+ * Shared/WebLayerTreeInfo.h:
+ (WebKit::WebLayerInfo::WebLayerInfo):
+ * UIProcess/LayerTreeHostProxy.cpp:
+ (WebKit::LayerTreeHostProxy::setCompositingLayerState):
+ (WebKit):
+ (WebKit::LayerTreeHostProxy::setCompositingLayerChildren):
+ * UIProcess/LayerTreeHostProxy.h:
+ (LayerTreeHostProxy):
+ * UIProcess/LayerTreeHostProxy.messages.in:
+ * UIProcess/WebLayerTreeRenderer.cpp:
+ (WebKit::WebLayerTreeRenderer::setLayerChildren):
+ (WebKit):
+ (WebKit::WebLayerTreeRenderer::setLayerState):
+ * UIProcess/WebLayerTreeRenderer.h:
+ (WebLayerTreeRenderer):
+ * WebProcess/WebCoreSupport/WebGraphicsLayer.cpp:
+ (WebCore::WebGraphicsLayer::didChangeLayerState):
+ (WebCore):
+ (WebCore::WebGraphicsLayer::didChangeChildren):
+ (WebCore::WebGraphicsLayer::didChangeGeometry):
+ (WebCore::WebGraphicsLayer::WebGraphicsLayer):
+ (WebCore::WebGraphicsLayer::setChildren):
+ (WebCore::WebGraphicsLayer::addChild):
+ (WebCore::WebGraphicsLayer::addChildAtIndex):
+ (WebCore::WebGraphicsLayer::addChildAbove):
+ (WebCore::WebGraphicsLayer::addChildBelow):
+ (WebCore::WebGraphicsLayer::replaceChild):
+ (WebCore::WebGraphicsLayer::removeFromParent):
+ (WebCore::WebGraphicsLayer::setDrawsContent):
+ (WebCore::WebGraphicsLayer::setContentsOpaque):
+ (WebCore::WebGraphicsLayer::setBackfaceVisibility):
+ (WebCore::WebGraphicsLayer::setOpacity):
+ (WebCore::WebGraphicsLayer::setContentsRect):
+ (WebCore::WebGraphicsLayer::setContentsToImage):
+ (WebCore::WebGraphicsLayer::setMaskLayer):
+ (WebCore::WebGraphicsLayer::setReplicatedByLayer):
+ (WebCore::WebGraphicsLayer::setNeedsDisplayInRect):
+ (WebCore::WebGraphicsLayer::id):
+ (WebCore::WebGraphicsLayer::syncChildren):
+ (WebCore::WebGraphicsLayer::syncLayerState):
+ (WebCore::WebGraphicsLayer::syncImageBackingStore):
+ (WebCore::WebGraphicsLayer::syncCompositingStateForThisLayerOnly):
+ (WebCore::WebGraphicsLayer::setRootLayer):
+ * WebProcess/WebCoreSupport/WebGraphicsLayer.h:
+ (WebGraphicsLayerClient):
+ (WebGraphicsLayer):
+ * WebProcess/WebPage/qt/LayerTreeHostQt.cpp:
+ (WebKit::LayerTreeHostQt::syncLayerState):
+ (WebKit):
+ (WebKit::LayerTreeHostQt::syncLayerChildren):
+ * WebProcess/WebPage/qt/LayerTreeHostQt.h:
+ (LayerTreeHostQt):
+
+2012-04-09 No'am Rosenthal <[email protected]>
+
[Qt][WK2] Accelerated and non-accelerated animations need to be synchronized
https://bugs.webkit.org/show_bug.cgi?id=75780
Modified: trunk/Source/WebKit2/Shared/WebLayerTreeInfo.cpp (113639 => 113640)
--- trunk/Source/WebKit2/Shared/WebLayerTreeInfo.cpp 2012-04-09 23:28:25 UTC (rev 113639)
+++ trunk/Source/WebKit2/Shared/WebLayerTreeInfo.cpp 2012-04-09 23:45:43 UTC (rev 113640)
@@ -22,9 +22,9 @@
#if USE(UI_SIDE_COMPOSITING)
#include "WebLayerTreeInfo.h"
+#include "ArgumentCoders.h"
#include "Arguments.h"
#include "SharedMemory.h"
-#include "WebCoreArgumentCoders.h"
using namespace CoreIPC;
@@ -32,40 +32,12 @@
void WebLayerInfo::encode(CoreIPC::ArgumentEncoder* encoder) const
{
- // We have to divide it to several lines, because CoreIPC::In/Out takes a maximum of 10 arguments.
- encoder->encode(CoreIPC::In(id, name, parent, children, flags, replica, mask, imageBackingStoreID));
- encoder->encode(CoreIPC::In(pos, size, transform, opacity, anchorPoint, childrenTransform, contentsRect));
+ SimpleArgumentCoder<WebLayerInfo>::encode(encoder, *this);
}
bool WebLayerInfo::decode(CoreIPC::ArgumentDecoder* decoder, WebLayerInfo& info)
{
- // We have to divide it to several lines, because CoreIPC::In/Out takes a maximum of 10 arguments.
- if (!decoder->decode(CoreIPC::Out(info.id, info.name, info.parent, info.children, info.flags, info.replica, info.mask, info.imageBackingStoreID)))
- return false;
- if (!decoder->decode(CoreIPC::Out(info.pos, info.size, info.transform, info.opacity, info.anchorPoint, info.childrenTransform, info.contentsRect)))
- return false;
-
- return true;
+ return SimpleArgumentCoder<WebLayerInfo>::decode(decoder, info);
}
-
-void WebLayerTreeInfo::encode(CoreIPC::ArgumentEncoder* encoder) const
-{
- encoder->encode(CoreIPC::In(layers, rootLayerID, deletedLayerIDs, contentScale));
}
-
-bool WebLayerTreeInfo::decode(CoreIPC::ArgumentDecoder* decoder, WebLayerTreeInfo& info)
-{
- return decoder->decode(CoreIPC::Out(info.layers, info.rootLayerID, info.deletedLayerIDs, info.contentScale));
-}
-
-void WebLayerUpdateInfo::encode(CoreIPC::ArgumentEncoder* encoder) const
-{
- encoder->encode(CoreIPC::In(layerID, rect, bitmapHandle));
-}
-
-bool WebLayerUpdateInfo::decode(CoreIPC::ArgumentDecoder* decoder, WebLayerUpdateInfo& info)
-{
- return decoder->decode(CoreIPC::Out(info.layerID, info.rect, info.bitmapHandle));
-}
-}
#endif
Modified: trunk/Source/WebKit2/Shared/WebLayerTreeInfo.h (113639 => 113640)
--- trunk/Source/WebKit2/Shared/WebLayerTreeInfo.h 2012-04-09 23:28:25 UTC (rev 113639)
+++ trunk/Source/WebKit2/Shared/WebLayerTreeInfo.h 2012-04-09 23:45:43 UTC (rev 113640)
@@ -34,32 +34,16 @@
typedef uint32_t WebLayerID;
enum { InvalidWebLayerID = 0 };
-struct WebLayerUpdateInfo {
- WebLayerUpdateInfo() { }
- WebLayerUpdateInfo(const WebCore::IntRect& r)
- : layerID(InvalidWebLayerID)
- , rect(r) { }
-
- WebLayerID layerID;
- WebCore::IntRect rect;
- ShareableBitmap::Handle bitmapHandle;
-
- void encode(CoreIPC::ArgumentEncoder*) const;
- static bool decode(CoreIPC::ArgumentDecoder*, WebLayerUpdateInfo&);
-};
-
+// NOTE: WebLayerInfo should only use POD types, as to make serialization faster.
struct WebLayerInfo {
WebLayerInfo()
- : id(InvalidWebLayerID)
- , parent(InvalidWebLayerID)
+ : parent(InvalidWebLayerID)
, replica(InvalidWebLayerID)
, mask(InvalidWebLayerID)
, imageBackingStoreID(0)
, opacity(0)
, flags(0) { }
- String name;
- WebLayerID id;
WebLayerID parent;
WebLayerID replica;
WebLayerID mask;
@@ -84,27 +68,11 @@
};
unsigned int flags;
};
- Vector<WebLayerID> children;
- RefPtr<ShareableBitmap> imageBackingStore;
void encode(CoreIPC::ArgumentEncoder*) const;
static bool decode(CoreIPC::ArgumentDecoder*, WebLayerInfo&);
};
-struct WebLayerTreeInfo {
- WebLayerTreeInfo()
- : rootLayerID(InvalidWebLayerID)
- , contentScale(0) { }
-
- Vector<WebLayerInfo> layers;
- Vector<WebLayerID> deletedLayerIDs;
- WebLayerID rootLayerID;
- float contentScale;
-
- void encode(CoreIPC::ArgumentEncoder*) const;
- static bool decode(CoreIPC::ArgumentDecoder*, WebLayerTreeInfo&);
-};
-
}
#endif // USE(ACCELERATED_COMPOSITING)
Modified: trunk/Source/WebKit2/UIProcess/LayerTreeHostProxy.cpp (113639 => 113640)
--- trunk/Source/WebKit2/UIProcess/LayerTreeHostProxy.cpp 2012-04-09 23:28:25 UTC (rev 113639)
+++ trunk/Source/WebKit2/UIProcess/LayerTreeHostProxy.cpp 2012-04-09 23:45:43 UTC (rev 113640)
@@ -98,11 +98,16 @@
updateViewport();
}
-void LayerTreeHostProxy::syncCompositingLayerState(const WebLayerInfo& info)
+void LayerTreeHostProxy::setCompositingLayerState(WebLayerID id, const WebLayerInfo& info)
{
- dispatchUpdate(bind(&WebLayerTreeRenderer::syncLayerParameters, m_renderer.get(), info));
+ dispatchUpdate(bind(&WebLayerTreeRenderer::setLayerState, m_renderer.get(), id, info));
}
+void LayerTreeHostProxy::setCompositingLayerChildren(WebLayerID id, const Vector<WebLayerID>& children)
+{
+ dispatchUpdate(bind(&WebLayerTreeRenderer::setLayerChildren, m_renderer.get(), id, children));
+}
+
void LayerTreeHostProxy::didRenderFrame()
{
dispatchUpdate(bind(&WebLayerTreeRenderer::flushLayerChanges, m_renderer.get()));
Modified: trunk/Source/WebKit2/UIProcess/LayerTreeHostProxy.h (113639 => 113640)
--- trunk/Source/WebKit2/UIProcess/LayerTreeHostProxy.h 2012-04-09 23:28:25 UTC (rev 113639)
+++ trunk/Source/WebKit2/UIProcess/LayerTreeHostProxy.h 2012-04-09 23:45:43 UTC (rev 113640)
@@ -47,7 +47,8 @@
public:
LayerTreeHostProxy(DrawingAreaProxy*);
virtual ~LayerTreeHostProxy();
- void syncCompositingLayerState(const WebLayerInfo&);
+ void setCompositingLayerState(WebLayerID, const WebLayerInfo&);
+ void setCompositingLayerChildren(WebLayerID, const Vector<WebLayerID>&);
void deleteCompositingLayer(WebLayerID);
void setRootCompositingLayer(WebLayerID);
void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
Modified: trunk/Source/WebKit2/UIProcess/LayerTreeHostProxy.messages.in (113639 => 113640)
--- trunk/Source/WebKit2/UIProcess/LayerTreeHostProxy.messages.in 2012-04-09 23:28:25 UTC (rev 113639)
+++ trunk/Source/WebKit2/UIProcess/LayerTreeHostProxy.messages.in 2012-04-09 23:45:43 UTC (rev 113640)
@@ -19,7 +19,8 @@
#if USE(ACCELERATED_COMPOSITING) && USE(TILED_BACKING_STORE)
messages -> LayerTreeHostProxy {
- SyncCompositingLayerState(WebKit::WebLayerInfo layerInfo)
+ SetCompositingLayerState(uint32_t id, WebKit::WebLayerInfo layerInfo)
+ SetCompositingLayerChildren(uint32_t id, Vector<uint32_t> children)
SetRootCompositingLayer(uint32_t id)
DeleteCompositingLayer(uint32_t id)
CreateTileForLayer(uint32_t layerID, int tileID, WebKit::UpdateInfo updateInfo)
Modified: trunk/Source/WebKit2/UIProcess/WebLayerTreeRenderer.cpp (113639 => 113640)
--- trunk/Source/WebKit2/UIProcess/WebLayerTreeRenderer.cpp 2012-04-09 23:28:25 UTC (rev 113639)
+++ trunk/Source/WebKit2/UIProcess/WebLayerTreeRenderer.cpp 2012-04-09 23:45:43 UTC (rev 113640)
@@ -155,15 +155,33 @@
m_layerTreeHostProxy->updateViewport();
}
-void WebLayerTreeRenderer::syncLayerParameters(const WebLayerInfo& layerInfo)
+void WebLayerTreeRenderer::setLayerChildren(WebLayerID id, const Vector<WebLayerID>& childIDs)
{
- WebLayerID id = layerInfo.id;
ensureLayer(id);
LayerMap::iterator it = m_layers.find(id);
GraphicsLayer* layer = it->second;
+ Vector<GraphicsLayer*> children;
- layer->setName(layerInfo.name);
+ for (size_t i = 0; i < childIDs.size(); ++i) {
+ WebLayerID childID = childIDs[i];
+ GraphicsLayer* child = layerByID(childID);
+ if (!child) {
+ child = createLayer(childID).leakPtr();
+ m_layers.add(childID, child);
+ }
+ children.append(child);
+ }
+ layer->setChildren(children);
+}
+void WebLayerTreeRenderer::setLayerState(WebLayerID id, const WebLayerInfo& layerInfo)
+{
+ ensureLayer(id);
+ LayerMap::iterator it = m_layers.find(id);
+ ASSERT(it != m_layers.end());
+
+ GraphicsLayer* layer = it->second;
+
layer->setReplicatedByLayer(layerByID(layerInfo.replica));
layer->setMaskLayer(layerByID(layerInfo.mask));
@@ -183,19 +201,6 @@
layer->setMasksToBounds(layerInfo.isRootLayer ? false : layerInfo.masksToBounds);
layer->setOpacity(layerInfo.opacity);
layer->setPreserves3D(layerInfo.preserves3D);
- Vector<GraphicsLayer*> children;
-
- for (size_t i = 0; i < layerInfo.children.size(); ++i) {
- WebLayerID childID = layerInfo.children[i];
- GraphicsLayer* child = layerByID(childID);
- if (!child) {
- child = createLayer(childID).leakPtr();
- m_layers.add(childID, child);
- }
- children.append(child);
- }
- layer->setChildren(children);
-
if (layerInfo.isRootLayer && m_rootLayerID != id)
setRootLayerID(id);
}
Modified: trunk/Source/WebKit2/UIProcess/WebLayerTreeRenderer.h (113639 => 113640)
--- trunk/Source/WebKit2/UIProcess/WebLayerTreeRenderer.h 2012-04-09 23:28:25 UTC (rev 113639)
+++ trunk/Source/WebKit2/UIProcess/WebLayerTreeRenderer.h 2012-04-09 23:45:43 UTC (rev 113640)
@@ -59,7 +59,8 @@
void deleteLayer(WebLayerID);
void setRootLayerID(WebLayerID);
- void syncLayerParameters(const WebLayerInfo&);
+ void setLayerChildren(WebLayerID, const Vector<WebLayerID>&);
+ void setLayerState(WebLayerID, const WebLayerInfo&);
void createTile(WebLayerID, int, float scale);
void removeTile(WebLayerID, int);
void updateTile(WebLayerID, int, const WebCore::IntRect&, const WebCore::IntRect&, PassRefPtr<ShareableBitmap>);
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.cpp (113639 => 113640)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.cpp 2012-04-09 23:28:25 UTC (rev 113639)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.cpp 2012-04-09 23:45:43 UTC (rev 113640)
@@ -60,13 +60,20 @@
return layer ? toWebGraphicsLayer(layer)->id() : 0;
}
-void WebGraphicsLayer::notifyChange()
+void WebGraphicsLayer::didChangeLayerState()
{
- m_modified = true;
+ m_shouldSyncLayerState = true;
if (client())
client()->notifySyncRequired(this);
}
+void WebGraphicsLayer::didChangeChildren()
+{
+ m_shouldSyncChildren = true;
+ if (client())
+ client()->notifySyncRequired(this);
+}
+
void WebGraphicsLayer::setShouldUpdateVisibleRect()
{
if (!transform().isAffine())
@@ -81,21 +88,22 @@
void WebGraphicsLayer::didChangeGeometry()
{
- notifyChange();
+ didChangeLayerState();
setShouldUpdateVisibleRect();
}
WebGraphicsLayer::WebGraphicsLayer(GraphicsLayerClient* client)
: GraphicsLayer(client)
, m_maskTarget(0)
- , m_modified(true)
, m_inUpdateMode(false)
, m_shouldUpdateVisibleRect(true)
+ , m_shouldSyncLayerState(true)
+ , m_shouldSyncChildren(true)
, m_webGraphicsLayerClient(0)
- , m_contentsScale(1.f)
+ , m_contentsScale(1)
{
static WebLayerID nextLayerID = 1;
- m_layerInfo.id = nextLayerID++;
+ m_id = nextLayerID++;
layerByIDMap().add(id(), this);
}
@@ -123,9 +131,9 @@
for (int i = 0; i < children.size(); ++i) {
WebGraphicsLayer* child = toWebGraphicsLayer(children[i]);
child->setWebGraphicsLayerClient(m_webGraphicsLayerClient);
- child->notifyChange();
+ child->didChangeLayerState();
}
- notifyChange();
+ didChangeChildren();
return true;
}
@@ -133,32 +141,32 @@
{
GraphicsLayer::addChild(layer);
toWebGraphicsLayer(layer)->setWebGraphicsLayerClient(m_webGraphicsLayerClient);
- toWebGraphicsLayer(layer)->notifyChange();
- notifyChange();
+ toWebGraphicsLayer(layer)->didChangeLayerState();
+ didChangeChildren();
}
void WebGraphicsLayer::addChildAtIndex(GraphicsLayer* layer, int index)
{
GraphicsLayer::addChildAtIndex(layer, index);
toWebGraphicsLayer(layer)->setWebGraphicsLayerClient(m_webGraphicsLayerClient);
- toWebGraphicsLayer(layer)->notifyChange();
- notifyChange();
+ toWebGraphicsLayer(layer)->didChangeLayerState();
+ didChangeChildren();
}
void WebGraphicsLayer::addChildAbove(GraphicsLayer* layer, GraphicsLayer* sibling)
{
GraphicsLayer::addChildAbove(layer, sibling);
toWebGraphicsLayer(layer)->setWebGraphicsLayerClient(m_webGraphicsLayerClient);
- toWebGraphicsLayer(layer)->notifyChange();
- notifyChange();
+ toWebGraphicsLayer(layer)->didChangeLayerState();
+ didChangeChildren();
}
void WebGraphicsLayer::addChildBelow(GraphicsLayer* layer, GraphicsLayer* sibling)
{
GraphicsLayer::addChildBelow(layer, sibling);
toWebGraphicsLayer(layer)->setWebGraphicsLayerClient(m_webGraphicsLayerClient);
- toWebGraphicsLayer(layer)->notifyChange();
- notifyChange();
+ toWebGraphicsLayer(layer)->didChangeLayerState();
+ didChangeChildren();
}
bool WebGraphicsLayer::replaceChild(GraphicsLayer* oldChild, GraphicsLayer* newChild)
@@ -166,20 +174,20 @@
bool ok = GraphicsLayer::replaceChild(oldChild, newChild);
if (!ok)
return false;
- notifyChange();
- toWebGraphicsLayer(oldChild)->notifyChange();
+ didChangeChildren();
+ toWebGraphicsLayer(oldChild)->didChangeLayerState();
toWebGraphicsLayer(newChild)->setWebGraphicsLayerClient(m_webGraphicsLayerClient);
- toWebGraphicsLayer(newChild)->notifyChange();
+ toWebGraphicsLayer(newChild)->didChangeLayerState();
return true;
}
void WebGraphicsLayer::removeFromParent()
{
if (WebGraphicsLayer* parentLayer = toWebGraphicsLayer(parent()))
- parentLayer->notifyChange();
+ parentLayer->didChangeChildren();
GraphicsLayer::removeFromParent();
- notifyChange();
+ didChangeLayerState();
}
void WebGraphicsLayer::setPosition(const FloatPoint& p)
@@ -253,7 +261,7 @@
return;
GraphicsLayer::setDrawsContent(b);
- notifyChange();
+ didChangeLayerState();
}
void WebGraphicsLayer::setContentsOpaque(bool b)
@@ -263,7 +271,7 @@
if (m_mainBackingStore)
m_mainBackingStore->setSupportsAlpha(!b);
GraphicsLayer::setContentsOpaque(b);
- notifyChange();
+ didChangeLayerState();
}
void WebGraphicsLayer::setBackfaceVisibility(bool b)
@@ -272,7 +280,7 @@
return;
GraphicsLayer::setBackfaceVisibility(b);
- notifyChange();
+ didChangeLayerState();
}
void WebGraphicsLayer::setOpacity(float opacity)
@@ -281,7 +289,7 @@
return;
GraphicsLayer::setOpacity(opacity);
- notifyChange();
+ didChangeLayerState();
}
void WebGraphicsLayer::setContentsRect(const IntRect& r)
@@ -290,7 +298,7 @@
return;
GraphicsLayer::setContentsRect(r);
- notifyChange();
+ didChangeLayerState();
}
void WebGraphicsLayer::setContentsNeedsDisplay()
@@ -309,13 +317,13 @@
// We adopt first, in case this is the same frame - that way we avoid destroying and recreating the image.
newID = m_webGraphicsLayerClient->adoptImageBackingStore(image);
m_webGraphicsLayerClient->releaseImageBackingStore(m_layerInfo.imageBackingStoreID);
- notifyChange();
+ didChangeLayerState();
if (m_layerInfo.imageBackingStoreID && newID == m_layerInfo.imageBackingStoreID)
return;
} else {
// If m_webGraphicsLayerClient is not set yet there should be no backing store ID.
ASSERT(!m_layerInfo.imageBackingStoreID);
- notifyChange();
+ didChangeLayerState();
}
m_layerInfo.imageBackingStoreID = newID;
@@ -337,8 +345,8 @@
WebGraphicsLayer* webGraphicsLayer = toWebGraphicsLayer(layer);
webGraphicsLayer->setWebGraphicsLayerClient(m_webGraphicsLayerClient);
webGraphicsLayer->setMaskTarget(this);
- webGraphicsLayer->notifyChange();
- notifyChange();
+ webGraphicsLayer->didChangeLayerState();
+ didChangeLayerState();
}
@@ -351,7 +359,7 @@
toWebGraphicsLayer(layer)->setWebGraphicsLayerClient(m_webGraphicsLayerClient);
GraphicsLayer::setReplicatedByLayer(layer);
- notifyChange();
+ didChangeLayerState();
}
void WebGraphicsLayer::setNeedsDisplay()
@@ -363,12 +371,12 @@
{
if (m_mainBackingStore)
m_mainBackingStore->invalidate(IntRect(rect));
- notifyChange();
+ didChangeLayerState();
}
WebLayerID WebGraphicsLayer::id() const
{
- return m_layerInfo.id;
+ return m_id;
}
void WebGraphicsLayer::syncCompositingState(const FloatRect& rect)
@@ -390,13 +398,24 @@
return static_cast<WebGraphicsLayer*>(layer);
}
-void WebGraphicsLayer::syncLayerParameters()
+void WebGraphicsLayer::syncChildren()
+{
+ if (!m_shouldSyncChildren)
+ return;
+ m_shouldSyncChildren = false;
+ Vector<WebLayerID> childIDs;
+ for (size_t i = 0; i < children().size(); ++i)
+ childIDs.append(toWebLayerID(children()[i]));
+
+ m_webGraphicsLayerClient->syncLayerChildren(m_id, childIDs);
+}
+
+void WebGraphicsLayer::syncLayerState()
{
- if (!m_modified)
+ if (!m_shouldSyncLayerState)
return;
+ m_shouldSyncLayerState = false;
- m_modified = false;
- m_layerInfo.name = name();
m_layerInfo.anchorPoint = anchorPoint();
m_layerInfo.backfaceVisible = backfaceVisibility();
m_layerInfo.childrenTransform = childrenTransform();
@@ -412,24 +431,24 @@
m_layerInfo.replica = toWebLayerID(replicaLayer());
m_layerInfo.size = size();
m_layerInfo.transform = transform();
- m_layerInfo.children.clear();
+ m_webGraphicsLayerClient->syncLayerState(m_id, m_layerInfo);
+}
- for (size_t i = 0; i < children().size(); ++i)
- m_layerInfo.children.append(toWebLayerID(children()[i]));
-
- m_webGraphicsLayerClient->didSyncCompositingStateForLayer(m_layerInfo);
+void WebGraphicsLayer::ensureImageBackingStore()
+{
+ if (!m_image)
+ return;
+ if (!m_layerInfo.imageBackingStoreID)
+ m_layerInfo.imageBackingStoreID = m_webGraphicsLayerClient->adoptImageBackingStore(m_image.get());
}
void WebGraphicsLayer::syncCompositingStateForThisLayerOnly()
{
// The remote image might have been released by purgeBackingStores.
- if (m_image && !m_layerInfo.imageBackingStoreID)
- m_layerInfo.imageBackingStoreID = m_webGraphicsLayerClient->adoptImageBackingStore(m_image.get());
-
+ ensureImageBackingStore();
computeTransformedVisibleRect();
- syncLayerParameters();
+ syncChildren();
+ syncLayerState();
updateContentBuffers();
-
- m_modified = false;
}
void WebGraphicsLayer::tiledBackingStorePaintBegin()
@@ -439,7 +458,7 @@
void WebGraphicsLayer::setRootLayer(bool isRoot)
{
m_layerInfo.isRootLayer = isRoot;
- notifyChange();
+ didChangeLayerState();
}
void WebGraphicsLayer::setVisibleContentRectTrajectoryVector(const FloatPoint& trajectoryVector)
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.h (113639 => 113640)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.h 2012-04-09 23:28:25 UTC (rev 113639)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.h 2012-04-09 23:45:43 UTC (rev 113640)
@@ -55,7 +55,8 @@
virtual bool layerTreeTileUpdatesAllowed() const = 0;
virtual int64_t adoptImageBackingStore(WebCore::Image*) = 0;
virtual void releaseImageBackingStore(int64_t) = 0;
- virtual void didSyncCompositingStateForLayer(const WebLayerInfo&) = 0;
+ virtual void syncLayerState(WebLayerID, const WebLayerInfo&) = 0;
+ virtual void syncLayerChildren(WebLayerID, const Vector<WebLayerID>&) = 0;
virtual void attachLayer(WebCore::WebGraphicsLayer*) = 0;
virtual void detachLayer(WebCore::WebGraphicsLayer*) = 0;
};
@@ -101,11 +102,11 @@
void setVisibleContentRectTrajectoryVector(const FloatPoint&);
virtual void syncCompositingState(const FloatRect&);
virtual void syncCompositingStateForThisLayerOnly();
+
void setRootLayer(bool);
WebKit::WebLayerID id() const;
static WebGraphicsLayer* layerByID(WebKit::WebLayerID);
- bool isModified() const { return m_modified; }
void didSynchronize();
Image* image() { return m_image.get(); }
@@ -129,6 +130,9 @@
virtual void removeTile(int tileID);
void setWebGraphicsLayerClient(WebKit::WebGraphicsLayerClient*);
+ void syncChildren();
+ void syncLayerState();
+ void ensureImageBackingStore();
void adjustVisibleRect();
bool isReadyForTileBufferSwap() const;
@@ -137,17 +141,21 @@
private:
virtual void willBeDestroyed();
+ WebKit::WebLayerID m_id;
WebKit::WebLayerInfo m_layerInfo;
RefPtr<Image> m_image;
GraphicsLayer* m_maskTarget;
FloatRect m_needsDisplayRect;
LayerTransform m_layerTransform;
- bool m_modified : 1;
bool m_inUpdateMode : 1;
bool m_shouldUpdateVisibleRect: 1;
+ bool m_shouldSyncLayerState: 1;
+ bool m_shouldSyncChildren: 1;
void notifyChange();
void didChangeGeometry();
+ void didChangeLayerState();
+ void didChangeChildren();
void createBackingStore();
bool selfOrAncestorHaveNonAffineTransforms();
Modified: trunk/Source/WebKit2/WebProcess/WebPage/qt/LayerTreeHostQt.cpp (113639 => 113640)
--- trunk/Source/WebKit2/WebProcess/WebPage/qt/LayerTreeHostQt.cpp 2012-04-09 23:28:25 UTC (rev 113639)
+++ trunk/Source/WebKit2/WebProcess/WebPage/qt/LayerTreeHostQt.cpp 2012-04-09 23:45:43 UTC (rev 113640)
@@ -226,12 +226,18 @@
return didSync;
}
-void LayerTreeHostQt::didSyncCompositingStateForLayer(const WebLayerInfo& info)
+void LayerTreeHostQt::syncLayerState(WebLayerID id, const WebLayerInfo& info)
{
m_shouldSyncFrame = true;
- m_webPage->send(Messages::LayerTreeHostProxy::SyncCompositingLayerState(info));
+ m_webPage->send(Messages::LayerTreeHostProxy::SetCompositingLayerState(id, info));
}
+void LayerTreeHostQt::syncLayerChildren(WebLayerID id, const Vector<WebLayerID>& children)
+{
+ m_shouldSyncFrame = true;
+ m_webPage->send(Messages::LayerTreeHostProxy::SetCompositingLayerChildren(id, children));
+}
+
void LayerTreeHostQt::attachLayer(WebGraphicsLayer* layer)
{
ASSERT(!m_registeredLayers.contains(layer));
Modified: trunk/Source/WebKit2/WebProcess/WebPage/qt/LayerTreeHostQt.h (113639 => 113640)
--- trunk/Source/WebKit2/WebProcess/WebPage/qt/LayerTreeHostQt.h 2012-04-09 23:28:25 UTC (rev 113639)
+++ trunk/Source/WebKit2/WebProcess/WebPage/qt/LayerTreeHostQt.h 2012-04-09 23:45:43 UTC (rev 113640)
@@ -71,7 +71,8 @@
virtual void purgeBackingStores();
virtual bool layerTreeTileUpdatesAllowed() const;
virtual void setVisibleContentsRect(const WebCore::IntRect&, float scale, const WebCore::FloatPoint&);
- virtual void didSyncCompositingStateForLayer(const WebLayerInfo&);
+ virtual void syncLayerState(WebLayerID, const WebLayerInfo&);
+ virtual void syncLayerChildren(WebLayerID, const Vector<WebLayerID>&);
virtual void attachLayer(WebCore::WebGraphicsLayer*);
virtual void detachLayer(WebCore::WebGraphicsLayer*);