Title: [94672] trunk/Source/WebKit2
Revision
94672
Author
[email protected]
Date
2011-09-07 08:54:33 -0700 (Wed, 07 Sep 2011)

Log Message

[Qt][WK2] Rename SGAgent to SGUpdateQueue to sharpen it's responsability.
https://bugs.webkit.org/show_bug.cgi?id=67122

Reviewed by Tor Arne Vestbø.

* UIProcess/API/qt/qtouchwebpage.cpp:
(QTouchWebPage::updatePaintNode):
(QTouchWebPagePrivate::QTouchWebPagePrivate):
* UIProcess/API/qt/qtouchwebpage_p.h:
* UIProcess/qt/SGUpdateQueue.cpp: Renamed from Source/WebKit2/UIProcess/qt/SGAgent.cpp.
(WebKit::NodeUpdateCreateTile::NodeUpdateCreateTile):
(WebKit::NodeUpdateRemoveTile::NodeUpdateRemoveTile):
(WebKit::NodeUpdateSetBackBuffer::NodeUpdateSetBackBuffer):
(WebKit::NodeUpdateSwapTileBuffers::NodeUpdateSwapTileBuffers):
(WebKit::SGUpdateQueue::SGUpdateQueue):
(WebKit::SGUpdateQueue::createTileNode):
(WebKit::SGUpdateQueue::removeTileNode):
(WebKit::SGUpdateQueue::setNodeBackBuffer):
(WebKit::SGUpdateQueue::swapTileBuffers):
(WebKit::SGUpdateQueue::applyUpdates):
(WebKit::SGUpdateQueue::getScaleNode):
* UIProcess/qt/SGUpdateQueue.h: Renamed from Source/WebKit2/UIProcess/qt/SGAgent.h.
(WebKit::SGUpdateQueue::isSwapPending):
(WebKit::NodeUpdate::NodeUpdate):
(WebKit::NodeUpdate::~NodeUpdate):
* UIProcess/qt/TiledDrawingAreaProxyQt.cpp:
(WebKit::TiledDrawingAreaProxy::updateWebView):
(WebKit::TiledDrawingAreaProxy::createTile):
(WebKit::TiledDrawingAreaProxy::updateTile):
(WebKit::TiledDrawingAreaProxy::didRenderFrame):
(WebKit::TiledDrawingAreaProxy::removeTile):
* UIProcess/qt/TouchViewInterface.cpp:
(WebKit::TouchViewInterface::sceneGraphUpdateQueue):
* UIProcess/qt/TouchViewInterface.h:
* WebKit2.pro:

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (94671 => 94672)


