Title: [103179] trunk/Source
Revision
103179
Author
ander...@apple.com
Date
2011-12-18 10:01:53 -0800 (Sun, 18 Dec 2011)

Log Message

EventDispatcher should keep track of all scrolling coordinators
https://bugs.webkit.org/show_bug.cgi?id=74810

Reviewed by Andreas Kling.

Source/WebCore:

Export symbols needed by WebKit2.

* WebCore.exp.in:

Source/WebKit2:

* WebProcess/WebPage/EventDispatcher.cpp:
(WebKit::EventDispatcher::addScrollingCoordinatorForPage):
Get the scrolling coordinator from the WebCore page and add it to the map.

(WebKit::EventDispatcher::removeScrollingCoordinatorForPage):
Remove the scrolling coordinator from the map.

(WebKit::EventDispatcher::sendDidHandleEvent):
Add a new helper function, currently unused.

* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
Add the scrolling coordinator.

(WebKit::TiledCoreAnimationDrawingArea::~TiledCoreAnimationDrawingArea):
Remove the scrolling coordinator.

* WebProcess/WebProcess.h:
(WebKit::WebProcess::eventDispatcher):
Add a getter.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (103178 => 103179)


--- trunk/Source/WebCore/ChangeLog	2011-12-18 17:06:52 UTC (rev 103178)
+++ trunk/Source/WebCore/ChangeLog	2011-12-18 18:01:53 UTC (rev 103179)
@@ -1,3 +1,14 @@
+2011-12-18  Anders Carlsson  <ander...@apple.com>
+
+        EventDispatcher should keep track of all scrolling coordinators
+        https://bugs.webkit.org/show_bug.cgi?id=74810
+
+        Reviewed by Andreas Kling.
+
+        Export symbols needed by WebKit2.
+
+        * WebCore.exp.in:
+
 2011-12-18  Raul Hudea  <rhu...@adobe.com>
 
         Add transform function completion to web-inspector

Modified: trunk/Source/WebCore/WebCore.exp.in (103178 => 103179)


--- trunk/Source/WebCore/WebCore.exp.in	2011-12-18 17:06:52 UTC (rev 103178)
+++ trunk/Source/WebCore/WebCore.exp.in	2011-12-18 18:01:53 UTC (rev 103179)
@@ -2017,3 +2017,11 @@
 __ZN7WebCore12Notification18dispatchClickEventEv
 __ZN7WebCore12Notification18dispatchCloseEventEv
 #endif
+
+#if ENABLE(THREADED_SCROLLING)
+__ZN7WebCore20ScrollingCoordinatorD1Ev
+__ZN7WebCore4Page20scrollingCoordinatorEv
+#endif
+
+
+

Modified: trunk/Source/WebKit2/ChangeLog (103178 => 103179)


