Title: [206930] trunk/Source/WebKit2
Revision
206930
Author
[email protected]
Date
2016-10-07 13:25:07 -0700 (Fri, 07 Oct 2016)

Log Message

Adopt BlockPtr in ViewGestureController
https://bugs.webkit.org/show_bug.cgi?id=163132

Reviewed by Anders Carlsson.

* UIProcess/Cocoa/WebViewImpl.h:
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::setDidMoveSwipeSnapshotCallback):
* UIProcess/ViewGestureController.cpp:
(WebKit::ViewGestureController::SnapshotRemovalTracker::stopWaitingForEvent):
* UIProcess/mac/ViewGestureController.h:
(WebKit::ViewGestureController::setDidMoveSwipeSnapshotCallback):
(WebKit::ViewGestureController::m_didMoveSwipeSnapshotCallback): Deleted.
* UIProcess/mac/ViewGestureControllerMac.mm:
(WebKit::ViewGestureController::platformTeardown):
(WebKit::ViewGestureController::setDidMoveSwipeSnapshotCallback): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (206929 => 206930)


--- trunk/Source/WebKit2/ChangeLog	2016-10-07 20:04:46 UTC (rev 206929)
+++ trunk/Source/WebKit2/ChangeLog	2016-10-07 20:25:07 UTC (rev 206930)
@@ -1,3 +1,22 @@
+2016-10-07  Tim Horton  <[email protected]>
+
+        Adopt BlockPtr in ViewGestureController
+        https://bugs.webkit.org/show_bug.cgi?id=163132
+
+        Reviewed by Anders Carlsson.
+
+        * UIProcess/Cocoa/WebViewImpl.h:
+        * UIProcess/Cocoa/WebViewImpl.mm:
+        (WebKit::WebViewImpl::setDidMoveSwipeSnapshotCallback):
+        * UIProcess/ViewGestureController.cpp:
+        (WebKit::ViewGestureController::SnapshotRemovalTracker::stopWaitingForEvent):
+        * UIProcess/mac/ViewGestureController.h:
+        (WebKit::ViewGestureController::setDidMoveSwipeSnapshotCallback):
+        (WebKit::ViewGestureController::m_didMoveSwipeSnapshotCallback): Deleted.
+        * UIProcess/mac/ViewGestureControllerMac.mm:
+        (WebKit::ViewGestureController::platformTeardown):
+        (WebKit::ViewGestureController::setDidMoveSwipeSnapshotCallback): Deleted.
+
 2016-10-07  Anders Carlsson  <[email protected]>
 
         Get rid of WKPageSetSession

Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h (206929 => 206930)


--- trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h	2016-10-07 20:04:46 UTC (rev 206929)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h	2016-10-07 20:25:07 UTC (rev 206930)
@@ -35,6 +35,7 @@
 #include <WebCore/TextIndicatorWindow.h>
 #include <WebCore/UserInterfaceLayoutDirection.h>
 #include <functional>
+#include <wtf/BlockPtr.h>
 #include <wtf/RetainPtr.h>
 #include <wtf/WeakPtr.h>
 #include <wtf/text/WTFString.h>
@@ -418,7 +419,7 @@
     void setCustomSwipeViews(NSArray *);
     void setCustomSwipeViewsTopContentInset(float);
     bool tryToSwipeWithEvent(NSEvent *, bool ignoringPinnedState);
-    void setDidMoveSwipeSnapshotCallback(void(^)(CGRect));
+    void setDidMoveSwipeSnapshotCallback(BlockPtr<void (CGRect)>&&);
 
     void scrollWheel(NSEvent *);
     void swipeWithEvent(NSEvent *);

Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm (206929 => 206930)


--- trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm	2016-10-07 20:04:46 UTC (rev 206929)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm	2016-10-07 20:25:07 UTC (rev 206930)
@@ -3276,12 +3276,12 @@
     return handledEvent;
 }
 