--- trunk/Source/WebKit2/ChangeLog	2011-09-07 15:15:44 UTC (rev 94671)
+++ trunk/Source/WebKit2/ChangeLog	2011-09-07 15:54:33 UTC (rev 94672)
@@ -1,3 +1,41 @@
+2011-08-29  Jocelyn Turcotte  <[email protected]>
+
+        [Qt][WK2] Rename SGAgent to SGUpdateQueue to sharpen it's responsability.
+        https://bugs.webkit.org/show_bug.cgi?id=67122
+
+        Reviewed by Tor Arne Vestbø.
+
+        * UIProcess/API/qt/qtouchwebpage.cpp:
+        (QTouchWebPage::updatePaintNode):
+        (QTouchWebPagePrivate::QTouchWebPagePrivate):
+        * UIProcess/API/qt/qtouchwebpage_p.h:
+        * UIProcess/qt/SGUpdateQueue.cpp: Renamed from Source/WebKit2/UIProcess/qt/SGAgent.cpp.
+        (WebKit::NodeUpdateCreateTile::NodeUpdateCreateTile):
+        (WebKit::NodeUpdateRemoveTile::NodeUpdateRemoveTile):
+        (WebKit::NodeUpdateSetBackBuffer::NodeUpdateSetBackBuffer):
+        (WebKit::NodeUpdateSwapTileBuffers::NodeUpdateSwapTileBuffers):
+        (WebKit::SGUpdateQueue::SGUpdateQueue):
+        (WebKit::SGUpdateQueue::createTileNode):
+        (WebKit::SGUpdateQueue::removeTileNode):
+        (WebKit::SGUpdateQueue::setNodeBackBuffer):
+        (WebKit::SGUpdateQueue::swapTileBuffers):
+        (WebKit::SGUpdateQueue::applyUpdates):
+        (WebKit::SGUpdateQueue::getScaleNode):
+        * UIProcess/qt/SGUpdateQueue.h: Renamed from Source/WebKit2/UIProcess/qt/SGAgent.h.
+        (WebKit::SGUpdateQueue::isSwapPending):
+        (WebKit::NodeUpdate::NodeUpdate):
+        (WebKit::NodeUpdate::~NodeUpdate):
+        * UIProcess/qt/TiledDrawingAreaProxyQt.cpp:
+        (WebKit::TiledDrawingAreaProxy::updateWebView):
+        (WebKit::TiledDrawingAreaProxy::createTile):
+        (WebKit::TiledDrawingAreaProxy::updateTile):
+        (WebKit::TiledDrawingAreaProxy::didRenderFrame):
+        (WebKit::TiledDrawingAreaProxy::removeTile):
+        * UIProcess/qt/TouchViewInterface.cpp:
+        (WebKit::TouchViewInterface::sceneGraphUpdateQueue):
+        * UIProcess/qt/TouchViewInterface.h:
+        * WebKit2.pro:
+
 2011-09-07  Alexis Menard  <[email protected]>
 
         [Qt] Unreviewed suppression of an unnecessary debug output. 

Modified: trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebpage.cpp (94671 => 94672)


--- trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebpage.cpp	2011-09-07 15:15:44 UTC (rev 94671)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebpage.cpp	2011-09-07 15:54:33 UTC (rev 94672)
@@ -72,16 +72,16 @@
     if (!oldNode)
         oldNode = new QSGNode;
 
-    // A swap is on the queue, and SGAgent::updatePaintNode will empty the queue, so we know that
+    // A swap is on the queue, and SGUpdateQueue::applyUpdates will empty the queue, so we know that
     // the old frame's buffers won't be used anymore (for buffers used all the way from the web process
     // to the graphic card). Notify the web process that it can render the next frame.
-    if (d->sgAgent.isSwapPending())
+    if (d->sgUpdateQueue.isSwapPending())
         // The UI thread is currently locked and calling this from the rendering thread didn't crash
         // yet, so I'm assuming that this is OK. Else we have to wait until the SG update is over
         // and the UI thread returns to the event loop picking our event before it can be sent to
         // the web process. This would increase our chances of missing a frame.
         d->page->renderNextFrame();
-    d->sgAgent.updatePaintNode(oldNode);
+    d->sgUpdateQueue.applyUpdates(oldNode);
 
     // QSGItem takes ownership of this return value and it's children between and after updatePaintNode calls.
     return oldNode;
@@ -155,7 +155,7 @@
     : q(view)
     , page(0)
     , navigationController(0)
-    , sgAgent(view)
+    , sgUpdateQueue(view)
 {
 }
 

Modified: trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebpage_p.h (94671 => 94672)


--- trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebpage_p.h	2011-09-07 15:15:44 UTC (rev 94671)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebpage_p.h	2011-09-07 15:54:33 UTC (rev 94672)
@@ -21,7 +21,7 @@
 #ifndef qtouchwebpage_p_h
 #define qtouchwebpage_p_h
 
-#include "SGAgent.h"
+#include "SGUpdateQueue.h"
 #include "qtouchwebpage.h"
 #include "qwebnavigationcontroller.h"
 #include <QMenu>
@@ -45,7 +45,7 @@
     QTouchWebPage* const q;
     QTouchWebPageProxy* page;
     QWebNavigationController* navigationController;