--- trunk/Source/WebKit2/ChangeLog	2011-12-18 17:06:52 UTC (rev 103178)
+++ trunk/Source/WebKit2/ChangeLog	2011-12-18 18:01:53 UTC (rev 103179)
@@ -1,3 +1,31 @@
+2011-12-18  Anders Carlsson  <ander...@apple.com>
+
+        EventDispatcher should keep track of all scrolling coordinators
+        https://bugs.webkit.org/show_bug.cgi?id=74810
+
+        Reviewed by Andreas Kling.
+
+        * WebProcess/WebPage/EventDispatcher.cpp:
+        (WebKit::EventDispatcher::addScrollingCoordinatorForPage):
+        Get the scrolling coordinator from the WebCore page and add it to the map.
+
+        (WebKit::EventDispatcher::removeScrollingCoordinatorForPage):
+        Remove the scrolling coordinator from the map.
+
+        (WebKit::EventDispatcher::sendDidHandleEvent):
+        Add a new helper function, currently unused.
+
+        * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
+        (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
+        Add the scrolling coordinator.
+
+        (WebKit::TiledCoreAnimationDrawingArea::~TiledCoreAnimationDrawingArea):
+        Remove the scrolling coordinator.
+
+        * WebProcess/WebProcess.h:
+        (WebKit::WebProcess::eventDispatcher):
+        Add a getter.
+
 2011-12-16  Anders Carlsson  <ander...@apple.com>
 
         Move everyone off of WorkItem

Modified: trunk/Source/WebKit2/WebProcess/WebPage/EventDispatcher.cpp (103178 => 103179)


--- trunk/Source/WebKit2/WebProcess/WebPage/EventDispatcher.cpp	2011-12-18 17:06:52 UTC (rev 103178)
+++ trunk/Source/WebKit2/WebProcess/WebPage/EventDispatcher.cpp	2011-12-18 18:01:53 UTC (rev 103179)
@@ -28,10 +28,19 @@
 
 #include "RunLoop.h"
 #include "WebEvent.h"
+#include "WebEventConversion.h"
 #include "WebPage.h"
+#include "WebPageProxyMessages.h"
 #include "WebProcess.h"
+#include <WebCore/Page.h>
 #include <wtf/MainThread.h>
 
+#if ENABLE(THREADED_SCROLLING)
+#include <WebCore/ScrollingCoordinator.h>
+#endif
+
+using namespace WebCore;
+
 namespace WebKit {
 
 EventDispatcher::EventDispatcher()
@@ -42,6 +51,25 @@
 {
 }
 
+#if ENABLE(THREADED_SCROLLING)
+void EventDispatcher::addScrollingCoordinatorForPage(WebPage* webPage)
+{
+    MutexLocker locker(m_scrollingCoordinatorsMutex);
+
+    ASSERT(webPage->corePage()->scrollingCoordinator());
+    ASSERT(!m_scrollingCoordinators.contains(webPage->pageID()));
+    m_scrollingCoordinators.set(webPage->pageID(), webPage->corePage()->scrollingCoordinator());
+}
+
+void EventDispatcher::removeScrollingCoordinatorForPage(WebPage* webPage)
+{
+    MutexLocker locker(m_scrollingCoordinatorsMutex);
+    ASSERT(m_scrollingCoordinators.contains(webPage->pageID()));
+
+    m_scrollingCoordinators.remove(webPage->pageID());
+}
+#endif
+
 void EventDispatcher::didReceiveMessageOnConnectionWorkQueue(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, bool& didHandleMessage)
 {
     if (messageID.is<CoreIPC::MessageClassEventDispatcher>()) {
@@ -66,4 +94,11 @@
     webPage->wheelEvent(wheelEvent);
 }
 
+#if ENABLE(THREADED_SCROLLING)
+void EventDispatcher::sendDidHandleEvent(uint64_t pageID, const WebEvent& event)
+{
+    WebProcess::shared().connection()->send(Messages::WebPageProxy::DidReceiveEvent(static_cast<uint32_t>(event.type()), true), pageID);
+}
+#endif
+
 } // namespace WebKit

Modified: trunk/Source/WebKit2/WebProcess/WebPage/EventDispatcher.h (103178 => 103179)


--- trunk/Source/WebKit2/WebProcess/WebPage/EventDispatcher.h	2011-12-18 17:06:52 UTC (rev 103178)
+++ trunk/Source/WebKit2/WebProcess/WebPage/EventDispatcher.h	2011-12-18 18:01:53 UTC (rev 103179)
@@ -27,18 +27,33 @@
 #define EventDispatcher_h
 
 #include "Connection.h"
+#include <wtf/HashMap.h>
 #include <wtf/Noncopyable.h>
+#include <wtf/RefPtr.h>
 #include <wtf/ThreadingPrimitives.h>
 
+namespace WebCore {
+    class ScrollingCoordinator;
+}
+
 namespace WebKit {
 
+class WebEvent;
+class WebPage;
 class WebWheelEvent;
 
 class EventDispatcher : public CoreIPC::Connection::QueueClient {
+    WTF_MAKE_NONCOPYABLE(EventDispatcher);
+
 public:
     EventDispatcher();
     ~EventDispatcher();
 
+#if ENABLE(THREADED_SCROLLING)
+    void addScrollingCoordinatorForPage(WebPage*);
+    void removeScrollingCoordinatorForPage(WebPage*);
+#endif
+
 private:
     // CoreIPC::Connection::QueueClient
     virtual void didReceiveMessageOnConnectionWorkQueue(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, bool& didHandleMessage) OVERRIDE;
@@ -51,6 +66,13 @@
 
     // This is called on the main thread.
     void dispatchWheelEvent(uint64_t pageID, const WebWheelEvent&);
+
+#if ENABLE(THREADED_SCROLLING)
+    void sendDidHandleEvent(uint64_t pageID, const WebEvent&);
+
+    Mutex m_scrollingCoordinatorsMutex;
+    HashMap<uint64_t, RefPtr<WebCore::ScrollingCoordinator> > m_scrollingCoordinators;
+#endif
 };
 
 } // namespace WebKit

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm (103178 => 103179)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm	2011-12-18 17:06:52 UTC (rev 103178)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm	2011-12-18 18:01:53 UTC (rev 103179)
@@ -27,6 +27,7 @@
 #import "TiledCoreAnimationDrawingArea.h"
 
 #import "DrawingAreaProxyMessages.h"
+#import "EventDispatcher.h"
 #import "LayerTreeContext.h"
 #import "WebPage.h"
 #import "WebProcess.h"
@@ -63,6 +64,8 @@
 
 #if ENABLE(THREADED_SCROLLING)
     page->settings()->setScrollingCoordinatorEnabled(true);
+
+    WebProcess::shared().eventDispatcher().addScrollingCoordinatorForPage(webPage);
 #endif
 
     m_rootLayer = [CALayer layer];
@@ -86,6 +89,10 @@
 
 TiledCoreAnimationDrawingArea::~TiledCoreAnimationDrawingArea()
 {
+#if ENABLE(THREADED_SCROLLING)
+    WebProcess::shared().eventDispatcher().removeScrollingCoordinatorForPage(m_webPage);
+#endif
+
     m_layerFlushScheduler.invalidate();
 }
 

Modified: trunk/Source/WebKit2/WebProcess/WebProcess.h (103178 => 103179)


--- trunk/Source/WebKit2/WebProcess/WebProcess.h	2011-12-18 17:06:52 UTC (rev 103178)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.h	2011-12-18 18:01:53 UTC (rev 103179)
@@ -141,6 +141,8 @@
     bool disablePluginProcessMessageTimeout() const { return m_disablePluginProcessMessageTimeout; }
 #endif
 
+    EventDispatcher& eventDispatcher() { return m_eventDispatcher; }
+
 private:
     WebProcess();
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to