Title: [92198] trunk/Source/WebKit2
Revision
92198
Author
[email protected]
Date
2011-08-02 10:00:08 -0700 (Tue, 02 Aug 2011)

Log Message

TiledDrawingArea: Handle update requests in the order they were received.
https://bugs.webkit.org/show_bug.cgi?id=64365

Reviewed by Andreas Kling.

TiledDrawingAreaProxy::createTiles() uses the distance of tiles to the
center of the viewport to decide which tile should be rendered first.
This logic is useless if the requests are not handled in the same order
as they were received.
Now use a list instead of a map to hold pending tile update requests.

* WebProcess/WebPage/TiledDrawingArea.cpp:
(WebKit::TiledDrawingArea::tileUpdateTimerFired):
(WebKit::TiledDrawingArea::cancelTileUpdate):
(WebKit::TiledDrawingArea::requestTileUpdate):
* WebProcess/WebPage/TiledDrawingArea.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (92197 => 92198)


--- trunk/Source/WebKit2/ChangeLog	2011-08-02 16:34:36 UTC (rev 92197)
+++ trunk/Source/WebKit2/ChangeLog	2011-08-02 17:00:08 UTC (rev 92198)
@@ -1,3 +1,22 @@
+2011-07-12  Jocelyn Turcotte  <[email protected]>
+
+        TiledDrawingArea: Handle update requests in the order they were received.
+        https://bugs.webkit.org/show_bug.cgi?id=64365
+
+        Reviewed by Andreas Kling.
+
+        TiledDrawingAreaProxy::createTiles() uses the distance of tiles to the
+        center of the viewport to decide which tile should be rendered first.
+        This logic is useless if the requests are not handled in the same order
+        as they were received.
+        Now use a list instead of a map to hold pending tile update requests.
+
+        * WebProcess/WebPage/TiledDrawingArea.cpp:
+        (WebKit::TiledDrawingArea::tileUpdateTimerFired):
+        (WebKit::TiledDrawingArea::cancelTileUpdate):
+        (WebKit::TiledDrawingArea::requestTileUpdate):
+        * WebProcess/WebPage/TiledDrawingArea.h:
+
 2011-08-02  Amruth Raj  <[email protected]>
 
         Custom cursors cause the WebProcess to crash

Modified: trunk/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.cpp (92197 => 92198)


--- trunk/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.cpp	2011-08-02 16:34:36 UTC (rev 92197)
+++ trunk/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.cpp	2011-08-02 17:00:08 UTC (rev 92198)
@@ -165,11 +165,10 @@
 {
     ASSERT(!m_pendingUpdates.isEmpty());
 
-    UpdateMap::iterator it = m_pendingUpdates.begin();
-    TileUpdate update = it->second;
-    m_pendingUpdates.remove(it);
+    OwnPtr<TileUpdate> update = m_pendingUpdates.first().release();
+    m_pendingUpdates.removeFirst();
 
-    updateTile(update.tileID, update.dirtyRect, update.scale);
+    updateTile(update->tileID, update->dirtyRect, update->scale);
 
     if (m_pendingUpdates.isEmpty())
         m_webPage->send(Messages::DrawingAreaProxy::AllTileUpdatesProcessed());
@@ -179,10 +178,13 @@
 
 void TiledDrawingArea::cancelTileUpdate(int tileID)
 {
-    UpdateMap::iterator it = m_pendingUpdates.find(tileID);
-    if (it == m_pendingUpdates.end())
-        return;
-    m_pendingUpdates.remove(it);
+    UpdateList::iterator end = m_pendingUpdates.end();
+    for (UpdateList::iterator it = m_pendingUpdates.begin(); it != end; ++it) {
+        if ((*it)->tileID == tileID) {
+            m_pendingUpdates.remove(it);
+            break;
+        }
+    }
     if (m_pendingUpdates.isEmpty()) {
         m_webPage->send(Messages::DrawingAreaProxy::AllTileUpdatesProcessed());
         m_tileUpdateTimer.stop();
@@ -191,17 +193,20 @@
 
 void TiledDrawingArea::requestTileUpdate(int tileID, const WebCore::IntRect& dirtyRect, float scale)
 {
-    UpdateMap::iterator it = m_pendingUpdates.find(tileID);
-    if (it != m_pendingUpdates.end())
-        it->second.dirtyRect.unite(dirtyRect);
-    else {
-        TileUpdate update;
-        update.tileID = tileID;
-        update.dirtyRect = dirtyRect;
-        update.scale = scale;
-        m_pendingUpdates.add(tileID, update);
-        scheduleTileUpdate();
+    UpdateList::iterator end = m_pendingUpdates.end();
+    for (UpdateList::iterator it = m_pendingUpdates.begin(); it != end; ++it) {
+        if ((*it)->tileID == tileID) {
+            (*it)->dirtyRect.unite(dirtyRect);
+            return;
+        }
     }
+
+    OwnPtr<TileUpdate> update(adoptPtr(new TileUpdate));
+    update->tileID = tileID;
+    update->dirtyRect = dirtyRect;
+    update->scale = scale;
+    m_pendingUpdates.append(update.release());
+    scheduleTileUpdate();
 }
 
 } // namespace WebKit

Modified: trunk/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.h (92197 => 92198)


--- trunk/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.h	2011-08-02 16:34:36 UTC (rev 92197)
+++ trunk/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.h	2011-08-02 17:00:08 UTC (rev 92198)
@@ -31,7 +31,7 @@
 #include "DrawingArea.h"
 #include "RunLoop.h"
 #include <WebCore/IntRect.h>
-#include <wtf/Vector.h>
+#include <wtf/Deque.h>
 
 namespace WebKit {
 
@@ -83,8 +83,8 @@
         WebCore::IntRect dirtyRect;
         float scale;
     };
-    typedef HashMap<int, TileUpdate> UpdateMap;
-    UpdateMap m_pendingUpdates;
+    typedef Deque<OwnPtr<TileUpdate> > UpdateList;
+    UpdateList m_pendingUpdates;
     RunLoop::Timer<TiledDrawingArea> m_tileUpdateTimer;
 };
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to