-    WebKit::SGAgent sgAgent;
+    WebKit::SGUpdateQueue sgUpdateQueue;
 };
 
 #endif /* qtouchwebpage_p_h */

Deleted: trunk/Source/WebKit2/UIProcess/qt/SGAgent.cpp (94671 => 94672)


--- trunk/Source/WebKit2/UIProcess/qt/SGAgent.cpp	2011-09-07 15:15:44 UTC (rev 94671)
+++ trunk/Source/WebKit2/UIProcess/qt/SGAgent.cpp	2011-09-07 15:54:33 UTC (rev 94672)
@@ -1,170 +0,0 @@
-/*
- * Copyright (C) 2010, 2011 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 program 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 program; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#include "config.h"
-#include "SGAgent.h"
-
-#include "PassOwnPtr.h"
-#include "SGTileNode.h"
-#include <QSGItem>
-
-namespace WebKit {
-
-struct NodeUpdateCreateTile : public NodeUpdate {
-    NodeUpdateCreateTile(int nodeID, float scale)
-        : NodeUpdate(CreateTile)
-        , nodeID(nodeID)
-        , scale(scale)
-    { }
-    int nodeID;
-    float scale;
-};
-
-struct NodeUpdateRemoveTile : public NodeUpdate {
-    NodeUpdateRemoveTile(int nodeID)
-        : NodeUpdate(RemoveTile)
-        , nodeID(nodeID)
-    { }
-    int nodeID;
-};
-
-struct NodeUpdateSetBackBuffer : public NodeUpdate {
-    NodeUpdateSetBackBuffer(int nodeID, const QImage& backBuffer, const QRect& sourceRect, const QRect& targetRect)
-        : NodeUpdate(SetBackBuffer)
-        , nodeID(nodeID)
-        , backBuffer(backBuffer)
-        , sourceRect(sourceRect)
-        , targetRect(targetRect)
-    { }
-    int nodeID;
-    QImage backBuffer;
-    QRect sourceRect;
-    QRect targetRect;
-};
-
-struct NodeUpdateSwapTileBuffers : public NodeUpdate {
-    NodeUpdateSwapTileBuffers()
-        : NodeUpdate(SwapTileBuffers)
-    { }
-};
-
-SGAgent::SGAgent(QSGItem* item)
-    : item(item)
-    , lastScale(0)
-    , lastScaleNode(0)
-    , nextNodeID(1)
-    , m_isSwapPending(false)
-{
-}
-
-int SGAgent::createTileNode(float scale)
-{
-    int nodeID = nextNodeID++;
-    nodeUpdatesQueue.append(adoptPtr(new NodeUpdateCreateTile(nodeID, scale)));
-    item->update();
-    return nodeID;
-}
-
-void SGAgent::removeTileNode(int nodeID)
-{
-    nodeUpdatesQueue.append(adoptPtr(new NodeUpdateRemoveTile(nodeID)));
-    item->update();
-}
-
-void SGAgent::setNodeBackBuffer(int nodeID, const QImage& backBuffer, const QRect& sourceRect, const QRect& targetRect)
-{
-    nodeUpdatesQueue.append(adoptPtr(new NodeUpdateSetBackBuffer(nodeID, backBuffer, sourceRect, targetRect)));
-    item->update();
-}
-
-void SGAgent::swapTileBuffers()
-{
-    nodeUpdatesQueue.append(adoptPtr(new NodeUpdateSwapTileBuffers()));
-    m_isSwapPending = true;
-    item->update();
-}
-
-void SGAgent::updatePaintNode(QSGNode* itemNode)
-{
-    while (!nodeUpdatesQueue.isEmpty()) {
-        OwnPtr<NodeUpdate> nodeUpdate(nodeUpdatesQueue.takeFirst());
-        switch (nodeUpdate->type) {
-        case NodeUpdate::CreateTile: {
-            NodeUpdateCreateTile* createTileUpdate = static_cast<NodeUpdateCreateTile*>(nodeUpdate.get());
-            SGTileNode* tileNode = new SGTileNode(item->sceneGraphEngine());
-            getScaleNode(createTileUpdate->scale, itemNode)->prependChildNode(tileNode);
-            nodes.set(createTileUpdate->nodeID, tileNode);
-            break;
-        }
-        case NodeUpdate::RemoveTile: {
-            NodeUpdateRemoveTile* removeUpdate = static_cast<NodeUpdateRemoveTile*>(nodeUpdate.get());
-            QSGNode* node = nodes.take(removeUpdate->nodeID);
-            QSGNode* scaleNode = node->parent();
-
-            scaleNode->removeChildNode(node);
-            if (!scaleNode->childCount()) {
-                if (scaleNode == lastScaleNode) {
-                    lastScale = 0;
-                    lastScaleNode = 0;
-                }
-                delete scaleNode;
-            }
-            delete node;
-            break;
-        }
-        case NodeUpdate::SetBackBuffer: {
-            NodeUpdateSetBackBuffer* setBackBufferUpdate = static_cast<NodeUpdateSetBackBuffer*>(nodeUpdate.get());
-            SGTileNode* tileNode = nodes.get(setBackBufferUpdate->nodeID);
-            tileNode->setBackBuffer(setBackBufferUpdate->backBuffer, setBackBufferUpdate->sourceRect, setBackBufferUpdate->targetRect);
-            break;
-        }
-        case NodeUpdate::SwapTileBuffers: {
-            HashMap<int, SGTileNode*>::iterator end = nodes.end();
-            for (HashMap<int, SGTileNode*>::iterator it = nodes.begin(); it != end; ++it)
-                it->second->swapBuffersIfNeeded();
-            m_isSwapPending = false;
-            break;
-        }
-        default:
-            ASSERT_NOT_REACHED();
-        }
-    }
-}
-
-QSGNode* SGAgent::getScaleNode(float scale, QSGNode* itemNode)
-{
-    if (scale == lastScale)
-        return lastScaleNode;
-
-    QSGTransformNode* scaleNode = new QSGTransformNode;
-    QMatrix4x4 scaleMatrix;
-    // Use scale(float,float) to prevent scaling the Z component.
-    // Reverse the item's transform scale since our tiles were generated for this specific scale.
-    scaleMatrix.scale(1 / scale, 1 / scale);
-    scaleNode->setMatrix(scaleMatrix);
-    // Prepend instead of append to paint the new, incomplete, scale before/behind the previous one.
-    itemNode->prependChildNode(scaleNode);
-
-    lastScale = scale;
-    lastScaleNode = scaleNode;
-    return lastScaleNode;
-}
-
-}

Deleted: trunk/Source/WebKit2/UIProcess/qt/SGAgent.h (94671 => 94672)


--- trunk/Source/WebKit2/UIProcess/qt/SGAgent.h	2011-09-07 15:15:44 UTC (rev 94671)
+++ trunk/Source/WebKit2/UIProcess/qt/SGAgent.h	2011-09-07 15:54:33 UTC (rev 94672)
@@ -1,82 +0,0 @@
-/*
- * Copyright (C) 2011 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 program 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 program; 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 SGAgent_h
-#define SGAgent_h
-
-#include "Deque.h"
-#include "OwnPtr.h"
-#include "HashMap.h"
-
-class QImage;
-class QRect;
-class QSGItem;
-class QSGNode;
-class QSize;
-
-namespace WebKit {
-
-class NodeUpdate;
-class PageNode;
-class SGTileNode;
-
-// Takes care of taking update requests then fulfilling them asynchronously on the scene graph thread.
-class SGAgent {
-public:
-    SGAgent(QSGItem*);
-
-    int createTileNode(float scale);
-    void removeTileNode(int nodeID);
-    void setNodeBackBuffer(int nodeID, const QImage& texture, const QRect& sourceRect, const QRect& targetRect);
-    void swapTileBuffers();
-
-    // Called by the QSGItem.
-    void updatePaintNode(QSGNode* itemNode);
-    bool isSwapPending() const { return m_isSwapPending; }
-
-private:
-    QSGNode* getScaleNode(float scale, QSGNode* itemNode);
-
-    QSGItem* item;
-    Deque<OwnPtr<NodeUpdate> > nodeUpdatesQueue;
-    HashMap<int, SGTileNode*> nodes;
-    float lastScale;
-    QSGNode* lastScaleNode;
-    int nextNodeID;
-    bool m_isSwapPending;
-};
-
-struct NodeUpdate {
-    enum Type {
-        CreateTile,
-        RemoveTile,
-        SetBackBuffer,
-        SwapTileBuffers
-    };
-    NodeUpdate(Type type)
-        : type(type)
-    { }
-    virtual ~NodeUpdate() { }
-    Type type;
-};
-
-}
-
-#endif /* SGAgent_h */