-void WebViewImpl::setDidMoveSwipeSnapshotCallback(void(^callback)(CGRect))
+void WebViewImpl::setDidMoveSwipeSnapshotCallback(BlockPtr<void (CGRect)>&& callback)
 {
     if (!m_allowsBackForwardNavigationGestures)
         return;
 
-    ensureGestureController().setDidMoveSwipeSnapshotCallback(callback);
+    ensureGestureController().setDidMoveSwipeSnapshotCallback(WTFMove(callback));
 }
 
 void WebViewImpl::scrollWheel(NSEvent *event)

Modified: trunk/Source/WebKit2/UIProcess/ViewGestureController.cpp (206929 => 206930)


--- trunk/Source/WebKit2/UIProcess/ViewGestureController.cpp	2016-10-07 20:04:46 UTC (rev 206929)
+++ trunk/Source/WebKit2/UIProcess/ViewGestureController.cpp	2016-10-07 20:25:07 UTC (rev 206930)
@@ -232,7 +232,7 @@
 #if LOG_DISABLED
     UNUSED_PARAM(logReason);
 #endif
-    log(logReason +  eventsDescription(event));
+    log(logReason + eventsDescription(event));
 
     m_outstandingEvents &= ~event;
 

Modified: trunk/Source/WebKit2/UIProcess/mac/ViewGestureController.h (206929 => 206930)


--- trunk/Source/WebKit2/UIProcess/mac/ViewGestureController.h	2016-10-07 20:04:46 UTC (rev 206929)
+++ trunk/Source/WebKit2/UIProcess/mac/ViewGestureController.h	2016-10-07 20:25:07 UTC (rev 206930)
@@ -32,6 +32,7 @@
 #include <WebCore/Color.h>
 #include <WebCore/FloatRect.h>
 #include <chrono>
+#include <wtf/BlockPtr.h>
 #include <wtf/RetainPtr.h>
 #include <wtf/RunLoop.h>
 
@@ -100,7 +101,7 @@
     void setCustomSwipeViews(Vector<RetainPtr<NSView>> views) { m_customSwipeViews = WTFMove(views); }
     void setCustomSwipeViewsTopContentInset(float topContentInset) { m_customSwipeViewsTopContentInset = topContentInset; }
     WebCore::FloatRect windowRelativeBoundsForCustomSwipeViews() const;
-    void setDidMoveSwipeSnapshotCallback(void(^)(CGRect));
+    void setDidMoveSwipeSnapshotCallback(BlockPtr<void (CGRect)>&& callback) { m_didMoveSwipeSnapshotCallback = WTFMove(callback); }
 
     bool shouldIgnorePinnedState() { return m_pendingSwipeTracker.shouldIgnorePinnedState(); }
     void setShouldIgnorePinnedState(bool ignore) { m_pendingSwipeTracker.setShouldIgnorePinnedState(ignore); }
@@ -265,7 +266,7 @@
 
     PendingSwipeTracker m_pendingSwipeTracker;
 
-    void (^m_didMoveSwipeSnapshotCallback)(CGRect) { nullptr };
+    BlockPtr<void (CGRect)> m_didMoveSwipeSnapshotCallback;
 
     bool m_hasOutstandingRepaintRequest { false };
 #else    

Modified: trunk/Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm (206929 => 206930)


--- trunk/Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm	2016-10-07 20:04:46 UTC (rev 206929)
+++ trunk/Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm	2016-10-07 20:25:07 UTC (rev 206930)
@@ -91,11 +91,6 @@
 
     if (m_activeGestureType == ViewGestureType::Swipe)
         removeSwipeSnapshot();
-
-    if (m_didMoveSwipeSnapshotCallback) {
-        Block_release(m_didMoveSwipeSnapshotCallback);
-        m_didMoveSwipeSnapshotCallback = nullptr;
-    }
 }
 
 static double resistanceForDelta(double deltaScale, double currentScale)
@@ -722,13 +717,6 @@
     }
 }
 
-void ViewGestureController::setDidMoveSwipeSnapshotCallback(void(^callback)(CGRect))
-{
-    if (m_didMoveSwipeSnapshotCallback)
-        Block_release(m_didMoveSwipeSnapshotCallback);
-    m_didMoveSwipeSnapshotCallback = Block_copy(callback);
-}
-
 void ViewGestureController::didMoveSwipeSnapshotLayer()
 {
     if (!m_didMoveSwipeSnapshotCallback)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to