Title: [166191] trunk/Source/WebKit2
Revision
166191
Author
[email protected]
Date
2014-03-24 13:57:41 -0700 (Mon, 24 Mar 2014)

Log Message

[WK2] Make updates on ViewUpdateDispatcher less heavy
https://bugs.webkit.org/show_bug.cgi?id=130626

Patch by Benjamin Poulain <[email protected]> on 2014-03-24
Reviewed by Darin Adler.

* WebProcess/WebPage/ViewUpdateDispatcher.cpp:
(WebKit::ViewUpdateDispatcher::visibleContentRectUpdate):
(WebKit::ViewUpdateDispatcher::dispatchVisibleContentRectUpdate):
* WebProcess/WebPage/ViewUpdateDispatcher.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (166190 => 166191)


--- trunk/Source/WebKit2/ChangeLog	2014-03-24 20:57:33 UTC (rev 166190)
+++ trunk/Source/WebKit2/ChangeLog	2014-03-24 20:57:41 UTC (rev 166191)
@@ -1,5 +1,17 @@
 2014-03-24  Benjamin Poulain  <[email protected]>
 
+        [WK2] Make updates on ViewUpdateDispatcher less heavy
+        https://bugs.webkit.org/show_bug.cgi?id=130626
+
+        Reviewed by Darin Adler.
+
+        * WebProcess/WebPage/ViewUpdateDispatcher.cpp:
+        (WebKit::ViewUpdateDispatcher::visibleContentRectUpdate):
+        (WebKit::ViewUpdateDispatcher::dispatchVisibleContentRectUpdate):
+        * WebProcess/WebPage/ViewUpdateDispatcher.h:
+
+2014-03-24  Benjamin Poulain  <[email protected]>
+
         [iOS][WK2] Micro-optimize view state updates on the UIProcess side
         https://bugs.webkit.org/show_bug.cgi?id=130631
 

Modified: trunk/Source/WebKit2/WebProcess/WebPage/ViewUpdateDispatcher.cpp (166190 => 166191)


--- trunk/Source/WebKit2/WebProcess/WebPage/ViewUpdateDispatcher.cpp	2014-03-24 20:57:33 UTC (rev 166190)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ViewUpdateDispatcher.cpp	2014-03-24 20:57:41 UTC (rev 166191)
@@ -56,24 +56,27 @@
 
 void ViewUpdateDispatcher::visibleContentRectUpdate(uint64_t pageID, const VisibleContentRectUpdateInfo& visibleContentRectUpdateInfo)
 {
+    bool updateListWasEmpty;
     {
-        MutexLocker locker(m_dataMutex);
+        SpinLockHolder locker(&m_dataMutex);
+        updateListWasEmpty = m_latestUpdate.isEmpty();
         m_latestUpdate.set(pageID, visibleContentRectUpdateInfo);
     }
-    RunLoop::main().dispatch(bind(&ViewUpdateDispatcher::dispatchVisibleContentRectUpdate, this));
+    if (updateListWasEmpty)
+        RunLoop::main().dispatch(bind(&ViewUpdateDispatcher::dispatchVisibleContentRectUpdate, this));
 }
 
 void ViewUpdateDispatcher::dispatchVisibleContentRectUpdate()
 {
     HashMap<uint64_t, VisibleContentRectUpdateInfo> localCopy;
     {
-        MutexLocker locker(m_dataMutex);
+        SpinLockHolder locker(&m_dataMutex);
         localCopy.swap(m_latestUpdate);
     }
 
-    for (auto& iterator : localCopy) {
-        if (WebPage* webPage = WebProcess::shared().webPage(iterator.key))
-            webPage->updateVisibleContentRects(iterator.value);
+    for (auto& slot : localCopy) {
+        if (WebPage* webPage = WebProcess::shared().webPage(slot.key))
+            webPage->updateVisibleContentRects(slot.value);
     }
 }
 

Modified: trunk/Source/WebKit2/WebProcess/WebPage/ViewUpdateDispatcher.h (166190 => 166191)


--- trunk/Source/WebKit2/WebProcess/WebPage/ViewUpdateDispatcher.h	2014-03-24 20:57:33 UTC (rev 166190)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ViewUpdateDispatcher.h	2014-03-24 20:57:41 UTC (rev 166191)
@@ -31,6 +31,7 @@
 #include "VisibleContentRectUpdateInfo.h"
 #include <wtf/HashMap.h>
 #include <wtf/PassRef.h>
+#include <wtf/TCSpinLock.h>
 
 namespace WebKit {
 
@@ -51,7 +52,7 @@
     void dispatchVisibleContentRectUpdate();
 
     RefPtr<WorkQueue> m_queue;
-    Mutex m_dataMutex;
+    SpinLock m_dataMutex;
     HashMap<uint64_t, VisibleContentRectUpdateInfo> m_latestUpdate;
 };
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to