Copied: trunk/Source/WebKit2/UIProcess/qt/SGUpdateQueue.cpp (from rev 94671, trunk/Source/WebKit2/UIProcess/qt/SGAgent.cpp) (0 => 94672)


--- trunk/Source/WebKit2/UIProcess/qt/SGUpdateQueue.cpp	                        (rev 0)
+++ trunk/Source/WebKit2/UIProcess/qt/SGUpdateQueue.cpp	2011-09-07 15:54:33 UTC (rev 94672)
@@ -0,0 +1,170 @@
+/*
+ * Copyright (C) 2010, 2011 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 program 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 program; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "SGUpdateQueue.h"
+
+#include "PassOwnPtr.h"
+#include "SGTileNode.h"
+#include <QSGItem>
+
+namespace WebKit {
+
+struct NodeUpdateCreateTile : public NodeUpdate {
+    NodeUpdateCreateTile(int nodeID, float scale)
+        : NodeUpdate(CreateTile)
+        , nodeID(nodeID)
+        , scale(scale)
+    { }
+    int nodeID;
+    float scale;
+};
+
+struct NodeUpdateRemoveTile : public NodeUpdate {
+    NodeUpdateRemoveTile(int nodeID)
+        : NodeUpdate(RemoveTile)
+        , nodeID(nodeID)
+    { }
+    int nodeID;
+};
+
+struct NodeUpdateSetBackBuffer : public NodeUpdate {
+    NodeUpdateSetBackBuffer(int nodeID, const QImage& backBuffer, const QRect& sourceRect, const QRect& targetRect)
+        : NodeUpdate(SetBackBuffer)
+        , nodeID(nodeID)
+        , backBuffer(backBuffer)
+        , sourceRect(sourceRect)
+        , targetRect(targetRect)
+    { }
+    int nodeID;
+    QImage backBuffer;
+    QRect sourceRect;
+    QRect targetRect;
+};
+
+struct NodeUpdateSwapTileBuffers : public NodeUpdate {
+    NodeUpdateSwapTileBuffers()
+        : NodeUpdate(SwapTileBuffers)
+    { }
+};
+
+SGUpdateQueue::SGUpdateQueue(QSGItem* item)
+    : item(item)
+    , lastScale(0)
+    , lastScaleNode(0)
+    , nextNodeID(1)
+    , m_isSwapPending(false)
+{
+}
+
+int SGUpdateQueue::createTileNode(float scale)
+{
+    int nodeID = nextNodeID++;
+    nodeUpdateQueue.append(adoptPtr(new NodeUpdateCreateTile(nodeID, scale)));
+    item->update();
+    return nodeID;
+}
+
+void SGUpdateQueue::removeTileNode(int nodeID)
+{
+    nodeUpdateQueue.append(adoptPtr(new NodeUpdateRemoveTile(nodeID)));
+    item->update();
+}
+
+void SGUpdateQueue::setNodeBackBuffer(int nodeID, const QImage& backBuffer, const QRect& sourceRect, const QRect& targetRect)
+{
+    nodeUpdateQueue.append(adoptPtr(new NodeUpdateSetBackBuffer(nodeID, backBuffer, sourceRect, targetRect)));
+    item->update();
+}
+
+void SGUpdateQueue::swapTileBuffers()
+{
+    nodeUpdateQueue.append(adoptPtr(new NodeUpdateSwapTileBuffers()));
+    m_isSwapPending = true;
+    item->update();
+}
+
+void SGUpdateQueue::applyUpdates(QSGNode* itemNode)
+{
+    while (!nodeUpdateQueue.isEmpty()) {
+        OwnPtr<NodeUpdate> nodeUpdate(nodeUpdateQueue.takeFirst());
+        switch (nodeUpdate->type) {
+        case NodeUpdate::CreateTile: {
+            NodeUpdateCreateTile* createTileUpdate = static_cast<NodeUpdateCreateTile*>(nodeUpdate.get());
+            SGTileNode* tileNode = new SGTileNode(item->sceneGraphEngine());
+            getScaleNode(createTileUpdate->scale, itemNode)->prependChildNode(tileNode);
+            nodes.set(createTileUpdate->nodeID, tileNode);
+            break;
+        }
+        case NodeUpdate::RemoveTile: {
+            NodeUpdateRemoveTile* removeUpdate = static_cast<NodeUpdateRemoveTile*>(nodeUpdate.get());
+            QSGNode* node = nodes.take(removeUpdate->nodeID);
+            QSGNode* scaleNode = node->parent();
+
+            scaleNode->removeChildNode(node);
+            if (!scaleNode->childCount()) {
+                if (scaleNode == lastScaleNode) {
+                    lastScale = 0;
+                    lastScaleNode = 0;
+                }
+                delete scaleNode;
+            }
+            delete node;
+            break;
+        }
+        case NodeUpdate::SetBackBuffer: {
+            NodeUpdateSetBackBuffer* setBackBufferUpdate = static_cast<NodeUpdateSetBackBuffer*>(nodeUpdate.get());
+            SGTileNode* tileNode = nodes.get(setBackBufferUpdate->nodeID);
+            tileNode->setBackBuffer(setBackBufferUpdate->backBuffer, setBackBufferUpdate->sourceRect, setBackBufferUpdate->targetRect);
+            break;
+        }
+        case NodeUpdate::SwapTileBuffers: {
+            HashMap<int, SGTileNode*>::iterator end = nodes.end();
+            for (HashMap<int, SGTileNode*>::iterator it = nodes.begin(); it != end; ++it)
+                it->second->swapBuffersIfNeeded();
+            m_isSwapPending = false;
+            break;
+        }
+        default:
+            ASSERT_NOT_REACHED();
+        }
+    }
+}
+
+QSGNode* SGUpdateQueue::getScaleNode(float scale, QSGNode* itemNode)
+{
+    if (scale == lastScale)
+        return lastScaleNode;
+
+    QSGTransformNode* scaleNode = new QSGTransformNode;
+    QMatrix4x4 scaleMatrix;
+    // Use scale(float,float) to prevent scaling the Z component.
+    // Reverse the item's transform scale since our tiles were generated for this specific scale.
+    scaleMatrix.scale(1 / scale, 1 / scale);
+    scaleNode->setMatrix(scaleMatrix);
+    // Prepend instead of append to paint the new, incomplete, scale before/behind the previous one.
+    itemNode->prependChildNode(scaleNode);
+
+    lastScale = scale;
+    lastScaleNode = scaleNode;
+    return lastScaleNode;
+}
+
+}

Copied: trunk/Source/WebKit2/UIProcess/qt/SGUpdateQueue.h (from rev 94671, trunk/Source/WebKit2/UIProcess/qt/SGAgent.h) (0 => 94672)


--- trunk/Source/WebKit2/UIProcess/qt/SGUpdateQueue.h	                        (rev 0)
+++ trunk/Source/WebKit2/UIProcess/qt/SGUpdateQueue.h	2011-09-07 15:54:33 UTC (rev 94672)
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2011 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 program 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 program; 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 SGUpdateQueue_h
+#define SGUpdateQueue_h
+
+#include "Deque.h"
+#include "HashMap.h"
+#include "OwnPtr.h"
+
+class QImage;
+class QRect;
+class QSGItem;
+class QSGNode;
+class QSize;
+
+namespace WebKit {
+
+class NodeUpdate;
+class PageNode;
+class SGTileNode;
+
+// Takes care of taking update requests then fulfilling them asynchronously on the scene graph thread.
+class SGUpdateQueue {
+public:
+    SGUpdateQueue(QSGItem*);
+
+    int createTileNode(float scale);
+    void removeTileNode(int nodeID);
+    void setNodeBackBuffer(int nodeID, const QImage& texture, const QRect& sourceRect, const QRect& targetRect);
+    void swapTileBuffers();
+
+    // Called by the QSGItem.
+    void applyUpdates(QSGNode* itemNode);
+    bool isSwapPending() const { return m_isSwapPending; }
+
+private:
+    QSGNode* getScaleNode(float scale, QSGNode* itemNode);
+
+    QSGItem* item;
+    Deque<OwnPtr<NodeUpdate> > nodeUpdateQueue;
+    HashMap<int, SGTileNode*> nodes;
+    float lastScale;
+    QSGNode* lastScaleNode;
+    int nextNodeID;
+    bool m_isSwapPending;
+};
+
+struct NodeUpdate {
+    enum Type {
+        CreateTile,
+        RemoveTile,
+        SetBackBuffer,
+        SwapTileBuffers
+    };
+    NodeUpdate(Type type)
+        : type(type)
+    { }
+    virtual ~NodeUpdate() { }
+    Type type;
+};
+
+}
+
+#endif /* SGUpdateQueue_h */

