WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
WIP. discussion for APIs for CoordinatedGraphicsState
0001-WIP-Unify-coordinated-graphic-s-messages-into-Coorid.patch (text/plain), 92.03 KB, created by
Gwang Yoon Hwang
on 2013-02-27 07:18:03 PST
(
hide
)
Description:
WIP. discussion for APIs for CoordinatedGraphicsState
Filename:
MIME Type:
Creator:
Gwang Yoon Hwang
Created:
2013-02-27 07:18:03 PST
Size:
92.03 KB
patch
obsolete
>From a94dd86f8d3aee424f575f384e644f5b35c86e2b Mon Sep 17 00:00:00 2001 >From: Gwang Yoon Hwang <ryumiel@company100.net> >Date: Wed, 27 Feb 2013 23:51:40 +0900 >Subject: [PATCH] WIP : Unify coordinated graphic's messages into > CooridinatedGraphicsState. > >ChangeLog for WIP. > >Reviewed by NOBODY (OOPS!). > >Additional information of the change such as approach, rationale. Please add per-function descriptions below (OOPS!). > >WIP : CoordinatedGraphicsLayer Actor model. > >Reviewed by NOBODY (OOPS!). > >Status : working. >Use CoordinatedGraphicsLayerState instead of CoordinatedLayerInfo to >sync layer. > >Reviewed by NOBODY (OOPS!). > >State : Not working. encode/decode failure due to >CoordinatedGraphicsLayerState.tilesToUpdate >--- > Source/WebCore/ChangeLog | 25 +++ > .../coordinated/CoordinatedGraphicsLayer.cpp | 192 ++++++++++++----- > .../texmap/coordinated/CoordinatedGraphicsLayer.h | 28 +-- > .../coordinated/CoordinatedGraphicsScene.cpp | 233 ++++++++++++++------- > .../texmap/coordinated/CoordinatedGraphicsScene.h | 44 ++-- > .../texmap/coordinated/CoordinatedGraphicsState.h | 164 +++++++++++++++ > .../texmap/coordinated/CoordinatedImageBacking.h | 3 +- > .../texmap/coordinated/CoordinatedLayerInfo.h | 85 -------- > .../texmap/coordinated/SurfaceUpdateInfo.h | 2 - > Source/WebKit2/ChangeLog | 18 ++ > Source/WebKit2/Scripts/webkit2/messages.py | 2 +- > .../CoordinatedGraphicsArgumentCoders.cpp | 220 ++++++++++++++++++- > .../CoordinatedGraphicsArgumentCoders.h | 24 ++- > .../CoordinatedLayerTreeHostProxy.cpp | 72 +------ > .../CoordinatedLayerTreeHostProxy.h | 34 ++- > .../CoordinatedLayerTreeHostProxy.messages.in | 28 +-- > .../CoordinatedLayerTreeHost.cpp | 121 ++++------- > .../CoordinatedGraphics/CoordinatedLayerTreeHost.h | 50 ++--- > 18 files changed, 849 insertions(+), 496 deletions(-) > create mode 100644 Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h > delete mode 100644 Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedLayerInfo.h > >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 098a2d1..99b3114 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,28 @@ >+2013-02-04 Huang Dongsung <luxtella@company100.net> >+ >+ Coordinated Graphics: CoordinatedGraphicsLayer makes CoordinatedGraphicsScene perform via CoordinatedGraphicsOperation. >+ https://bugs.webkit.org/show_bug.cgi?id=108294 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ CoordinatedLayerTreeHostProxy has so many IPC messages (e.g. SyncCanvas and >+ CreateTile), and there is a long function chain from CoordinatedGraphicsLayer to >+ CoordinatedGraphicsScene (4 classes). >+ If we want to add a new message, we need to add similar functions into 4 classes. >+ >+ Now CoordinatedLayerTreeHost has only one IPC message: CommitCoordinatedGraphicsState. >+ CoordinatedGraphicsLayer makes CoordinatedGraphicsScene run as follows: >+ 1. CoordinatedGraphicsLayer makes a CoordinatedGraphicsLayerState. >+ 2. CoordinatedLayerTreeHost stores all LayerStates. >+ 3. CoordinatedLayerTreeHost sends GraphicsState includes LayerStates to CoordinatedLayerTreeHostProxy >+ at the moment of flushing via CommitCoordinatedGraphicsState message. >+ 4. CoordinatedGraphicsScene executes all operations. >+ >+ There is one big behavior change. All states changes (e.g. >+ UpdateTiles, SetLayerChildren, and etc..) are performed at the same time, when >+ CoordinatedGraphicsScene::commitCoordinatedGraphicsState is called. >+ >+ > 2013-02-24 Sheriff Bot <webkit.review.bot@gmail.com> > > Unreviewed, rolling out r143797. >diff --git a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp >index 4c43aa7..651a18d 100644 >--- a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp >+++ b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp >@@ -19,7 +19,6 @@ > the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, > Boston, MA 02110-1301, USA. > */ >- > #include "config.h" > > #if USE(COORDINATED_GRAPHICS) >@@ -192,6 +191,7 @@ void CoordinatedGraphicsLayer::setPosition(const FloatPoint& p) > return; > > GraphicsLayer::setPosition(p); >+ m_layerState.positionChanged = true; > didChangeGeometry(); > } > >@@ -201,6 +201,7 @@ void CoordinatedGraphicsLayer::setAnchorPoint(const FloatPoint3D& p) > return; > > GraphicsLayer::setAnchorPoint(p); >+ m_layerState.anchorPointChanged = true; > didChangeGeometry(); > } > >@@ -210,6 +211,7 @@ void CoordinatedGraphicsLayer::setSize(const FloatSize& size) > return; > > GraphicsLayer::setSize(size); >+ m_layerState.sizeChanged = true; > > if (maskLayer()) > maskLayer()->setSize(size); >@@ -222,6 +224,8 @@ void CoordinatedGraphicsLayer::setTransform(const TransformationMatrix& t) > return; > > GraphicsLayer::setTransform(t); >+ m_layerState.transformChanged = true; >+ > didChangeGeometry(); > } > >@@ -231,6 +235,8 @@ void CoordinatedGraphicsLayer::setChildrenTransform(const TransformationMatrix& > return; > > GraphicsLayer::setChildrenTransform(t); >+ m_layerState.childrenTransformChanged = true; >+ > didChangeGeometry(); > } > >@@ -240,6 +246,9 @@ void CoordinatedGraphicsLayer::setPreserves3D(bool b) > return; > > GraphicsLayer::setPreserves3D(b); >+ m_layerState.preserves3D = b; >+ m_layerState.flagsChanged = true; >+ > didChangeGeometry(); > } > >@@ -248,6 +257,9 @@ void CoordinatedGraphicsLayer::setMasksToBounds(bool b) > if (masksToBounds() == b) > return; > GraphicsLayer::setMasksToBounds(b); >+ m_layerState.masksToBounds = b; >+ m_layerState.flagsChanged = true; >+ > didChangeGeometry(); > } > >@@ -256,6 +268,8 @@ void CoordinatedGraphicsLayer::setDrawsContent(bool b) > if (drawsContent() == b) > return; > GraphicsLayer::setDrawsContent(b); >+ m_layerState.drawsContent = b; >+ m_layerState.flagsChanged = true; > > didChangeLayerState(); > } >@@ -265,6 +279,9 @@ void CoordinatedGraphicsLayer::setContentsVisible(bool b) > if (contentsAreVisible() == b) > return; > GraphicsLayer::setContentsVisible(b); >+ m_layerState.contentsVisible = b; >+ m_layerState.flagsChanged = true; >+ > if (maskLayer()) > maskLayer()->setContentsVisible(b); > >@@ -278,6 +295,9 @@ void CoordinatedGraphicsLayer::setContentsOpaque(bool b) > if (m_mainBackingStore) > m_mainBackingStore->setSupportsAlpha(!b); > GraphicsLayer::setContentsOpaque(b); >+ m_layerState.contentsOpaque = b; >+ m_layerState.flagsChanged = true; >+ > didChangeLayerState(); > } > >@@ -287,6 +307,9 @@ void CoordinatedGraphicsLayer::setBackfaceVisibility(bool b) > return; > > GraphicsLayer::setBackfaceVisibility(b); >+ m_layerState.backfaceVisible = b; >+ m_layerState.flagsChanged = true; >+ > didChangeLayerState(); > } > >@@ -296,6 +319,9 @@ void CoordinatedGraphicsLayer::setOpacity(float opacity) > return; > > GraphicsLayer::setOpacity(opacity); >+ m_layerState.opacity = opacity; >+ m_layerState.opacityChanged = true; >+ > didChangeLayerState(); > } > >@@ -305,6 +331,9 @@ void CoordinatedGraphicsLayer::setContentsRect(const IntRect& r) > return; > > GraphicsLayer::setContentsRect(r); >+ m_layerState.contentsRect = r; >+ m_layerState.contentsRectChanged = true; >+ > didChangeLayerState(); > } > >@@ -356,16 +385,24 @@ bool CoordinatedGraphicsLayer::setFilters(const FilterOperations& newFilters) > { > if (filters() == newFilters) > return true; >+ >+ if (!GraphicsLayer::setFilters(newFilters)) >+ return false; >+ > didChangeFilters(); >- return GraphicsLayer::setFilters(newFilters); >+ >+ return true; > } > #endif > > void CoordinatedGraphicsLayer::setContentsToSolidColor(const Color& color) > { >- if (m_layerInfo.solidColor == color) >+ if (m_layerState.solidColor == color) > return; >- m_layerInfo.solidColor = color; >+ >+ m_layerState.solidColor = color; >+ m_layerState.solidColorChanged = true; >+ > didChangeLayerState(); > } > >@@ -375,6 +412,9 @@ void CoordinatedGraphicsLayer::setShowDebugBorder(bool show) > return; > > GraphicsLayer::setShowDebugBorder(show); >+ m_layerState.showDebugBorders = true; >+ m_layerState.flagsChanged = true; >+ > didChangeLayerState(); > } > >@@ -384,6 +424,9 @@ void CoordinatedGraphicsLayer::setShowRepaintCounter(bool show) > return; > > GraphicsLayer::setShowRepaintCounter(show); >+ m_layerState.showRepaintCounter = true; >+ m_layerState.flagsChanged = true; >+ > didChangeLayerState(); > } > >@@ -405,6 +448,7 @@ void CoordinatedGraphicsLayer::setContentsToImage(Image* image) > > GraphicsLayer::setContentsToImage(image); > didChangeImageBacking(); >+ // TODO WHAT? > } > > void CoordinatedGraphicsLayer::setMaskLayer(GraphicsLayer* layer) >@@ -421,6 +465,10 @@ void CoordinatedGraphicsLayer::setMaskLayer(GraphicsLayer* layer) > layer->setContentsVisible(contentsAreVisible()); > CoordinatedGraphicsLayer* coordinatedLayer = toCoordinatedGraphicsLayer(layer); > coordinatedLayer->didChangeLayerState(); >+ >+ m_layerState.mask = coordinatedLayer->id(); >+ m_layerState.maskChanged = true; >+ > didChangeLayerState(); > } > >@@ -442,6 +490,8 @@ void CoordinatedGraphicsLayer::setReplicatedByLayer(GraphicsLayer* layer) > return; > > GraphicsLayer::setReplicatedByLayer(layer); >+ m_layerState.replica = toCoordinatedLayerID(layer); >+ m_layerState.replicaChanged = true; > didChangeLayerState(); > } > >@@ -471,6 +521,9 @@ void CoordinatedGraphicsLayer::setFixedToViewport(bool isFixed) > return; > > m_fixedToViewport = isFixed; >+ m_layerState.fixedToViewport = isFixed; >+ m_layerState.flagsChanged = true; >+ > didChangeLayerState(); > } > >@@ -504,11 +557,10 @@ void CoordinatedGraphicsLayer::syncChildren() > if (!m_shouldSyncChildren) > return; > m_shouldSyncChildren = false; >- Vector<CoordinatedLayerID> childIDs; >+ m_layerState.childrenChanged = true; >+ m_layerState.children.clear(); > for (size_t i = 0; i < children().size(); ++i) >- childIDs.append(toCoordinatedLayerID(children()[i])); >- >- m_coordinator->syncLayerChildren(m_id, childIDs); >+ m_layerState.children.append(toCoordinatedLayerID(children()[i])); > } > > #if ENABLE(CSS_FILTERS) >@@ -517,7 +569,9 @@ void CoordinatedGraphicsLayer::syncFilters() > if (!m_shouldSyncFilters) > return; > m_shouldSyncFilters = false; >- m_coordinator->syncLayerFilters(m_id, filters()); >+ >+ m_layerState.filters = newFilters; >+ m_layerState.filtersChanged = true; > } > #endif > >@@ -538,14 +592,15 @@ void CoordinatedGraphicsLayer::syncImageBacking() > if (!m_coordinatedImageBacking) { > m_coordinatedImageBacking = m_coordinator->createImageBackingIfNeeded(m_compositedImage.get()); > m_coordinatedImageBacking->addHost(this); >- m_layerInfo.imageID = m_coordinatedImageBacking->id(); >+ m_layerState.imageID = m_coordinatedImageBacking->id(); > } > > m_coordinatedImageBacking->markDirty(); >+ m_layerState.imageChanged = true; > } else > releaseImageBackingIfNeeded(); > >- // syncImageBacking() changed m_layerInfo.imageID. >+ // syncImageBacking() changed m_layerState.imageID. > didChangeLayerState(); > } > >@@ -554,38 +609,47 @@ void CoordinatedGraphicsLayer::syncLayerState() > if (!m_shouldSyncLayerState) > return; > m_shouldSyncLayerState = false; >- m_layerInfo.fixedToViewport = fixedToViewport(); >- >- m_layerInfo.backfaceVisible = backfaceVisibility(); >- m_layerInfo.childrenTransform = childrenTransform(); >- m_layerInfo.contentsOpaque = contentsOpaque(); >- m_layerInfo.contentsRect = contentsRect(); >- m_layerInfo.drawsContent = drawsContent(); >- m_layerInfo.contentsVisible = contentsAreVisible(); >- m_layerInfo.mask = toCoordinatedLayerID(maskLayer()); >- m_layerInfo.masksToBounds = masksToBounds(); >- m_layerInfo.opacity = opacity(); >- m_layerInfo.preserves3D = preserves3D(); >- m_layerInfo.replica = toCoordinatedLayerID(replicaLayer()); >- m_layerInfo.transform = transform(); >- >- m_layerInfo.anchorPoint = m_adjustedAnchorPoint; >- m_layerInfo.pos = m_adjustedPosition; >- m_layerInfo.size = m_adjustedSize; >- >- m_layerInfo.showDebugBorders = isShowingDebugBorder(); >- if (m_layerInfo.showDebugBorders) >+ >+ // Flags >+ m_layerState.contentsOpaque = contentsOpaque(); >+ m_layerState.drawsContent = drawsContent(); >+ m_layerState.contentsVisible = contentsAreVisible(); >+ m_layerState.backfaceVisible = backfaceVisibility(); >+ m_layerState.masksToBounds = masksToBounds(); >+ m_layerState.preserves3D = preserves3D(); >+ >+ m_layerState.fixedToViewport = fixedToViewport(); >+ m_layerState.showDebugBorders = isShowingDebugBorder(); >+ if (m_layerState.showDebugBorders) > updateDebugIndicators(); >- m_layerInfo.showRepaintCounter = isShowingRepaintCounter(); > >- m_coordinator->syncLayerState(m_id, m_layerInfo); >+ m_layerState.showRepaintCounter = isShowingRepaintCounter(); >+ >+ // State Properties >+ m_layerState.childrenTransform = childrenTransform(); >+ m_layerState.contentsRect = contentsRect(); >+ m_layerState.mask = toCoordinatedLayerID(maskLayer()); >+ m_layerState.opacity = opacity(); >+ m_layerState.replica = toCoordinatedLayerID(replicaLayer()); >+ m_layerState.transform = transform(); >+ >+ m_layerState.anchorPoint = m_adjustedAnchorPoint; >+ m_layerState.pos = m_adjustedPosition; >+ m_layerState.size = m_adjustedSize; > } > > void CoordinatedGraphicsLayer::setDebugBorder(const Color& color, float width) > { >- ASSERT(m_layerInfo.showDebugBorders); >- m_layerInfo.debugBorderColor = color; >- m_layerInfo.debugBorderWidth = width; >+ ASSERT(m_layerState.showDebugBorders); >+ if (m_layerState.debugBorderColor != color) { >+ m_layerState.debugBorderColor = color; >+ m_layerState.debugBorderColorChanged = true; >+ } >+ >+ if (m_layerState.debugBorderWidth != width) { >+ m_layerState.debugBorderWidth = width; >+ m_layerState.debugBorderWidthChanged = true; >+ } > } > > void CoordinatedGraphicsLayer::syncAnimations() >@@ -594,8 +658,8 @@ void CoordinatedGraphicsLayer::syncAnimations() > return; > > m_shouldSyncAnimations = false; >- >- m_coordinator->setLayerAnimations(m_id, m_animations); >+ m_layerState.animations = m_animations; >+ m_layerState.animationsChanged = true; > } > > #if USE(GRAPHICS_SURFACE) >@@ -612,7 +676,9 @@ void CoordinatedGraphicsLayer::syncCanvas() > if (!m_isValidCanvas) > return; > >- m_coordinator->syncCanvas(m_id, m_canvasPlatformLayer); >+ ASSERT(m_canvasPlatformLayer); >+ m_layerState.canvasFrontBuffer = m_canvasPlatformLayer->copyToGraphicsSurface(); >+ m_layerState.canvasShouldSwapBuffers = true; > } > > void CoordinatedGraphicsLayer::destroyCanvasIfNeeded() >@@ -621,8 +687,9 @@ void CoordinatedGraphicsLayer::destroyCanvasIfNeeded() > return; > > if (m_isValidCanvas) { >- m_coordinator->destroyCanvas(m_id); > m_isValidCanvas = false; >+ m_layerState.canvasToken = GraphicsSurfaceToken(); >+ m_layerState.canvasChanged = true; > } > > m_pendingCanvasOperation &= ~DestroyCanvas; >@@ -635,7 +702,9 @@ void CoordinatedGraphicsLayer::createCanvasIfNeeded() > > ASSERT(m_canvasPlatformLayer); > if (!m_isValidCanvas) { >- m_coordinator->createCanvas(m_id, m_canvasPlatformLayer); >+ m_layerState.canvasSize = m_canvasPlatformLayer->platformLayerSize(); >+ m_layerState.canvasToken = m_canvasPlatformLayer->graphicsSurfaceToken(); >+ m_layerState.canvasChanged = true; > m_isValidCanvas = true; > } > >@@ -667,11 +736,24 @@ void CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly() > #if USE(GRAPHICS_SURFACE) > syncCanvas(); > #endif >+ >+ m_coordinator->syncLayerState(m_id, m_layerState); >+ resetLayerState(); >+ > // Only unset m_movingVisibleRect after we have updated the visible rect after the animation stopped. > if (!hasActiveTransformAnimation) > m_movingVisibleRect = false; > } > >+void CoordinatedGraphicsLayer::resetLayerState() >+{ >+ m_layerState.changeMask = 0; >+ m_layerState.tilesToCreate.clear(); >+ m_layerState.tilesToRemove.clear(); >+ m_layerState.tilesToUpdate.clear(); >+ // TODO : What about canvasSurface? >+} >+ > bool CoordinatedGraphicsLayer::imageBackingVisible() > { > ASSERT(m_coordinatedImageBacking); >@@ -686,7 +768,8 @@ void CoordinatedGraphicsLayer::releaseImageBackingIfNeeded() > ASSERT(m_coordinator); > m_coordinatedImageBacking->removeHost(this); > m_coordinatedImageBacking.clear(); >- m_layerInfo.imageID = InvalidCoordinatedImageBackingID; >+ m_layerState.imageID = InvalidCoordinatedImageBackingID; >+ m_layerState.imageChanged = true; > } > > void CoordinatedGraphicsLayer::tiledBackingStorePaintBegin() >@@ -695,7 +778,8 @@ void CoordinatedGraphicsLayer::tiledBackingStorePaintBegin() > > void CoordinatedGraphicsLayer::setRootLayer(bool isRoot) > { >- m_layerInfo.isRootLayer = isRoot; >+ m_layerState.isRootLayer = isRoot; >+ m_layerState.flagsChanged = true; > didChangeLayerState(); > } > >@@ -751,8 +835,11 @@ void CoordinatedGraphicsLayer::tiledBackingStorePaint(GraphicsContext* context, > > void CoordinatedGraphicsLayer::tiledBackingStorePaintEnd(const Vector<IntRect>& updatedRects) > { >- if (isShowingRepaintCounter() && !updatedRects.isEmpty()) >- m_coordinator->setLayerRepaintCount(id(), incrementRepaintCount()); >+ if (!isShowingRepaintCounter() || updatedRects.isEmpty()) >+ return; >+ >+ m_layerState.repaintCount = incrementRepaintCount(); >+ m_layerState.repaintCountChanged = true; > } > > void CoordinatedGraphicsLayer::tiledBackingStoreHasPendingTileCreation() >@@ -811,21 +898,28 @@ void CoordinatedGraphicsLayer::createTile(uint32_t tileID, const SurfaceUpdateIn > { > ASSERT(m_coordinator); > ASSERT(m_coordinator->isFlushingLayerChanges()); >- m_coordinator->createTile(id(), tileID, updateInfo, tileRect); >+ >+ m_layerState.tilesToCreate.append(std::make_pair(tileID, updateInfo.scaleFactor)); >+ updateTile(tileID, updateInfo, tileRect); > } > > void CoordinatedGraphicsLayer::updateTile(uint32_t tileID, const SurfaceUpdateInfo& updateInfo, const IntRect& tileRect) > { > ASSERT(m_coordinator); > ASSERT(m_coordinator->isFlushingLayerChanges()); >- m_coordinator->updateTile(id(), tileID, updateInfo, tileRect); >+ >+ TileUpdateInfo tileUpdateInfo; >+ tileUpdateInfo.tileID = tileID; >+ tileUpdateInfo.tileRect = tileRect; >+ tileUpdateInfo.updateInfo = updateInfo; >+ m_layerState.tilesToUpdate.append(tileUpdateInfo); > } > > void CoordinatedGraphicsLayer::removeTile(uint32_t tileID) > { > ASSERT(m_coordinator); > ASSERT(m_coordinator->isFlushingLayerChanges() || m_isPurging); >- m_coordinator->removeTile(id(), tileID); >+ m_layerState.tilesToRemove.append(tileID); > } > > void CoordinatedGraphicsLayer::updateContentBuffers() >diff --git a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h >index e5aa47a..790fe96 100644 >--- a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h >+++ b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h >@@ -21,8 +21,8 @@ > #ifndef CoordinatedGraphicsLayer_h > #define CoordinatedGraphicsLayer_h > >+#include "CoordinatedGraphicsState.h" > #include "CoordinatedImageBacking.h" >-#include "CoordinatedLayerInfo.h" > #include "CoordinatedTile.h" > #include "FloatPoint3D.h" > #include "GraphicsLayer.h" >@@ -48,31 +48,12 @@ class GraphicsLayerAnimations; > class CoordinatedGraphicsLayerClient { > public: > virtual bool isFlushingLayerChanges() const = 0; >- >- // CoordinatedTileClient >- virtual void createTile(CoordinatedLayerID, uint32_t tileID, const SurfaceUpdateInfo&, const IntRect&) = 0; >- virtual void updateTile(CoordinatedLayerID, uint32_t tileID, const SurfaceUpdateInfo&, const IntRect&) = 0; >- virtual void removeTile(CoordinatedLayerID, uint32_t tileID) = 0; >- > virtual FloatRect visibleContentsRect() const = 0; > virtual PassRefPtr<CoordinatedImageBacking> createImageBackingIfNeeded(Image*) = 0; >- virtual void syncLayerState(CoordinatedLayerID, const CoordinatedLayerInfo&) = 0; >- virtual void syncLayerChildren(CoordinatedLayerID, const Vector<CoordinatedLayerID>&) = 0; >-#if ENABLE(CSS_FILTERS) >- virtual void syncLayerFilters(CoordinatedLayerID, const FilterOperations&) = 0; >-#endif >-#if USE(GRAPHICS_SURFACE) >- virtual void createCanvas(CoordinatedLayerID, PlatformLayer*) = 0; >- virtual void syncCanvas(CoordinatedLayerID, PlatformLayer*) = 0; >- virtual void destroyCanvas(CoordinatedLayerID) = 0; >-#endif >- >- virtual void setLayerRepaintCount(CoordinatedLayerID, int) = 0; >- >- virtual void setLayerAnimations(CoordinatedLayerID, const GraphicsLayerAnimations&) = 0; >- > virtual void detachLayer(CoordinatedGraphicsLayer*) = 0; > virtual PassOwnPtr<GraphicsContext> beginContentUpdate(const IntSize&, CoordinatedSurface::Flags, uint32_t& atlasID, IntPoint&) = 0; >+ >+ virtual void syncLayerState(CoordinatedLayerID, CoordinatedGraphicsLayerState&) = 0; > }; > > class CoordinatedGraphicsLayer : public GraphicsLayer >@@ -190,6 +171,7 @@ private: > #endif > void didChangeImageBacking(); > >+ void resetLayerState(); > void syncLayerState(); > void syncAnimations(); > void syncChildren(); >@@ -216,7 +198,7 @@ private: > void animationStartedTimerFired(Timer<CoordinatedGraphicsLayer>*); > > CoordinatedLayerID m_id; >- CoordinatedLayerInfo m_layerInfo; >+ CoordinatedGraphicsLayerState m_layerState; > GraphicsLayerTransform m_layerTransform; > TransformationMatrix m_cachedInverseTransform; > FloatSize m_pixelAlignmentOffset; >diff --git a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.cpp b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.cpp >index 8624513..e00a2ed 100644 >--- a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.cpp >+++ b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.cpp >@@ -196,54 +196,63 @@ void CoordinatedGraphicsScene::adjustPositionForFixedLayers() > } > > #if USE(GRAPHICS_SURFACE) >-void CoordinatedGraphicsScene::createCanvas(CoordinatedLayerID id, const IntSize&, PassRefPtr<GraphicsSurface> surface) >+void CoordinatedGraphicsScene::createCanvasIfNeeded(GraphicsLayer* layer, const CoordinatedGraphicsLayerState& state) > { >- ASSERT(m_textureMapper); >- GraphicsLayer* layer = layerByID(id); >- ASSERT(!m_surfaceBackingStores.contains(id)); >+ if (!state.canvasToken.isValid()) >+ return; > > RefPtr<TextureMapperSurfaceBackingStore> canvasBackingStore(TextureMapperSurfaceBackingStore::create()); >- m_surfaceBackingStores.set(id, canvasBackingStore); >+ m_surfaceBackingStores.set(layer, canvasBackingStore); > >- canvasBackingStore->setGraphicsSurface(surface); >+ GraphicsSurface::Flags surfaceFlags = GraphicsSurface::SupportsTextureTarget | GraphicsSurface::SupportsSharing; >+ canvasBackingStore->setGraphicsSurface(GraphicsSurface::create(state.canvasSize, surfaceFlags, state.canvasToken)); > layer->setContentsToMedia(canvasBackingStore.get()); > } > >-void CoordinatedGraphicsScene::syncCanvas(CoordinatedLayerID id, uint32_t frontBuffer) >+void CoordinatedGraphicsScene::syncCanvasIfNeeded(GraphicsLayer* layer, const CoordinatedGraphicsLayerState& state) > { > ASSERT(m_textureMapper); >- ASSERT(m_surfaceBackingStores.contains(id)); >+ ASSERT(m_surfaceBackingStores.contains(layer)); > >- SurfaceBackingStoreMap::iterator it = m_surfaceBackingStores.find(id); >- RefPtr<TextureMapperSurfaceBackingStore> canvasBackingStore = it->value; >+ if (state.canvasChanged) { >+ destroyCanvasIfNeeded(layer,state); >+ createCanvasIfNeeded(layer, state); >+ } > >- canvasBackingStore->swapBuffersIfNeeded(frontBuffer); >+ if (state.canvasShouldSwapBuffers) { >+ SurfaceBackingStoreMap::iterator it = m_surfaceBackingStores.find(layer); >+ RefPtr<TextureMapperSurfaceBackingStore> canvasBackingStore = it->value; >+ canvasBackingStore->swapBuffersIfNeeded(state.canvasFrontBuffer); >+ } > } > >-void CoordinatedGraphicsScene::destroyCanvas(CoordinatedLayerID id) >+void CoordinatedGraphicsScene::destroyCanvasIfNeeded(GraphicsLayer* layer, const CoordinatedGraphicsLayerState& state) > { >- ASSERT(m_textureMapper); >- GraphicsLayer* layer = layerByID(id); >- ASSERT(m_surfaceBackingStores.contains(id)); >+ if (state.canvasToken.isValid()) >+ return; > >- m_surfaceBackingStores.remove(id); >+ m_surfaceBackingStores.remove(layer); > layer->setContentsToMedia(0); > } > #endif > >-void CoordinatedGraphicsScene::setLayerRepaintCount(CoordinatedLayerID id, int value) >+void CoordinatedGraphicsScene::setLayerRepaintCountIfNeeded(GraphicsLayer* layer, const CoordinatedGraphicsLayerState& state) > { >- GraphicsLayer* layer = layerByID(id); >- toGraphicsLayerTextureMapper(layer)->setRepaintCount(value); >+ if (!layer->isShowingRepaintCounter() || !state.repaintCountChanged) >+ return; >+ >+ toGraphicsLayerTextureMapper(layer)->setRepaintCount(state.repaintCount); > } > >-void CoordinatedGraphicsScene::setLayerChildren(CoordinatedLayerID id, const Vector<CoordinatedLayerID>& childIDs) >+void CoordinatedGraphicsScene::setLayerChildrenIfNeeded(GraphicsLayer* layer, const CoordinatedGraphicsLayerState& state) > { >- GraphicsLayer* layer = layerByID(id); >+ if (!state.childrenChanged) >+ return; >+ > Vector<GraphicsLayer*> children; > >- for (size_t i = 0; i < childIDs.size(); ++i) { >- CoordinatedLayerID childID = childIDs[i]; >+ for (size_t i = 0; i < state.children.size(); ++i) { >+ CoordinatedLayerID childID = state.children[i]; > GraphicsLayer* child = layerByID(childID); > children.append(child); > } >@@ -251,14 +260,15 @@ void CoordinatedGraphicsScene::setLayerChildren(CoordinatedLayerID id, const Vec > } > > #if ENABLE(CSS_FILTERS) >-void CoordinatedGraphicsScene::setLayerFilters(CoordinatedLayerID id, const FilterOperations& filters) >+void CoordinatedGraphicsScene::setLayerFiltersIfNeeded(GraphicsLayer* layer, const CoordinatedGraphicsLayerState& state) > { >- GraphicsLayer* layer = layerByID(id); >+ if (!state.filtersChanged) >+ return; > > #if ENABLE(CSS_SHADERS) >- injectCachedCustomFilterPrograms(filters); >+ injectCachedCustomFilterPrograms(state.filters); > #endif >- layer->setFilters(filters); >+ layer->setFilters(state.filters); > } > #endif > >@@ -294,43 +304,78 @@ void CoordinatedGraphicsScene::removeCustomFilterProgram(int id) > } > #endif // ENABLE(CSS_SHADERS) > >-void CoordinatedGraphicsScene::setLayerState(CoordinatedLayerID id, const CoordinatedLayerInfo& layerInfo) >+void CoordinatedGraphicsScene::setLayerState(CoordinatedLayerID id, const CoordinatedGraphicsLayerState& layerState) > { > ASSERT(m_rootLayerID != InvalidCoordinatedLayerID); > GraphicsLayer* layer = layerByID(id); > >- layer->setReplicatedByLayer(getLayerByIDIfExists(layerInfo.replica)); >- layer->setMaskLayer(getLayerByIDIfExists(layerInfo.mask)); >- >- layer->setAnchorPoint(layerInfo.anchorPoint); >- layer->setPosition(layerInfo.pos); >- layer->setSize(layerInfo.size); >- >- layer->setTransform(layerInfo.transform); >- layer->setChildrenTransform(layerInfo.childrenTransform); >- layer->setBackfaceVisibility(layerInfo.backfaceVisible); >- layer->setContentsOpaque(layerInfo.contentsOpaque); >- layer->setContentsRect(layerInfo.contentsRect); >- layer->setContentsToSolidColor(layerInfo.solidColor); >- layer->setDrawsContent(layerInfo.drawsContent); >- layer->setContentsVisible(layerInfo.contentsVisible); >- toGraphicsLayerTextureMapper(layer)->setFixedToViewport(layerInfo.fixedToViewport); >- layer->setShowDebugBorder(layerInfo.showDebugBorders); >- layer->setDebugBorder(layerInfo.debugBorderColor, layerInfo.debugBorderWidth); >- layer->setShowRepaintCounter(layerInfo.showRepaintCounter); >- >- if (layerInfo.fixedToViewport) >+ if (layerState.positionChanged) >+ layer->setPosition(layerState.pos); >+ >+ if (layerState.anchorPointChanged) >+ layer->setAnchorPoint(layerState.anchorPoint); >+ >+ if (layerState.sizeChanged) >+ layer->setSize(layerState.size); >+ >+ if (layerState.transformChanged) >+ layer->setTransform(layerState.transform); >+ >+ if (layerState.childrenTransformChanged) >+ layer->setChildrenTransform(layerState.childrenTransform); >+ >+ if (layerState.contentsRectChanged) >+ layer->setContentsRect(layerState.contentsRect); >+ >+ if (layerState.opacityChanged) >+ layer->setOpacity(layerState.opacity); >+ >+ if (layerState.solidColorChanged) >+ layer->setContentsToSolidColor(layerState.solidColor); >+ >+ if (layerState.debugBorderColorChanged || layerState.debugBorderWidthChanged) >+ layer->setDebugBorder(layerState.debugBorderColor, layerState.debugBorderWidth); >+ >+ if (layerState.replicaChanged) >+ layer->setReplicatedByLayer(getLayerByIDIfExists(layerState.replica)); >+ >+ if (layerState.maskChanged) >+ layer->setMaskLayer(getLayerByIDIfExists(layerState.mask)); >+ >+ if (layerState.imageChanged) >+ assignImageBackingToLayer(layer, layerState.imageID); >+ >+ if (layerState.flagsChanged) { >+ layer->setContentsOpaque(layerState.contentsOpaque); >+ layer->setDrawsContent(layerState.drawsContent); >+ layer->setContentsVisible(layerState.contentsVisible); >+ layer->setBackfaceVisibility(layerState.backfaceVisible); >+ >+ // Never make the root layer clip. >+ layer->setMasksToBounds(layerState.isRootLayer ? false : layerState.masksToBounds); >+ layer->setPreserves3D(layerState.preserves3D); >+ >+ toGraphicsLayerTextureMapper(layer)->setFixedToViewport(layerState.fixedToViewport); >+ layer->setShowDebugBorder(layerState.showDebugBorders); >+ layer->setShowRepaintCounter(layerState.showRepaintCounter); >+ } >+ >+ if (layerState.fixedToViewport) > m_fixedLayers.add(id, layer); > else > m_fixedLayers.remove(id); > >- assignImageBackingToLayer(id, layer, layerInfo.imageID); > prepareContentBackingStore(layer); > >- // Never make the root layer clip. >- layer->setMasksToBounds(layerInfo.isRootLayer ? false : layerInfo.masksToBounds); >- layer->setOpacity(layerInfo.opacity); >- layer->setPreserves3D(layerInfo.preserves3D); >+ // Apply Operations. >+ setLayerChildrenIfNeeded(layer, layerState); >+ updateTilesIfNeeded(layer, layerState); >+#if ENABLE(CSS_FILTERS) >+ setLayerFiltersIfNeeded(layer, layerState); >+#endif >+ setLayerAnimationsIfNeeded(layer, layerState); >+ syncCanvasIfNeeded(layer, layerState); >+ setLayerRepaintCountIfNeeded(layer, layerState); > } > > GraphicsLayer* CoordinatedGraphicsScene::getLayerByIDIfExists(CoordinatedLayerID id) >@@ -365,7 +410,7 @@ void CoordinatedGraphicsScene::deleteLayer(CoordinatedLayerID layerID) > m_backingStores.remove(layer.get()); > m_fixedLayers.remove(layerID); > #if USE(GRAPHICS_SURFACE) >- m_surfaceBackingStores.remove(layerID); >+ m_surfaceBackingStores.remove(layer.get()); > #endif > } > >@@ -419,36 +464,56 @@ void CoordinatedGraphicsScene::resetBackingStoreSizeToLayerSize(GraphicsLayer* g > m_backingStoresWithPendingBuffers.add(backingStore); > } > >-void CoordinatedGraphicsScene::createTile(CoordinatedLayerID layerID, uint32_t tileID, float scale) >+void CoordinatedGraphicsScene::createTilesIfNeeded(GraphicsLayer* layer, const CoordinatedGraphicsLayerState& state) > { >- GraphicsLayer* layer = layerByID(layerID); >+ if (state.tilesToCreate.isEmpty()) >+ return; >+ > RefPtr<CoordinatedBackingStore> backingStore = m_backingStores.get(layer); > ASSERT(backingStore); >- backingStore->createTile(tileID, scale); >+ >+ Vector<std::pair<uint32_t, float> >::const_iterator end = state.tilesToCreate.end(); >+ for (Vector<std::pair<uint32_t, float> >::const_iterator it = state.tilesToCreate.begin(); it != end; ++it) >+ backingStore->createTile(it->first, it->second); > } > >-void CoordinatedGraphicsScene::removeTile(CoordinatedLayerID layerID, uint32_t tileID) >+void CoordinatedGraphicsScene::removeTilesIfNeeded(GraphicsLayer* layer, const CoordinatedGraphicsLayerState& state) > { >- GraphicsLayer* layer = layerByID(layerID); >+ if (state.tilesToRemove.isEmpty()) >+ return; >+ > RefPtr<CoordinatedBackingStore> backingStore = m_backingStores.get(layer); > if (!backingStore) > return; > >- backingStore->removeTile(tileID); >+ Vector<uint32_t>::const_iterator end = state.tilesToRemove.end(); >+ for (Vector<uint32_t>::const_iterator it = state.tilesToRemove.begin(); it != end; ++it) >+ backingStore->removeTile(*it); >+ > m_backingStoresWithPendingBuffers.add(backingStore); > } > >-void CoordinatedGraphicsScene::updateTile(CoordinatedLayerID layerID, uint32_t tileID, const TileUpdate& update) >+void CoordinatedGraphicsScene::updateTilesIfNeeded(GraphicsLayer* layer, const CoordinatedGraphicsLayerState& state) > { >- GraphicsLayer* layer = layerByID(layerID); >+ createTilesIfNeeded(layer, state); >+ removeTilesIfNeeded(layer, state); >+ >+ if (state.tilesToUpdate.isEmpty()) >+ return; >+ > RefPtr<CoordinatedBackingStore> backingStore = m_backingStores.get(layer); > ASSERT(backingStore); > >- SurfaceMap::iterator it = m_surfaces.find(update.atlasID); >- ASSERT(it != m_surfaces.end()); >+ Vector<TileUpdateInfo>::const_iterator end = state.tilesToUpdate.end(); >+ for (Vector<TileUpdateInfo>::const_iterator it = state.tilesToUpdate.begin(); it != end; ++it) { >+ const SurfaceUpdateInfo& surfaceUpdateInfo = it->updateInfo; > >- backingStore->updateTile(tileID, update.sourceRect, update.tileRect, it->value, update.offset); >- m_backingStoresWithPendingBuffers.add(backingStore); >+ SurfaceMap::iterator surfaceIt = m_surfaces.find(surfaceUpdateInfo.atlasID); >+ ASSERT(surfaceIt != m_surfaces.end()); >+ >+ backingStore->updateTile(it->tileID, surfaceUpdateInfo.updateRect, it->tileRect, surfaceIt->value, surfaceUpdateInfo.surfaceOffset); >+ m_backingStoresWithPendingBuffers.add(backingStore); >+ } > } > > void CoordinatedGraphicsScene::createUpdateAtlas(uint32_t atlasID, PassRefPtr<CoordinatedSurface> surface) >@@ -504,10 +569,10 @@ void CoordinatedGraphicsScene::removeImageBacking(CoordinatedImageBackingID imag > m_releasedImageBackings.append(m_imageBackings.take(imageID)); > } > >-void CoordinatedGraphicsScene::assignImageBackingToLayer(CoordinatedLayerID id, GraphicsLayer* layer, CoordinatedImageBackingID imageID) >+void CoordinatedGraphicsScene::assignImageBackingToLayer(GraphicsLayer* layer, CoordinatedImageBackingID imageID) > { > #if USE(GRAPHICS_SURFACE) >- if (m_surfaceBackingStores.contains(id)) >+ if (m_surfaceBackingStores.contains(layer)) > return; > #endif > >@@ -534,13 +599,25 @@ void CoordinatedGraphicsScene::commitPendingBackingStoreOperations() > m_backingStoresWithPendingBuffers.clear(); > } > >-void CoordinatedGraphicsScene::flushLayerChanges(const FloatPoint& scrollPosition) >+void CoordinatedGraphicsScene::flushLayerChanges(const CoordinatedGraphicsState& state) > { >- m_renderedContentsScrollPosition = scrollPosition; >+ m_renderedContentsScrollPosition = state.scrollPosition; > > // Since the frame has now been rendered, we can safely unlock the animations until the next layout. > setAnimationsLocked(false); > >+ if (state.rootCompositingLayer != m_rootLayerID) >+ setRootLayerID(state.rootCompositingLayer); >+ >+ if (state.backgroundColor != m_backgroundColor) >+ setBackgroundColor(state.backgroundColor); >+ >+ typedef Vector<std::pair<CoordinatedLayerID, CoordinatedGraphicsLayerState> > LayerUpdatePairVector; >+ LayerUpdatePairVector::const_iterator end = state.layersToUpdate.end(); >+ for (LayerUpdatePairVector::const_iterator iter = state.layersToUpdate.begin(); iter != end; ++iter) { >+ setLayerState(iter->first, iter->second); >+ } >+ > m_rootLayer->flushCompositingState(FloatRect()); > commitPendingBackingStoreOperations(); > removeReleasedImageBackingsIfNeeded(); >@@ -616,12 +693,16 @@ void CoordinatedGraphicsScene::purgeBackingStores() > m_client->purgeBackingStores(); > } > >-void CoordinatedGraphicsScene::setLayerAnimations(CoordinatedLayerID id, const GraphicsLayerAnimations& animations) >+void CoordinatedGraphicsScene::setLayerAnimationsIfNeeded(GraphicsLayer* graphicsLayer, const CoordinatedGraphicsLayerState& state) > { >- GraphicsLayerTextureMapper* layer = toGraphicsLayerTextureMapper(layerByID(id)); >+ if (!state.animationsChanged) >+ return; >+ >+ GraphicsLayerTextureMapper* layer = toGraphicsLayerTextureMapper(graphicsLayer); >+ > #if ENABLE(CSS_SHADERS) >- for (size_t i = 0; i < animations.animations().size(); ++i) { >- const KeyframeValueList& keyframes = animations.animations().at(i).keyframes(); >+ for (size_t i = 0; i < state.animations.animations().size(); ++i) { >+ const KeyframeValueList& keyframes = state.animations.animations().at(i).keyframes(); > if (keyframes.property() != AnimatedPropertyWebkitFilter) > continue; > for (size_t j = 0; j < keyframes.size(); ++j) { >@@ -630,7 +711,7 @@ void CoordinatedGraphicsScene::setLayerAnimations(CoordinatedLayerID id, const G > } > } > #endif >- layer->setAnimations(animations); >+ layer->setAnimations(state.animations); > } > > void CoordinatedGraphicsScene::setAnimationsLocked(bool locked) >diff --git a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.h b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.h >index 9c921a7..87152b1 100644 >--- a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.h >+++ b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.h >@@ -21,7 +21,7 @@ > #define CoordinatedGraphicsScene_h > > #if USE(COORDINATED_GRAPHICS) >-#include "CoordinatedLayerInfo.h" >+#include "CoordinatedGraphicsState.h" > #include "CoordinatedSurface.h" > #include "GraphicsContext.h" > #include "GraphicsLayer.h" >@@ -46,7 +46,6 @@ > namespace WebCore { > > class CoordinatedBackingStore; >-class CoordinatedLayerInfo; > class CustomFilterProgram; > class CustomFilterProgramInfo; > class TextureMapperLayer; >@@ -82,13 +81,6 @@ public: > void paintToCurrentGLContext(const TransformationMatrix&, float, const FloatRect&, TextureMapper::PaintFlags = 0); > void paintToGraphicsContext(PlatformGraphicsContext*); > void setScrollPosition(const FloatPoint&); >-#if USE(GRAPHICS_SURFACE) >- void createCanvas(CoordinatedLayerID, const IntSize&, PassRefPtr<GraphicsSurface>); >- void syncCanvas(CoordinatedLayerID, uint32_t frontBuffer); >- void destroyCanvas(CoordinatedLayerID); >-#endif >- void setLayerRepaintCount(CoordinatedLayerID, int value); >- > void detach(); > void appendUpdate(const Function<void()>&); > >@@ -97,31 +89,24 @@ public: > void purgeGLResources(); > void setActive(bool); > >+ void flushLayerChanges(const CoordinatedGraphicsState&); >+ > void createLayers(const Vector<CoordinatedLayerID>&); > void deleteLayers(const Vector<CoordinatedLayerID>&); > void setRootLayerID(CoordinatedLayerID); >- void setLayerChildren(CoordinatedLayerID, const Vector<CoordinatedLayerID>&); >- void setLayerState(CoordinatedLayerID, const CoordinatedLayerInfo&); >-#if ENABLE(CSS_FILTERS) >- void setLayerFilters(CoordinatedLayerID, const FilterOperations&); >-#endif >+ > #if ENABLE(CSS_SHADERS) > void injectCachedCustomFilterPrograms(const FilterOperations& filters) const; > void createCustomFilterProgram(int id, const CustomFilterProgramInfo&); > void removeCustomFilterProgram(int id); > #endif > >- void createTile(CoordinatedLayerID, uint32_t tileID, float scale); >- void removeTile(CoordinatedLayerID, uint32_t tileID); >- void updateTile(CoordinatedLayerID, uint32_t tileID, const TileUpdate&); > void createUpdateAtlas(uint32_t atlasID, PassRefPtr<CoordinatedSurface>); > void removeUpdateAtlas(uint32_t atlasID); >- void flushLayerChanges(const FloatPoint& scrollPosition); > void createImageBacking(CoordinatedImageBackingID); > void updateImageBacking(CoordinatedImageBackingID, PassRefPtr<CoordinatedSurface>); > void clearImageBackingContents(CoordinatedImageBackingID); > void removeImageBacking(CoordinatedImageBackingID); >- void setLayerAnimations(CoordinatedLayerID, const GraphicsLayerAnimations&); > void setAnimationsLocked(bool); > void setBackgroundColor(const Color&); > void setDrawsBackground(bool enable) { m_setDrawsBackground = enable; } >@@ -131,6 +116,23 @@ public: > #endif > > private: >+ // Real Operations >+ void setLayerState(CoordinatedLayerID, const CoordinatedGraphicsLayerState&); >+ void setLayerChildrenIfNeeded(GraphicsLayer*, const CoordinatedGraphicsLayerState&); >+ void updateTilesIfNeeded(GraphicsLayer*, const CoordinatedGraphicsLayerState&); >+ void createTilesIfNeeded(GraphicsLayer*, const CoordinatedGraphicsLayerState&); >+ void removeTilesIfNeeded(GraphicsLayer*, const CoordinatedGraphicsLayerState&); >+#if ENABLE(CSS_FILTERS) >+ void setLayerFiltersIfNeeded(GraphicsLayer*, const CoordinatedGraphicsLayerState&); >+#endif >+ void setLayerAnimationsIfNeeded(GraphicsLayer*, const CoordinatedGraphicsLayerState&); >+#if USE(GRAPHICS_SURFACE) >+ void createCanvasIfNeeded(GraphicsLayer*, const CoordinatedGraphicsLayerState&); >+ void syncCanvasIfNeeded(GraphicsLayer*, const CoordinatedGraphicsLayerState&); >+ void destroyCanvasIfNeeded(GraphicsLayer*, const CoordinatedGraphicsLayerState&); >+#endif >+ void setLayerRepaintCountIfNeeded(GraphicsLayer*, const CoordinatedGraphicsLayerState&); >+ > GraphicsLayer* layerByID(CoordinatedLayerID id) > { > ASSERT(m_layers.contains(id)); >@@ -159,7 +161,7 @@ private: > void createLayer(CoordinatedLayerID); > void deleteLayer(CoordinatedLayerID); > >- void assignImageBackingToLayer(CoordinatedLayerID, GraphicsLayer*, CoordinatedImageBackingID); >+ void assignImageBackingToLayer(GraphicsLayer*, CoordinatedImageBackingID); > void removeReleasedImageBackingsIfNeeded(); > void ensureRootLayer(); > void commitPendingBackingStoreOperations(); >@@ -185,7 +187,7 @@ private: > HashSet<RefPtr<CoordinatedBackingStore> > m_backingStoresWithPendingBuffers; > > #if USE(GRAPHICS_SURFACE) >- typedef HashMap<CoordinatedLayerID, RefPtr<TextureMapperSurfaceBackingStore> > SurfaceBackingStoreMap; >+ typedef HashMap<GraphicsLayer*, RefPtr<TextureMapperSurfaceBackingStore> > SurfaceBackingStoreMap; > SurfaceBackingStoreMap m_surfaceBackingStores; > #endif > >diff --git a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h >new file mode 100644 >index 0000000..7f9a5f4 >--- /dev/null >+++ b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h >@@ -0,0 +1,164 @@ >+/* >+ * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies) >+ * Copyright (C) 2013 Company 100, Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#ifndef CoordinatedGraphicsState_h >+#define CoordinatedGraphicsState_h >+ >+#if USE(COORDINATED_GRAPHICS) >+ >+#include "Color.h" >+#include "FloatRect.h" >+#include "FloatSize.h" >+#include "IntSize.h" >+#include "IntRect.h" >+#include "TransformationMatrix.h" >+#include "GraphicsLayerAnimation.h" >+#include "SurfaceUpdateInfo.h" >+ >+#if ENABLE(CSS_FILTERS) >+#include "FilterOperations.h" >+#endif >+ >+#if USE(GRAPHICS_SURFACE) >+#include "GraphicsSurfaceToken.h" >+#endif >+ >+#include "CoordinatedSurface.h" >+ >+namespace WebCore { >+ >+typedef uint32_t CoordinatedLayerID; >+enum { InvalidCoordinatedLayerID = 0 }; >+ >+typedef uint64_t CoordinatedImageBackingID; >+enum { InvalidCoordinatedImageBackingID = 0 }; >+ >+struct TileUpdateInfo { >+ uint32_t tileID; >+ IntRect tileRect; >+ WebCore::SurfaceUpdateInfo updateInfo; >+}; >+ >+struct CoordinatedGraphicsLayerState { >+ union { >+ struct { >+ bool positionChanged: 1; >+ bool anchorPointChanged: 1; >+ bool sizeChanged: 1; >+ bool transformChanged: 1; >+ bool childrenTransformChanged: 1; >+ bool contentsRectChanged: 1; >+ bool opacityChanged: 1; >+ bool solidColorChanged: 1; >+ bool debugBorderColorChanged: 1; >+ bool debugBorderWidthChanged: 1; >+ bool replicaChanged: 1; >+ bool maskChanged: 1; >+ bool imageChanged: 1; >+ bool flagsChanged: 1; >+ bool animationsChanged: 1; >+ bool filtersChanged: 1; >+ bool childrenChanged: 1; >+ bool repaintCountChanged : 1; >+ bool canvasChanged: 1; >+ bool canvasShouldSwapBuffers: 1; >+ }; >+ unsigned changeMask; >+ }; >+ union { >+ struct { >+ bool contentsOpaque : 1; >+ bool drawsContent : 1; >+ bool contentsVisible : 1; >+ bool backfaceVisible : 1; >+ bool masksToBounds : 1; >+ bool preserves3D : 1; >+ bool isRootLayer: 1; >+ bool fixedToViewport : 1; >+ bool showDebugBorders : 1; >+ bool showRepaintCounter : 1; >+ }; >+ unsigned flags; >+ }; >+ >+ CoordinatedGraphicsLayerState() >+ : changeMask(0) >+ , flags(0) >+ , opacity(0) >+ , debugBorderWidth(0) >+ , replica(InvalidCoordinatedLayerID) >+ , mask(InvalidCoordinatedLayerID) >+ , imageID(InvalidCoordinatedImageBackingID) >+ , canvasFrontBuffer(0) >+ { >+ } >+ FloatPoint pos; >+ FloatPoint3D anchorPoint; >+ FloatSize size; >+ TransformationMatrix transform; >+ TransformationMatrix childrenTransform; >+ IntRect contentsRect; >+ float opacity; >+ Color solidColor; >+ Color debugBorderColor; >+ float debugBorderWidth; >+#if ENABLE(CSS_FILTERS) >+ FilterOperations filters; >+#endif >+ GraphicsLayerAnimations animations; >+ Vector<uint32_t> children; >+ Vector<std::pair<uint32_t /* tileID */, float /* scale */> > tilesToCreate; >+ Vector<uint32_t> tilesToRemove; >+ CoordinatedLayerID replica; >+ CoordinatedLayerID mask; >+ CoordinatedImageBackingID imageID; >+ >+ unsigned repaintCount; >+ Vector<TileUpdateInfo> tilesToUpdate; >+ >+#if USE(GRAPHICS_SURFACE) >+ IntSize canvasSize; >+ GraphicsSurfaceToken canvasToken; >+ uint32_t canvasFrontBuffer; >+#endif >+}; >+ >+struct CoordinatedGraphicsState { >+ uint32_t rootCompositingLayer; >+ Color backgroundColor; >+ FloatPoint scrollPosition; >+ IntSize contentsSize; >+ IntRect coveredRect; >+ >+ Vector<std::pair<CoordinatedLayerID, CoordinatedGraphicsLayerState> > layersToUpdate; >+ Vector<std::pair<CoordinatedImageBackingID, RefPtr<CoordinatedSurface> > > imagesToUpdate; >+}; >+ >+} // namespace WebCore >+ >+#endif // USE(COORDINATED_GRAPHICS) >+ >+#endif // CoordinatedGraphicsState_h >diff --git a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedImageBacking.h b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedImageBacking.h >index 5b5b57a..779e328 100644 >--- a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedImageBacking.h >+++ b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedImageBacking.h >@@ -28,7 +28,7 @@ > #define CoordinatedImageBacking_h > > #if USE(COORDINATED_GRAPHICS) >-#include "CoordinatedLayerInfo.h" >+#include "CoordinatedGraphicsState.h" > #include "CoordinatedSurface.h" > #include "Image.h" > #include "Timer.h" >@@ -86,7 +86,6 @@ private: > > bool m_isDirty; > bool m_isVisible; >- > }; > > } // namespace WebCore >diff --git a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedLayerInfo.h b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedLayerInfo.h >deleted file mode 100644 >index 0fa2a12..0000000 >--- a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedLayerInfo.h >+++ /dev/null >@@ -1,85 +0,0 @@ >-/* >- Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) >- >- This library is free software; you can redistribute it and/or >- modify it under the terms of the GNU Library General Public >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Library General Public License for more details. >- >- You should have received a copy of the GNU Library General Public License >- along with this library; see the file COPYING.LIB. If not, write to >- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- Boston, MA 02110-1301, USA. >- */ >- >-#ifndef CoordinatedLayerInfo_h >-#define CoordinatedLayerInfo_h >- >-#if USE(COORDINATED_GRAPHICS) >- >-#include "Color.h" >-#include "FloatRect.h" >-#include "FloatSize.h" >-#include "IntRect.h" >-#include "TransformationMatrix.h" >- >-namespace WebCore { >- >-typedef uint32_t CoordinatedLayerID; >-enum { InvalidCoordinatedLayerID = 0 }; >- >-typedef uint64_t CoordinatedImageBackingID; >-enum { InvalidCoordinatedImageBackingID = 0 }; >- >-// NOTE: CoordinatedLayerInfo should only use POD types, as to make serialization faster. >-struct CoordinatedLayerInfo { >- CoordinatedLayerInfo() >- : replica(InvalidCoordinatedLayerID) >- , mask(InvalidCoordinatedLayerID) >- , imageID(InvalidCoordinatedImageBackingID) >- , opacity(0) >- , debugBorderWidth(0) >- , flags(0) { } >- >- CoordinatedLayerID replica; >- CoordinatedLayerID mask; >- CoordinatedImageBackingID imageID; >- >- FloatPoint pos; >- FloatPoint3D anchorPoint; >- FloatSize size; >- TransformationMatrix transform; >- TransformationMatrix childrenTransform; >- IntRect contentsRect; >- float opacity; >- Color solidColor; >- Color debugBorderColor; >- float debugBorderWidth; >- >- union { >- struct { >- bool contentsOpaque : 1; >- bool drawsContent : 1; >- bool contentsVisible : 1; >- bool backfaceVisible : 1; >- bool masksToBounds : 1; >- bool preserves3D : 1; >- bool isRootLayer: 1; >- bool fixedToViewport : 1; >- bool showDebugBorders : 1; >- bool showRepaintCounter : 1; >- }; >- unsigned flags; >- }; >-}; >- >-} // namespace WebCore >- >-#endif // USE(COORDINATED_GRAPHICS) >- >-#endif // CoordinatedLayerInfo_h >diff --git a/Source/WebCore/platform/graphics/texmap/coordinated/SurfaceUpdateInfo.h b/Source/WebCore/platform/graphics/texmap/coordinated/SurfaceUpdateInfo.h >index 6ab384a..5af069a 100644 >--- a/Source/WebCore/platform/graphics/texmap/coordinated/SurfaceUpdateInfo.h >+++ b/Source/WebCore/platform/graphics/texmap/coordinated/SurfaceUpdateInfo.h >@@ -23,12 +23,10 @@ > #if USE(COORDINATED_GRAPHICS) > > #include "IntRect.h" >-#include <wtf/Noncopyable.h> > > namespace WebCore { > > class SurfaceUpdateInfo { >- WTF_MAKE_NONCOPYABLE(SurfaceUpdateInfo); > > public: > SurfaceUpdateInfo() { } >diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog >index 29c047a..0e7e632 100644 >--- a/Source/WebKit2/ChangeLog >+++ b/Source/WebKit2/ChangeLog >@@ -1,3 +1,21 @@ >+2013-02-04 Huang Dongsung <luxtella@company100.net> >+ >+ Coordinated Graphics: CoordinatedGraphicsLayer makes CoordinatedGraphicsScene perform via CoordinatedGraphicsState. >+ https://bugs.webkit.org/show_bug.cgi?id=108294 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ There are two changes in WK2. >+ 1. Change CoordinatedLayerTreeHostProxy to use CoordinatedGraphicsState. >+ 2. Add encode/decode of CoordinatedGraphicsState in >+ CoordinatedGraphicsArgumentCoders. >+ >+ * Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp: >+ (CoreIPC::::encode): >+ Encoding UpdateImageBacking and CreateUpdateAtlas can fail when >+ encoding WebCoordinatedSurface::Handle fails, but we don't >+ recover in the case. >+ > 2013-02-24 Andreas Kling <akling@apple.com> > > Reduce include graph of JSDOMBinding.h >diff --git a/Source/WebKit2/Scripts/webkit2/messages.py b/Source/WebKit2/Scripts/webkit2/messages.py >index 467f337..7bbb409 100644 >--- a/Source/WebKit2/Scripts/webkit2/messages.py >+++ b/Source/WebKit2/Scripts/webkit2/messages.py >@@ -398,7 +398,7 @@ def headers_for_type(type): > special_cases = { > 'WTF::String': ['<wtf/text/WTFString.h>'], > 'WebCore::CompositionUnderline': ['<WebCore/Editor.h>'], >- 'WebCore::CoordinatedLayerID': ['<WebCore/CoordinatedLayerInfo.h>'], >+ 'WebCore::CoordinatedGraphicsLayerState': ['<WebCore/CoordinatedGraphicsState.h>'], > 'WebCore::GrammarDetail': ['<WebCore/TextCheckerClient.h>'], > 'WebCore::GraphicsLayerAnimations': ['<WebCore/GraphicsLayerAnimation.h>'], > 'WebCore::KeyframeValueList': ['<WebCore/GraphicsLayer.h>'], >diff --git a/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp b/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp >index 5a06d11..a01e428 100644 >--- a/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp >+++ b/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp >@@ -30,9 +30,10 @@ > > #if USE(COORDINATED_GRAPHICS) > #include "WebCoreArgumentCoders.h" >+#include "WebCoordinatedSurface.h" > #include <WebCore/Animation.h> > #include <WebCore/Color.h> >-#include <WebCore/CoordinatedLayerInfo.h> >+#include <WebCore/CoordinatedGraphicsState.h> > #include <WebCore/FloatPoint3D.h> > #include <WebCore/GraphicsLayerAnimation.h> > #include <WebCore/IdentityTransformOperation.h> >@@ -73,9 +74,7 @@ > #endif > > using namespace WebCore; >-#if ENABLE(CSS_SHADERS) > using namespace WebKit; >-#endif > > namespace CoreIPC { > >@@ -815,24 +814,223 @@ bool ArgumentCoder<WebCore::GraphicsSurfaceToken>::decode(ArgumentDecoder& decod > } > #endif > >-void ArgumentCoder<CoordinatedLayerInfo>::encode(ArgumentEncoder& encoder, const CoordinatedLayerInfo& coordinatedLayerInfo) >+void ArgumentCoder<SurfaceUpdateInfo>::encode(ArgumentEncoder& encoder, const SurfaceUpdateInfo& surfaceUpdateInfo) > { >- SimpleArgumentCoder<CoordinatedLayerInfo>::encode(encoder, coordinatedLayerInfo); >+ SimpleArgumentCoder<SurfaceUpdateInfo>::encode(encoder, surfaceUpdateInfo); > } > >-bool ArgumentCoder<CoordinatedLayerInfo>::decode(ArgumentDecoder& decoder, CoordinatedLayerInfo& coordinatedLayerInfo) >+bool ArgumentCoder<SurfaceUpdateInfo>::decode(ArgumentDecoder& decoder, SurfaceUpdateInfo& surfaceUpdateInfo) > { >- return SimpleArgumentCoder<CoordinatedLayerInfo>::decode(decoder, coordinatedLayerInfo); >+ return SimpleArgumentCoder<SurfaceUpdateInfo>::decode(decoder, surfaceUpdateInfo); > } > >-void ArgumentCoder<SurfaceUpdateInfo>::encode(ArgumentEncoder& encoder, const SurfaceUpdateInfo& surfaceUpdateInfo) >+template<typename T> static void encodeLayerStateIfNeeded(ArgumentEncoder& encoder, const T& value, bool isNeeded) > { >- SimpleArgumentCoder<SurfaceUpdateInfo>::encode(encoder, surfaceUpdateInfo); >+ if (isNeeded) >+ encoder << value; > } > >-bool ArgumentCoder<SurfaceUpdateInfo>::decode(ArgumentDecoder& decoder, SurfaceUpdateInfo& surfaceUpdateInfo) >+template<typename T> static bool decodeLayerStateIfNeeded(ArgumentDecoder& decoder, T& value, bool isNeeded) > { >- return SimpleArgumentCoder<SurfaceUpdateInfo>::decode(decoder, surfaceUpdateInfo); >+ if (!isNeeded) >+ return true; >+ return decoder.decode(value); >+} >+ >+void ArgumentCoder<CoordinatedGraphicsLayerState>::encode(ArgumentEncoder& encoder, const CoordinatedGraphicsLayerState& state) >+{ >+ encoder << state.changeMask; >+ encodeLayerStateIfNeeded(encoder, state.flags, state.flagsChanged); >+ encodeLayerStateIfNeeded(encoder, state.pos, state.positionChanged); >+ encodeLayerStateIfNeeded(encoder, state.anchorPoint, state.anchorPointChanged); >+ encodeLayerStateIfNeeded(encoder, state.size, state.sizeChanged); >+ encodeLayerStateIfNeeded(encoder, state.transform, state.transformChanged); >+ encodeLayerStateIfNeeded(encoder, state.childrenTransform, state.childrenTransformChanged); >+ encodeLayerStateIfNeeded(encoder, state.contentsRect, state.contentsRectChanged); >+ encodeLayerStateIfNeeded(encoder, state.opacity, state.opacityChanged); >+ encodeLayerStateIfNeeded(encoder, state.solidColor, state.solidColorChanged); >+ encodeLayerStateIfNeeded(encoder, state.debugBorderColor, state.debugBorderColorChanged); >+ encodeLayerStateIfNeeded(encoder, state.debugBorderWidth, state.debugBorderWidthChanged); >+#if ENABLE(CSS_FILTERS) >+ encodeLayerStateIfNeeded(encoder, state.filters, state.filtersChanged); >+#endif >+ encodeLayerStateIfNeeded(encoder, state.animations, state.animationsChanged); >+ encodeLayerStateIfNeeded(encoder, state.children, state.childrenChanged); >+ encoder << state.tilesToCreate; >+ encoder << state.tilesToRemove; >+ encodeLayerStateIfNeeded(encoder, state.replica, state.replicaChanged); >+ encodeLayerStateIfNeeded(encoder, state.mask, state.maskChanged); >+ encodeLayerStateIfNeeded(encoder, state.imageID, state.imageChanged); >+ encodeLayerStateIfNeeded(encoder, state.repaintCount, state.repaintCountChanged); >+ encoder << state.tilesToUpdate; >+#if USE(GRAPHICS_SURFACE) >+ if (state.canvasChanged) { >+ encoder << state.canvasSize; >+ encoder << state.canvasToken; >+ encoder << state.canvasFrontBuffer; >+ } >+#endif >+} >+ >+bool ArgumentCoder<CoordinatedGraphicsLayerState>::decode(ArgumentDecoder& decoder, CoordinatedGraphicsLayerState& state) >+{ >+ if (!decoder.decode(state.changeMask)) >+ return false; >+ >+ if (!decodeLayerStateIfNeeded(decoder, state.flags, state.flagsChanged)) >+ return false; >+ >+ if (!decodeLayerStateIfNeeded(decoder, state.pos, state.positionChanged)) >+ return false; >+ >+ if (!decodeLayerStateIfNeeded(decoder, state.anchorPoint, state.anchorPointChanged)) >+ return false; >+ >+ if (!decodeLayerStateIfNeeded(decoder, state.size, state.sizeChanged)) >+ return false; >+ >+ if (!decodeLayerStateIfNeeded(decoder, state.transform, state.transformChanged)) >+ return false; >+ >+ if (!decodeLayerStateIfNeeded(decoder, state.childrenTransform, state.childrenTransformChanged)) >+ return false; >+ >+ if (!decodeLayerStateIfNeeded(decoder, state.contentsRect, state.contentsRectChanged)) >+ return false; >+ >+ if (!decodeLayerStateIfNeeded(decoder, state.opacity, state.opacityChanged)) >+ return false; >+ >+ if (!decodeLayerStateIfNeeded(decoder, state.solidColor, state.solidColorChanged)) >+ return false; >+ >+ if (!decodeLayerStateIfNeeded(decoder, state.debugBorderColor, state.debugBorderColorChanged)) >+ return false; >+ >+ if (!decodeLayerStateIfNeeded(decoder, state.debugBorderWidth, state.debugBorderWidthChanged)) >+ return false; >+ >+#if ENABLE(CSS_FILTERS) >+ if (!decodeLayerStateIfNeeded(decoder, state.filters, state.filtersChanged)) >+ return false; >+#endif >+ >+ if (!decodeLayerStateIfNeeded(decoder, state.animations, state.animationsChanged)) >+ return false; >+ >+ if (!decodeLayerStateIfNeeded(decoder, state.children, state.childrenChanged)) >+ return false; >+ >+ if (!decoder.decode(state.tilesToCreate)) >+ return false; >+ >+ if (!decoder.decode(state.tilesToRemove)) >+ return false; >+ >+ if (!decodeLayerStateIfNeeded(decoder, state.replica, state.replicaChanged)) >+ return false; >+ >+ if (!decodeLayerStateIfNeeded(decoder, state.mask, state.maskChanged)) >+ return false; >+ >+ if (!decodeLayerStateIfNeeded(decoder, state.imageID, state.imageChanged)) >+ return false; >+ >+ if (!decodeLayerStateIfNeeded(decoder, state.repaintCount, state.repaintCountChanged)) >+ return false; >+ >+ if (!decoder.decode(state.tilesToUpdate)) >+ return false; >+ >+#if USE(GRAPHICS_SURFACE) >+ if (!decoder.decode(state.canvasSize)) >+ return false; >+ >+ if (!decoder.decode(state.canvasToken)) >+ return false; >+ >+ if (!decoder.decode(state.canvasFrontBuffer)) >+ return false; >+#endif >+ >+ return true; >+} >+ >+void ArgumentCoder<TileUpdateInfo>::encode(ArgumentEncoder& encoder, const TileUpdateInfo& updateInfo) >+{ >+ SimpleArgumentCoder<TileUpdateInfo>::encode(encoder, updateInfo); >+} >+ >+bool ArgumentCoder<TileUpdateInfo>::decode(ArgumentDecoder& decoder, TileUpdateInfo& updateInfo) >+{ >+ return SimpleArgumentCoder<TileUpdateInfo>::decode(decoder, updateInfo); >+} >+ >+void ArgumentCoder<CoordinatedGraphicsState>::encode(ArgumentEncoder& encoder, const CoordinatedGraphicsState& state) >+{ >+ encoder << state.rootCompositingLayer; >+ encoder << state.backgroundColor; >+ encoder << state.scrollPosition; >+ encoder << state.contentsSize; >+ encoder << state.coveredRect; >+ encoder << state.layersToUpdate; >+ >+ // We need to encode WebCoordinatedSurface::Handle right after it's creation. >+ // That's why we cannot use simple std::pair encoder. >+ encoder << state.imagesToUpdate.size(); >+ >+ typedef Vector<std::pair<CoordinatedImageBackingID, RefPtr<CoordinatedSurface> > > SurfaceUpdatePairVector; >+ SurfaceUpdatePairVector::const_iterator end = state.imagesToUpdate.end(); >+ for (SurfaceUpdatePairVector::const_iterator iter = state.imagesToUpdate.begin(); iter != end; ++iter) { >+ >+ WebCoordinatedSurface* webCoordinatedSurface = static_cast<WebCoordinatedSurface*>(iter->second.get()); >+ WebCoordinatedSurface::Handle handle; >+ if (!webCoordinatedSurface->createHandle(handle)) >+ return; >+ >+ encoder << iter->first; >+ encoder << handle; >+ } >+} >+ >+bool ArgumentCoder<CoordinatedGraphicsState>::decode(ArgumentDecoder& decoder, CoordinatedGraphicsState& state) >+{ >+ if (!decoder.decode(state.rootCompositingLayer)) >+ return false; >+ >+ if (!decoder.decode(state.backgroundColor)) >+ return false; >+ >+ if (!decoder.decode(state.scrollPosition)) >+ return false; >+ >+ if (!decoder.decode(state.contentsSize)) >+ return false; >+ >+ if (!decoder.decode(state.coveredRect)) >+ return false; >+ >+ if (!decoder.decode(state.layersToUpdate)) >+ return false; >+ >+ size_t sizeOfImagesToUpdate; >+ if (!decoder.decode(sizeOfImagesToUpdate)) >+ return false; >+ >+ for (size_t i = 0; i < sizeOfImagesToUpdate; i++) { >+ CoordinatedImageBackingID imageID; >+ if (!decoder.decode(imageID)) >+ return false; >+ >+ WebCoordinatedSurface::Handle handle; >+ if (!decoder.decode(handle)) >+ return false; >+ >+ RefPtr<CoordinatedSurface> surface = WebCoordinatedSurface::create(handle); >+ state.imagesToUpdate.append(std::make_pair(imageID, surface.release())); >+ } >+ >+ return true; > } > > } // namespace CoreIPC >diff --git a/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.h b/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.h >index 8e7deef..e5c2466 100644 >--- a/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.h >+++ b/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.h >@@ -32,13 +32,15 @@ > #include "ArgumentCoders.h" > > namespace WebCore { >+struct CoordinatedGraphicsLayerState; >+struct CoordinatedGraphicsState; > class FloatPoint3D; > class GraphicsLayerAnimation; > class GraphicsLayerAnimations; > class SurfaceUpdateInfo; >+struct TileUpdateInfo; > class TransformationMatrix; > class TransformOperations; >-struct CoordinatedLayerInfo; > struct Length; > > #if ENABLE(CSS_FILTERS) >@@ -107,16 +109,26 @@ template<> struct ArgumentCoder<WebCore::GraphicsSurfaceToken> { > }; > #endif > >-template<> struct ArgumentCoder<WebCore::CoordinatedLayerInfo> { >- static void encode(ArgumentEncoder&, const WebCore::CoordinatedLayerInfo&); >- static bool decode(ArgumentDecoder&, WebCore::CoordinatedLayerInfo&); >-}; >- > template<> struct ArgumentCoder<WebCore::SurfaceUpdateInfo> { > static void encode(ArgumentEncoder&, const WebCore::SurfaceUpdateInfo&); > static bool decode(ArgumentDecoder&, WebCore::SurfaceUpdateInfo&); > }; > >+template<> struct ArgumentCoder<WebCore::CoordinatedGraphicsLayerState> { >+ static void encode(ArgumentEncoder&, const WebCore::CoordinatedGraphicsLayerState&); >+ static bool decode(ArgumentDecoder&, WebCore::CoordinatedGraphicsLayerState&); >+}; >+ >+template<> struct ArgumentCoder<WebCore::TileUpdateInfo> { >+ static void encode(ArgumentEncoder&, const WebCore::TileUpdateInfo&); >+ static bool decode(ArgumentDecoder&, WebCore::TileUpdateInfo&); >+}; >+ >+template<> struct ArgumentCoder<WebCore::CoordinatedGraphicsState> { >+ static void encode(ArgumentEncoder&, const WebCore::CoordinatedGraphicsState&); >+ static bool decode(ArgumentDecoder&, WebCore::CoordinatedGraphicsState&); >+}; >+ > } // namespace CoreIPC > > #endif // USE(COORDINATED_GRAPHICS) >diff --git a/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.cpp b/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.cpp >index c5f7e87..33b4048 100644 >--- a/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.cpp >+++ b/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.cpp >@@ -27,7 +27,7 @@ > #include "WebCoreArgumentCoders.h" > #include "WebPageProxy.h" > #include "WebProcessProxy.h" >-#include <WebCore/CoordinatedLayerInfo.h> >+#include <WebCore/CoordinatedGraphicsState.h> > #include <WebCore/GraphicsSurface.h> > #include <WebCore/SurfaceUpdateInfo.h> > >@@ -62,22 +62,6 @@ void CoordinatedLayerTreeHostProxy::dispatchUpdate(const Function<void()>& funct > m_scene->appendUpdate(function); > } > >-void CoordinatedLayerTreeHostProxy::createTileForLayer(CoordinatedLayerID layerID, uint32_t tileID, const IntRect& tileRect, const SurfaceUpdateInfo& updateInfo) >-{ >- dispatchUpdate(bind(&CoordinatedGraphicsScene::createTile, m_scene.get(), layerID, tileID, updateInfo.scaleFactor)); >- updateTileForLayer(layerID, tileID, tileRect, updateInfo); >-} >- >-void CoordinatedLayerTreeHostProxy::updateTileForLayer(CoordinatedLayerID layerID, uint32_t tileID, const IntRect& tileRect, const SurfaceUpdateInfo& updateInfo) >-{ >- dispatchUpdate(bind(&CoordinatedGraphicsScene::updateTile, m_scene.get(), layerID, tileID, CoordinatedGraphicsScene::TileUpdate(updateInfo.updateRect, tileRect, updateInfo.atlasID, updateInfo.surfaceOffset))); >-} >- >-void CoordinatedLayerTreeHostProxy::removeTileForLayer(CoordinatedLayerID layerID, uint32_t tileID) >-{ >- dispatchUpdate(bind(&CoordinatedGraphicsScene::removeTile, m_scene.get(), layerID, tileID)); >-} >- > void CoordinatedLayerTreeHostProxy::createUpdateAtlas(uint32_t atlasID, const WebCoordinatedSurface::Handle& handle) > { > dispatchUpdate(bind(&CoordinatedGraphicsScene::createUpdateAtlas, m_scene.get(), atlasID, WebCoordinatedSurface::create(handle))); >@@ -103,23 +87,6 @@ void CoordinatedLayerTreeHostProxy::setRootCompositingLayer(CoordinatedLayerID i > dispatchUpdate(bind(&CoordinatedGraphicsScene::setRootLayerID, m_scene.get(), id)); > } > >-void CoordinatedLayerTreeHostProxy::setCompositingLayerState(CoordinatedLayerID id, const CoordinatedLayerInfo& info) >-{ >- dispatchUpdate(bind(&CoordinatedGraphicsScene::setLayerState, m_scene.get(), id, info)); >-} >- >-void CoordinatedLayerTreeHostProxy::setCompositingLayerChildren(CoordinatedLayerID id, const Vector<CoordinatedLayerID>& children) >-{ >- dispatchUpdate(bind(&CoordinatedGraphicsScene::setLayerChildren, m_scene.get(), id, children)); >-} >- >-#if ENABLE(CSS_FILTERS) >-void CoordinatedLayerTreeHostProxy::setCompositingLayerFilters(CoordinatedLayerID id, const FilterOperations& filters) >-{ >- dispatchUpdate(bind(&CoordinatedGraphicsScene::setLayerFilters, m_scene.get(), id, filters)); >-} >-#endif >- > #if ENABLE(CSS_SHADERS) > void CoordinatedLayerTreeHostProxy::removeCustomFilterProgram(int id) > { >@@ -131,15 +98,12 @@ void CoordinatedLayerTreeHostProxy::createCustomFilterProgram(int id, const Cust > } > #endif > >-void CoordinatedLayerTreeHostProxy::didRenderFrame(const FloatPoint& scrollPosition, const IntSize& contentsSize, const IntRect& coveredRect) >+void CoordinatedLayerTreeHostProxy::didRenderFrame(const CoordinatedGraphicsState& graphicsState) > { >- dispatchUpdate(bind(&CoordinatedGraphicsScene::flushLayerChanges, m_scene.get(), scrollPosition)); >+ dispatchUpdate(bind(&CoordinatedGraphicsScene::flushLayerChanges, m_scene.get(), graphicsState)); > updateViewport(); > #if USE(TILED_BACKING_STORE) >- m_drawingAreaProxy->page()->didRenderFrame(contentsSize, coveredRect); >-#else >- UNUSED_PARAM(contentsSize); >- UNUSED_PARAM(coveredRect); >+ m_drawingAreaProxy->page()->didRenderFrame(graphicsState.contentsSize, graphicsState.coveredRect); > #endif > } > >@@ -163,11 +127,6 @@ void CoordinatedLayerTreeHostProxy::removeImageBacking(CoordinatedImageBackingID > dispatchUpdate(bind(&CoordinatedGraphicsScene::removeImageBacking, m_scene.get(), imageID)); > } > >-void CoordinatedLayerTreeHostProxy::setLayerAnimations(CoordinatedLayerID id, const GraphicsLayerAnimations& animations) >-{ >- dispatchUpdate(bind(&CoordinatedGraphicsScene::setLayerAnimations, m_scene.get(), id, animations)); >-} >- > void CoordinatedLayerTreeHostProxy::setAnimationsLocked(bool locked) > { > dispatchUpdate(bind(&CoordinatedGraphicsScene::setAnimationsLocked, m_scene.get(), locked)); >@@ -204,29 +163,6 @@ void CoordinatedLayerTreeHostProxy::animationFrameReady() > } > #endif > >-#if USE(GRAPHICS_SURFACE) >-void CoordinatedLayerTreeHostProxy::createCanvas(CoordinatedLayerID id, const IntSize& canvasSize, const GraphicsSurfaceToken& token) >-{ >- GraphicsSurface::Flags surfaceFlags = GraphicsSurface::SupportsTextureTarget | GraphicsSurface::SupportsSharing; >- dispatchUpdate(bind(&CoordinatedGraphicsScene::createCanvas, m_scene.get(), id, canvasSize, GraphicsSurface::create(canvasSize, surfaceFlags, token))); >-} >- >-void CoordinatedLayerTreeHostProxy::syncCanvas(CoordinatedLayerID id, uint32_t frontBuffer) >-{ >- dispatchUpdate(bind(&CoordinatedGraphicsScene::syncCanvas, m_scene.get(), id, frontBuffer)); >-} >- >-void CoordinatedLayerTreeHostProxy::destroyCanvas(CoordinatedLayerID id) >-{ >- dispatchUpdate(bind(&CoordinatedGraphicsScene::destroyCanvas, m_scene.get(), id)); >-} >-#endif >- >-void CoordinatedLayerTreeHostProxy::setLayerRepaintCount(CoordinatedLayerID id, int value) >-{ >- dispatchUpdate(bind(&CoordinatedGraphicsScene::setLayerRepaintCount, m_scene.get(), id, value)); >-} >- > void CoordinatedLayerTreeHostProxy::purgeBackingStores() > { > m_drawingAreaProxy->page()->process()->send(Messages::CoordinatedLayerTreeHost::PurgeBackingStores(), m_drawingAreaProxy->page()->pageID()); >diff --git a/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.h b/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.h >index 946b399..f79f928 100644 >--- a/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.h >+++ b/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.h >@@ -41,7 +41,8 @@ > #include <wtf/Vector.h> > > namespace WebCore { >-class CoordinatedLayerInfo; >+class CoordinatedGraphicsLayerState; >+class CoordinatedGraphicsState; > class SurfaceUpdateInfo; > } > >@@ -53,43 +54,32 @@ class CoordinatedLayerTreeHostProxy : public WebCore::CoordinatedGraphicsSceneCl > public: > explicit CoordinatedLayerTreeHostProxy(DrawingAreaProxy*); > virtual ~CoordinatedLayerTreeHostProxy(); >- void setCompositingLayerState(WebCore::CoordinatedLayerID, const WebCore::CoordinatedLayerInfo&); >- void setCompositingLayerChildren(WebCore::CoordinatedLayerID, const Vector<WebCore::CoordinatedLayerID>&); >-#if ENABLE(CSS_FILTERS) >- void setCompositingLayerFilters(WebCore::CoordinatedLayerID, const WebCore::FilterOperations&); >-#endif >+ >+ // Messages From CoordinatedLayerTreeHost >+ void setRootCompositingLayer(WebCore::CoordinatedLayerID); >+ void createCompositingLayers(const Vector<WebCore::CoordinatedLayerID>&); >+ void deleteCompositingLayers(const Vector<WebCore::CoordinatedLayerID>&); > #if ENABLE(CSS_SHADERS) > void createCustomFilterProgram(int id, const WebCore::CustomFilterProgramInfo&); > void removeCustomFilterProgram(int id); > #endif >- void createCompositingLayers(const Vector<WebCore::CoordinatedLayerID>&); >- void deleteCompositingLayers(const Vector<WebCore::CoordinatedLayerID>&); >- void setRootCompositingLayer(WebCore::CoordinatedLayerID); >- void setVisibleContentsRect(const WebCore::FloatRect&, const WebCore::FloatPoint& trajectoryVector); >- void didRenderFrame(const WebCore::FloatPoint& scrollPosition, const WebCore::IntSize& contentsSize, const WebCore::IntRect& coveredRect); >- void createTileForLayer(WebCore::CoordinatedLayerID, uint32_t tileID, const WebCore::IntRect&, const WebCore::SurfaceUpdateInfo&); >- void updateTileForLayer(WebCore::CoordinatedLayerID, uint32_t tileID, const WebCore::IntRect&, const WebCore::SurfaceUpdateInfo&); >- void removeTileForLayer(WebCore::CoordinatedLayerID, uint32_t tileID); > void createUpdateAtlas(uint32_t atlasID, const WebCoordinatedSurface::Handle&); > void removeUpdateAtlas(uint32_t atlasID); > void createImageBacking(WebCore::CoordinatedImageBackingID); > void updateImageBacking(WebCore::CoordinatedImageBackingID, const WebCoordinatedSurface::Handle&); > void clearImageBackingContents(WebCore::CoordinatedImageBackingID); > void removeImageBacking(WebCore::CoordinatedImageBackingID); >-#if USE(GRAPHICS_SURFACE) >- void createCanvas(WebCore::CoordinatedLayerID, const WebCore::IntSize&, const WebCore::GraphicsSurfaceToken&); >- void syncCanvas(WebCore::CoordinatedLayerID, uint32_t frontBuffer); >- void destroyCanvas(WebCore::CoordinatedLayerID); >-#endif >- void setLayerRepaintCount(WebCore::CoordinatedLayerID, int value); >- WebCore::CoordinatedGraphicsScene* coordinatedGraphicsScene() const { return m_scene.get(); } >- void setLayerAnimations(WebCore::CoordinatedLayerID, const WebCore::GraphicsLayerAnimations&); >+ >+ void didRenderFrame(const WebCore::CoordinatedGraphicsState&); > void setAnimationsLocked(bool); > #if ENABLE(REQUEST_ANIMATION_FRAME) > void requestAnimationFrame(); > #endif > void setBackgroundColor(const WebCore::Color&); > >+ void setVisibleContentsRect(const WebCore::FloatRect&, const WebCore::FloatPoint& trajectoryVector); >+ WebCore::CoordinatedGraphicsScene* coordinatedGraphicsScene() const { return m_scene.get(); } >+ > // CoordinatedGraphicsSceneClient Methods. > #if ENABLE(REQUEST_ANIMATION_FRAME) > virtual void animationFrameReady() OVERRIDE; >diff --git a/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.messages.in b/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.messages.in >index 5ce1283..b64c31a 100644 >--- a/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.messages.in >+++ b/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.messages.in >@@ -19,43 +19,29 @@ > > #if USE(COORDINATED_GRAPHICS) > messages -> CoordinatedLayerTreeHostProxy { >- SetCompositingLayerState(uint32_t id, WebCore::CoordinatedLayerInfo layerInfo) >- SetCompositingLayerChildren(uint32_t id, Vector<uint32_t> children) >-#if ENABLE(CSS_FILTERS) >- SetCompositingLayerFilters(uint32_t id, WebCore::FilterOperations filters) >-#endif >+ >+ SetRootCompositingLayer(uint32_t id) >+ CreateCompositingLayers(Vector<uint32_t> ids) >+ DeleteCompositingLayers(Vector<uint32_t> ids) >+ > #if ENABLE(CSS_SHADERS) > CreateCustomFilterProgram(int id, WebCore::CustomFilterProgramInfo programInfo) > RemoveCustomFilterProgram(int id) > #endif >- SetRootCompositingLayer(uint32_t id) >- CreateCompositingLayers(Vector<uint32_t> ids) >- DeleteCompositingLayers(Vector<uint32_t> ids) >- CreateTileForLayer(uint32_t layerID, uint32_t tileID, WebCore::IntRect tileRect, WebCore::SurfaceUpdateInfo updateInfo) >- UpdateTileForLayer(uint32_t layerID, uint32_t tileID, WebCore::IntRect tileRect, WebCore::SurfaceUpdateInfo updateInfo) >- RemoveTileForLayer(uint32_t layerID, uint32_t tileID) > CreateUpdateAtlas(uint32_t atlasID, WebKit::WebCoordinatedSurface::Handle handle) > RemoveUpdateAtlas(uint32_t atlasID) > CreateImageBacking(uint64_t imageID) > UpdateImageBacking(uint64_t imageID, WebKit::WebCoordinatedSurface::Handle handle) > ClearImageBackingContents(uint64_t imageID) > RemoveImageBacking(uint64_t imageID) >- DidRenderFrame(WebCore::FloatPoint scrollPosition, WebCore::IntSize contentsSize, WebCore::IntRect coveredRect) >- SetLayerAnimations(uint32_t id, WebCore::GraphicsLayerAnimations animations) >+ >+ DidRenderFrame(WebCore::CoordinatedGraphicsState state) > SetAnimationsLocked(bool locked) > > #if ENABLE(REQUEST_ANIMATION_FRAME) > RequestAnimationFrame() > #endif > >-#if USE(GRAPHICS_SURFACE) >- CreateCanvas(uint32_t id, WebCore::IntSize canvasSize, WebCore::GraphicsSurfaceToken token) >- SyncCanvas(uint32_t id, uint32_t frontBuffer) >- DestroyCanvas(uint32_t id) >-#endif >- >- SetLayerRepaintCount(uint32_t layerID, int value) >- > SetBackgroundColor(WebCore::Color color) > } > #endif >diff --git a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp b/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp >index 0dd2817..9603456 100644 >--- a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp >+++ b/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp >@@ -298,9 +298,15 @@ bool CoordinatedLayerTreeHost::flushPendingLayerChanges() > if (m_shouldSyncFrame) { > didSync = true; > >- IntSize contentsSize = roundedIntSize(m_nonCompositedContentLayer->size()); >- IntRect coveredRect = toCoordinatedGraphicsLayer(m_nonCompositedContentLayer.get())->coverRect(); >- m_webPage->send(Messages::CoordinatedLayerTreeHostProxy::DidRenderFrame(m_visibleContentsRect.location(), contentsSize, coveredRect)); >+ m_state.contentsSize = roundedIntSize(m_nonCompositedContentLayer->size()); >+ m_state.coveredRect = toCoordinatedGraphicsLayer(m_nonCompositedContentLayer.get())->coverRect(); >+ m_state.scrollPosition = m_visibleContentsRect.location(); >+ >+ m_webPage->send(Messages::CoordinatedLayerTreeHostProxy::DidRenderFrame(m_state)); >+ >+ m_state.layersToUpdate.clear(); >+ m_state.imagesToUpdate.clear(); >+ > m_waitingForUIProcess = true; > m_shouldSyncFrame = false; > } else >@@ -353,64 +359,54 @@ void CoordinatedLayerTreeHost::initializeRootCompositingLayerIfNeeded() > if (m_didInitializeRootCompositingLayer) > return; > >- m_webPage->send(Messages::CoordinatedLayerTreeHostProxy::SetRootCompositingLayer(toCoordinatedGraphicsLayer(m_rootLayer.get())->id())); >+ m_state.rootCompositingLayer = toCoordinatedGraphicsLayer(m_rootLayer.get())->id(); > m_didInitializeRootCompositingLayer = true; > m_shouldSyncFrame = true; > } > >-void CoordinatedLayerTreeHost::syncLayerState(CoordinatedLayerID id, const CoordinatedLayerInfo& info) >+void CoordinatedLayerTreeHost::syncLayerState(CoordinatedLayerID id, CoordinatedGraphicsLayerState& state) > { > m_shouldSyncFrame = true; >- m_webPage->send(Messages::CoordinatedLayerTreeHostProxy::SetCompositingLayerState(id, info)); >+ preprocessStateChange(state); >+ m_state.layersToUpdate.append(std::make_pair(id, state)); > } > >-void CoordinatedLayerTreeHost::syncLayerChildren(CoordinatedLayerID id, const Vector<CoordinatedLayerID>& children) >+void CoordinatedLayerTreeHost::preprocessStateChange(CoordinatedGraphicsLayerState& state) > { >- m_shouldSyncFrame = true; >- m_webPage->send(Messages::CoordinatedLayerTreeHostProxy::SetCompositingLayerChildren(id, children)); >+ preprocessAnimationStateIfNeeded(state); >+ preprocessFilterOperationsIfNeeded(state); > } > >-#if USE(GRAPHICS_SURFACE) >-void CoordinatedLayerTreeHost::createCanvas(CoordinatedLayerID id, PlatformLayer* canvasPlatformLayer) >+void CoordinatedLayerTreeHost::preprocessAnimationStateIfNeeded(CoordinatedGraphicsLayerState& state) > { >- m_shouldSyncFrame = true; >- GraphicsSurfaceToken token = canvasPlatformLayer->graphicsSurfaceToken(); >- IntSize canvasSize = canvasPlatformLayer->platformLayerSize(); >- m_webPage->send(Messages::CoordinatedLayerTreeHostProxy::CreateCanvas(id, canvasSize, token)); >-} >- >-void CoordinatedLayerTreeHost::syncCanvas(CoordinatedLayerID id, PlatformLayer* canvasPlatformLayer) >-{ >- m_shouldSyncFrame = true; >- uint32_t frontBuffer = canvasPlatformLayer->copyToGraphicsSurface(); >- m_webPage->send(Messages::CoordinatedLayerTreeHostProxy::SyncCanvas(id, frontBuffer)); >-} >- >-void CoordinatedLayerTreeHost::destroyCanvas(CoordinatedLayerID id) >-{ >- if (m_isPurging) >+ if (!state.animationsChanged) > return; > >- m_shouldSyncFrame = true; >- m_webPage->send(Messages::CoordinatedLayerTreeHostProxy::DestroyCanvas(id)); >-} >+ WebCore::GraphicsLayerAnimations& animations = state.animations; >+ GraphicsLayerAnimations activeAnimations = animations.getActiveAnimations(); >+#if ENABLE(CSS_SHADERS) >+ for (size_t i = 0; i < activeAnimations.animations().size(); ++i) { >+ const KeyframeValueList& keyframes = animations.animations().at(i).keyframes(); >+ if (keyframes.property() != AnimatedPropertyWebkitFilter) >+ continue; >+ for (size_t j = 0; j < keyframes.size(); ++j) { >+ const FilterAnimationValue* filterValue = static_cast<const FilterAnimationValue*>(keyframes.at(i)); >+ checkCustomFilterProgramProxies(*filterValue->value()); >+ } >+ } > #endif >- >-void CoordinatedLayerTreeHost::setLayerRepaintCount(CoordinatedLayerID id, int value) >-{ >- m_webPage->send(Messages::CoordinatedLayerTreeHostProxy::SetLayerRepaintCount(id, value)); >+ state.animations = activeAnimations; > } > >-#if ENABLE(CSS_FILTERS) >-void CoordinatedLayerTreeHost::syncLayerFilters(CoordinatedLayerID id, const FilterOperations& filters) >+void CoordinatedLayerTreeHost::preprocessFilterOperationsIfNeeded(CoordinatedGraphicsLayerState& state) > { >- m_shouldSyncFrame = true; > #if ENABLE(CSS_SHADERS) >- checkCustomFilterProgramProxies(filters); >+ if (!state.filtersChanged) >+ return; >+ >+ checkCustomFilterProgramProxies(state.filters); > #endif >- m_webPage->send(Messages::CoordinatedLayerTreeHostProxy::SetCompositingLayerFilters(id, filters)); > } >-#endif > > #if ENABLE(CSS_SHADERS) > void CoordinatedLayerTreeHost::checkCustomFilterProgramProxies(const FilterOperations& filters) >@@ -582,7 +578,8 @@ bool CoordinatedLayerTreeHost::updateImageBacking(CoordinatedImageBackingID imag > WebCoordinatedSurface::Handle handle; > if (!webCoordinatedSurface->createHandle(handle)) > return false; >- m_webPage->send(Messages::CoordinatedLayerTreeHostProxy::UpdateImageBacking(imageID, handle)); >+ >+ m_state.imagesToUpdate.append(std::make_pair(imageID, coordinatedSurface)); > return true; > } > >@@ -665,26 +662,6 @@ bool LayerTreeHost::supportsAcceleratedCompositing() > return true; > } > >-void CoordinatedLayerTreeHost::createTile(CoordinatedLayerID layerID, uint32_t tileID, const WebCore::SurfaceUpdateInfo& updateInfo, const WebCore::IntRect& tileRect) >-{ >- m_shouldSyncFrame = true; >- m_webPage->send(Messages::CoordinatedLayerTreeHostProxy::CreateTileForLayer(layerID, tileID, tileRect, updateInfo)); >-} >- >-void CoordinatedLayerTreeHost::updateTile(CoordinatedLayerID layerID, uint32_t tileID, const WebCore::SurfaceUpdateInfo& updateInfo, const WebCore::IntRect& tileRect) >-{ >- m_shouldSyncFrame = true; >- m_webPage->send(Messages::CoordinatedLayerTreeHostProxy::UpdateTileForLayer(layerID, tileID, tileRect, updateInfo)); >-} >- >-void CoordinatedLayerTreeHost::removeTile(CoordinatedLayerID layerID, uint32_t tileID) >-{ >- if (m_isPurging) >- return; >- m_shouldSyncFrame = true; >- m_webPage->send(Messages::CoordinatedLayerTreeHostProxy::RemoveTileForLayer(layerID, tileID)); >-} >- > bool CoordinatedLayerTreeHost::createUpdateAtlas(uint32_t atlasID, PassRefPtr<CoordinatedSurface> coordinatedSurface) > { > WebCoordinatedSurface* webCoordinatedSurface = static_cast<WebCoordinatedSurface*>(coordinatedSurface.get()); >@@ -707,25 +684,6 @@ WebCore::FloatRect CoordinatedLayerTreeHost::visibleContentsRect() const > return m_visibleContentsRect; > } > >- >-void CoordinatedLayerTreeHost::setLayerAnimations(CoordinatedLayerID layerID, const GraphicsLayerAnimations& animations) >-{ >- m_shouldSyncFrame = true; >- GraphicsLayerAnimations activeAnimations = animations.getActiveAnimations(); >-#if ENABLE(CSS_SHADERS) >- for (size_t i = 0; i < activeAnimations.animations().size(); ++i) { >- const KeyframeValueList& keyframes = animations.animations().at(i).keyframes(); >- if (keyframes.property() != AnimatedPropertyWebkitFilter) >- continue; >- for (size_t j = 0; j < keyframes.size(); ++j) { >- const FilterAnimationValue* filterValue = static_cast<const FilterAnimationValue*>(keyframes.at(i)); >- checkCustomFilterProgramProxies(*filterValue->value()); >- } >- } >-#endif >- m_webPage->send(Messages::CoordinatedLayerTreeHostProxy::SetLayerAnimations(layerID, activeAnimations)); >-} >- > void CoordinatedLayerTreeHost::setVisibleContentsRect(const FloatRect& rect, const FloatPoint& trajectoryVector) > { > // A zero trajectoryVector indicates that tiles all around the viewport are requested. >@@ -848,7 +806,8 @@ void CoordinatedLayerTreeHost::releaseInactiveAtlasesTimerFired(Timer<Coordinate > > void CoordinatedLayerTreeHost::setBackgroundColor(const WebCore::Color& color) > { >- m_webPage->send(Messages::CoordinatedLayerTreeHostProxy::SetBackgroundColor(color)); >+ m_shouldSyncFrame = true; >+ m_state.backgroundColor = color; > } > > } // namespace WebKit >diff --git a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h b/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h >index 8446f6f..c19d129 100644 >--- a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h >+++ b/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h >@@ -26,6 +26,7 @@ > #include "LayerTreeHost.h" > #include "Timer.h" > #include <WebCore/CoordinatedGraphicsLayer.h> >+#include <WebCore/CoordinatedGraphicsState.h> > #include <WebCore/CoordinatedImageBacking.h> > #include <WebCore/GraphicsLayerClient.h> > #include <WebCore/GraphicsLayerFactory.h> >@@ -46,8 +47,8 @@ class WebPage; > > class CoordinatedLayerTreeHost : public LayerTreeHost, WebCore::GraphicsLayerClient > , public WebCore::CoordinatedGraphicsLayerClient >- , public WebCore::CoordinatedImageBacking::Coordinator >- , public WebCore::UpdateAtlasClient >+ , public WebCore::CoordinatedImageBacking::Coordinator // TODO : REMOVE THIS >+ , public WebCore::UpdateAtlasClient // TODO : REMOVE THIS > , public WebCore::GraphicsLayerFactory > #if ENABLE(CSS_SHADERS) > , WebCustomFilterProgramProxyClient >@@ -80,39 +81,14 @@ public: > virtual void pauseRendering() { m_isSuspended = true; } > virtual void resumeRendering() { m_isSuspended = false; scheduleLayerFlush(); } > virtual void deviceOrPageScaleFactorChanged() OVERRIDE; >- virtual PassRefPtr<WebCore::CoordinatedImageBacking> createImageBackingIfNeeded(WebCore::Image*) OVERRIDE; > >- virtual bool isFlushingLayerChanges() const OVERRIDE { return m_isFlushingLayerChanges; } >- virtual void createTile(WebCore::CoordinatedLayerID, uint32_t tileID, const WebCore::SurfaceUpdateInfo&, const WebCore::IntRect&); >- virtual void updateTile(WebCore::CoordinatedLayerID, uint32_t tileID, const WebCore::SurfaceUpdateInfo&, const WebCore::IntRect&); >- virtual void removeTile(WebCore::CoordinatedLayerID, uint32_t tileID); >- virtual WebCore::FloatRect visibleContentsRect() const; > virtual void renderNextFrame(); > virtual void purgeBackingStores(); > virtual void setVisibleContentsRect(const WebCore::FloatRect&, const WebCore::FloatPoint&); >+ > virtual void didReceiveCoordinatedLayerTreeHostMessage(CoreIPC::Connection*, CoreIPC::MessageDecoder&); > virtual WebCore::GraphicsLayerFactory* graphicsLayerFactory() OVERRIDE; > >- virtual void syncLayerState(WebCore::CoordinatedLayerID, const WebCore::CoordinatedLayerInfo&); >- virtual void syncLayerChildren(WebCore::CoordinatedLayerID, const Vector<WebCore::CoordinatedLayerID>&); >- virtual void setLayerAnimations(WebCore::CoordinatedLayerID, const WebCore::GraphicsLayerAnimations&); >-#if ENABLE(CSS_FILTERS) >- virtual void syncLayerFilters(WebCore::CoordinatedLayerID, const WebCore::FilterOperations&); >-#endif >-#if USE(GRAPHICS_SURFACE) >- virtual void createCanvas(WebCore::CoordinatedLayerID, WebCore::PlatformLayer*) OVERRIDE; >- virtual void syncCanvas(WebCore::CoordinatedLayerID, WebCore::PlatformLayer*) OVERRIDE; >- virtual void destroyCanvas(WebCore::CoordinatedLayerID) OVERRIDE; >-#endif >- virtual void setLayerRepaintCount(WebCore::CoordinatedLayerID, int) OVERRIDE; >- virtual void detachLayer(WebCore::CoordinatedGraphicsLayer*); >- >- virtual PassOwnPtr<WebCore::GraphicsContext> beginContentUpdate(const WebCore::IntSize&, WebCore::CoordinatedSurface::Flags, uint32_t& atlasID, WebCore::IntPoint&); >- >- // UpdateAtlasClient >- virtual bool createUpdateAtlas(uint32_t atlasID, PassRefPtr<WebCore::CoordinatedSurface>) OVERRIDE; >- virtual void removeUpdateAtlas(uint32_t atlasID); >- > #if ENABLE(REQUEST_ANIMATION_FRAME) > virtual void scheduleAnimation() OVERRIDE; > #endif >@@ -139,6 +115,18 @@ private: > > void flushPendingImageBackingChanges(); > >+ // CoordinatedGraphicsLayerClient >+ virtual bool isFlushingLayerChanges() const OVERRIDE { return m_isFlushingLayerChanges; } >+ virtual WebCore::FloatRect visibleContentsRect() const; >+ virtual PassRefPtr<WebCore::CoordinatedImageBacking> createImageBackingIfNeeded(WebCore::Image*) OVERRIDE; >+ virtual void detachLayer(WebCore::CoordinatedGraphicsLayer*); >+ virtual PassOwnPtr<WebCore::GraphicsContext> beginContentUpdate(const WebCore::IntSize&, WebCore::CoordinatedSurface::Flags, uint32_t& atlasID, WebCore::IntPoint&); >+ virtual void syncLayerState(WebCore::CoordinatedLayerID, WebCore::CoordinatedGraphicsLayerState&); >+ >+ // UpdateAtlasClient >+ virtual bool createUpdateAtlas(uint32_t atlasID, PassRefPtr<WebCore::CoordinatedSurface>) OVERRIDE; >+ virtual void removeUpdateAtlas(uint32_t atlasID); >+ > // GraphicsLayerFactory > virtual PassOwnPtr<WebCore::GraphicsLayer> createGraphicsLayer(WebCore::GraphicsLayerClient*) OVERRIDE; > >@@ -156,6 +144,10 @@ private: > void lockAnimations(); > void unlockAnimations(); > >+ void preprocessStateChange(WebCore::CoordinatedGraphicsLayerState&); >+ void preprocessAnimationStateIfNeeded(WebCore::CoordinatedGraphicsLayerState&); >+ void preprocessFilterOperationsIfNeeded(WebCore::CoordinatedGraphicsLayerState&); >+ > void layerFlushTimerFired(WebCore::Timer<CoordinatedLayerTreeHost>*); > > void scheduleReleaseInactiveAtlases(); >@@ -181,6 +173,8 @@ private: > // The page overlay layer. Will be null if there's no page overlay. > OwnPtr<WebCore::GraphicsLayer> m_pageOverlayLayer; > >+ WebCore::CoordinatedGraphicsState m_state; >+ > HashSet<WebCore::CoordinatedGraphicsLayer*> m_registeredLayers; > Vector<WebCore::CoordinatedLayerID> m_layersToCreate; > Vector<WebCore::CoordinatedLayerID> m_layersToDelete; >-- >1.8.1.rc1.1.g6daae11 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 108294
:
186001
|
186006
|
186014
|
186016
|
186317
|
186318
|
186322
|
186323
|
188273
|
189296
|
190515
|
191198
|
191353
|
191399
|
191429
|
191430