Modified: trunk/Source/WebKit2/UIProcess/qt/TiledDrawingAreaProxyQt.cpp (94671 => 94672)


--- trunk/Source/WebKit2/UIProcess/qt/TiledDrawingAreaProxyQt.cpp	2011-09-07 15:15:44 UTC (rev 94671)
+++ trunk/Source/WebKit2/UIProcess/qt/TiledDrawingAreaProxyQt.cpp	2011-09-07 15:54:33 UTC (rev 94672)
@@ -26,7 +26,7 @@
 #include "config.h"
 #include "TiledDrawingAreaProxy.h"
 
-#include "SGAgent.h"
+#include "SGUpdateQueue.h"
 #include "ShareableBitmap.h"
 #include "TouchViewInterface.h"
 #include "UpdateInfo.h"
@@ -41,7 +41,7 @@
 
 void TiledDrawingAreaProxy::updateWebView(const Vector<IntRect>& paintedArea)
 {
-    // SG updates are triggered through SGAgent.
+    // SG updates are triggered through SGUpdateQueue.
 }
 
 WebPageProxy* TiledDrawingAreaProxy::page()
@@ -51,7 +51,7 @@
 
 void TiledDrawingAreaProxy::createTile(int tileID, const UpdateInfo& updateInfo)
 {
-    int nodeID = m_webView->sceneGraphAgent()->createTileNode(updateInfo.updateScaleFactor);
+    int nodeID = m_webView->sceneGraphUpdateQueue()->createTileNode(updateInfo.updateScaleFactor);
     m_tileNodeMap.set(tileID, nodeID);
     updateTile(tileID, updateInfo);
 }
@@ -66,18 +66,18 @@
     // Currently won't work since the SharedMemory handle is owned by updateInfo.
     QImage image(bitmap->createQImage().copy());
     QRect sourceRect(0, 0, updateInfo.updateRectBounds.width(), updateInfo.updateRectBounds.height());
-    m_webView->sceneGraphAgent()->setNodeBackBuffer(nodeID, image, sourceRect, updateInfo.updateRectBounds);
+    m_webView->sceneGraphUpdateQueue()->setNodeBackBuffer(nodeID, image, sourceRect, updateInfo.updateRectBounds);
 }
 
 void TiledDrawingAreaProxy::didRenderFrame()
 {
-    m_webView->sceneGraphAgent()->swapTileBuffers();
+    m_webView->sceneGraphUpdateQueue()->swapTileBuffers();
 }
 
 void TiledDrawingAreaProxy::removeTile(int tileID)
 {
     int nodeID = m_tileNodeMap.take(tileID);
-    m_webView->sceneGraphAgent()->removeTileNode(nodeID);
+    m_webView->sceneGraphUpdateQueue()->removeTileNode(nodeID);
 }
 
 } // namespace WebKit

Modified: trunk/Source/WebKit2/UIProcess/qt/TouchViewInterface.cpp (94671 => 94672)


--- trunk/Source/WebKit2/UIProcess/qt/TouchViewInterface.cpp	2011-09-07 15:15:44 UTC (rev 94671)
+++ trunk/Source/WebKit2/UIProcess/qt/TouchViewInterface.cpp	2011-09-07 15:54:33 UTC (rev 94672)
@@ -40,9 +40,9 @@
 {
 }
 
-SGAgent* TouchViewInterface::sceneGraphAgent() const
+SGUpdateQueue* TouchViewInterface::sceneGraphUpdateQueue() const
 {
-    return &m_pageView->d->sgAgent;
+    return &m_pageView->d->sgUpdateQueue;
 }
 
 void TouchViewInterface::setViewNeedsDisplay(const QRect&)

Modified: trunk/Source/WebKit2/UIProcess/qt/TouchViewInterface.h (94671 => 94672)


--- trunk/Source/WebKit2/UIProcess/qt/TouchViewInterface.h	2011-09-07 15:15:44 UTC (rev 94671)
+++ trunk/Source/WebKit2/UIProcess/qt/TouchViewInterface.h	2011-09-07 15:54:33 UTC (rev 94672)
@@ -33,14 +33,14 @@
 
 namespace WebKit {
 
-class SGAgent;
+class SGUpdateQueue;
 
 class TouchViewInterface : public ViewInterface
 {
 public:
     TouchViewInterface(QTouchWebView* viewportView, QTouchWebPage* pageView);
 
-    SGAgent* sceneGraphAgent() const;
+    SGUpdateQueue* sceneGraphUpdateQueue() const;
 
 private:
     /* Implementation of ViewInterface */

Modified: trunk/Source/WebKit2/WebKit2.pro (94671 => 94672)


--- trunk/Source/WebKit2/WebKit2.pro	2011-09-07 15:15:44 UTC (rev 94671)
+++ trunk/Source/WebKit2/WebKit2.pro	2011-09-07 15:54:33 UTC (rev 94672)
@@ -251,7 +251,7 @@
     UIProcess/qt/qwkhistory_p.h \
     UIProcess/qt/qwkpreferences.h \
     UIProcess/qt/qwkpreferences_p.h \
-    UIProcess/qt/SGAgent.h \
+    UIProcess/qt/SGUpdateQueue.h \
     UIProcess/qt/SGTileNode.h \
     UIProcess/qt/ViewInterface.h \
     UIProcess/qt/ViewportInteractionEngine.h \
@@ -481,7 +481,7 @@
     UIProcess/qt/QtWebPageProxy.cpp \
     UIProcess/qt/qwkhistory.cpp \
     UIProcess/qt/qwkpreferences.cpp \
-    UIProcess/qt/SGAgent.cpp \
+    UIProcess/qt/SGUpdateQueue.cpp \
     UIProcess/qt/SGTileNode.cpp \
     UIProcess/qt/TiledDrawingAreaProxyQt.cpp \
     UIProcess/qt/TextCheckerQt.cpp \
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to