Title: [182005] trunk/Source/WebKit2
Revision
182005
Author
[email protected]
Date
2015-03-26 00:51:33 -0700 (Thu, 26 Mar 2015)

Log Message

Avoid the Vector<> copy in WebTouchEvent constructor
https://bugs.webkit.org/show_bug.cgi?id=143043

Reviewed by Carlos Garcia Campos.

Have the WebTouchEvent accept a Vector<> rvalue.
The relevant code is updated so the Vector<> object is moved
through the call chain and finally into the WebTouchEvent constructor.

* Shared/NativeWebTouchEvent.h:
* Shared/WebEvent.h:
* Shared/WebTouchEvent.cpp:
(WebKit::WebTouchEvent::WebTouchEvent):
* Shared/efl/WebEventFactory.cpp:
(WebKit::WebEventFactory::createWebTouchEvent):
* Shared/gtk/NativeWebTouchEventGtk.cpp:
(WebKit::NativeWebTouchEvent::NativeWebTouchEvent):
* Shared/gtk/WebEventFactory.cpp:
(WebKit::WebEventFactory::createWebTouchEvent):
* Shared/gtk/WebEventFactory.h:
* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(webkitWebViewBaseTouchEvent):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (182004 => 182005)


--- trunk/Source/WebKit2/ChangeLog	2015-03-26 07:17:08 UTC (rev 182004)
+++ trunk/Source/WebKit2/ChangeLog	2015-03-26 07:51:33 UTC (rev 182005)
@@ -1,3 +1,28 @@
+2015-03-26  Zan Dobersek  <[email protected]>
+
+        Avoid the Vector<> copy in WebTouchEvent constructor
+        https://bugs.webkit.org/show_bug.cgi?id=143043
+
+        Reviewed by Carlos Garcia Campos.
+
+        Have the WebTouchEvent accept a Vector<> rvalue.
+        The relevant code is updated so the Vector<> object is moved
+        through the call chain and finally into the WebTouchEvent constructor.
+
+        * Shared/NativeWebTouchEvent.h:
+        * Shared/WebEvent.h:
+        * Shared/WebTouchEvent.cpp:
+        (WebKit::WebTouchEvent::WebTouchEvent):
+        * Shared/efl/WebEventFactory.cpp:
+        (WebKit::WebEventFactory::createWebTouchEvent):
+        * Shared/gtk/NativeWebTouchEventGtk.cpp:
+        (WebKit::NativeWebTouchEvent::NativeWebTouchEvent):
+        * Shared/gtk/WebEventFactory.cpp:
+        (WebKit::WebEventFactory::createWebTouchEvent):
+        * Shared/gtk/WebEventFactory.h:
+        * UIProcess/API/gtk/WebKitWebViewBase.cpp:
+        (webkitWebViewBaseTouchEvent):
+
 2015-03-25  Chris Dumez  <[email protected]>
 
         [WK2] WebFrameLoaderClient::dispatchDecidePolicyForResponse() should always call the FramePolicyFunction

Modified: trunk/Source/WebKit2/Shared/NativeWebTouchEvent.h (182004 => 182005)


--- trunk/Source/WebKit2/Shared/NativeWebTouchEvent.h	2015-03-26 07:17:08 UTC (rev 182004)
+++ trunk/Source/WebKit2/Shared/NativeWebTouchEvent.h	2015-03-26 07:51:33 UTC (rev 182005)
@@ -47,8 +47,8 @@
 #if PLATFORM(IOS)
     explicit NativeWebTouchEvent(const _UIWebTouchEvent*);
 #elif PLATFORM(GTK)
+    NativeWebTouchEvent(GdkEvent*, Vector<WebPlatformTouchPoint>&&);
     NativeWebTouchEvent(const NativeWebTouchEvent&);
-    NativeWebTouchEvent(GdkEvent*, const Vector<WebPlatformTouchPoint>&);
     const GdkEvent* nativeEvent() const { return m_nativeEvent.get(); }
 #elif PLATFORM(EFL)
     NativeWebTouchEvent(EwkTouchEvent*, const WebCore::AffineTransform&);

Modified: trunk/Source/WebKit2/Shared/WebEvent.h (182004 => 182005)


--- trunk/Source/WebKit2/Shared/WebEvent.h	2015-03-26 07:17:08 UTC (rev 182004)
+++ trunk/Source/WebKit2/Shared/WebEvent.h	2015-03-26 07:51:33 UTC (rev 182005)
@@ -379,9 +379,7 @@
 class WebTouchEvent : public WebEvent {
 public:
     WebTouchEvent() { }
- 
-    // FIXME: It would be nice not to have to copy the Vector here.
-    WebTouchEvent(Type, Vector<WebPlatformTouchPoint>, Modifiers, double timestamp);
+    WebTouchEvent(Type, Vector<WebPlatformTouchPoint>&&, Modifiers, double timestamp);
 
     const Vector<WebPlatformTouchPoint>& touchPoints() const { return m_touchPoints; }
 

Modified: trunk/Source/WebKit2/Shared/WebTouchEvent.cpp (182004 => 182005)


--- trunk/Source/WebKit2/Shared/WebTouchEvent.cpp	2015-03-26 07:17:08 UTC (rev 182004)
+++ trunk/Source/WebKit2/Shared/WebTouchEvent.cpp	2015-03-26 07:51:33 UTC (rev 182005)
@@ -33,9 +33,9 @@
 
 namespace WebKit {
 
-WebTouchEvent::WebTouchEvent(WebEvent::Type type, Vector<WebPlatformTouchPoint> touchPoints, Modifiers modifiers, double timestamp)
+WebTouchEvent::WebTouchEvent(WebEvent::Type type, Vector<WebPlatformTouchPoint>&& touchPoints, Modifiers modifiers, double timestamp)
     : WebEvent(type, modifiers, timestamp)
-    , m_touchPoints(touchPoints)
+    , m_touchPoints(WTF::move(touchPoints))
 {
     ASSERT(isTouchEventType(type));
 }

Modified: trunk/Source/WebKit2/Shared/efl/WebEventFactory.cpp (182004 => 182005)


--- trunk/Source/WebKit2/Shared/efl/WebEventFactory.cpp	2015-03-26 07:17:08 UTC (rev 182004)
+++ trunk/Source/WebKit2/Shared/efl/WebEventFactory.cpp	2015-03-26 07:51:33 UTC (rev 182005)
@@ -275,7 +275,7 @@
             touchPoints.uncheckedAppend(WebPlatformTouchPoint(point->id(), toWebPlatformTouchPointState(point->state()), toIntPoint(point->screenPosition()), toWebContent.mapPoint(toIntPoint(point->position())), toIntSize(point->radius()), point->rotationAngle(), point->forceFactor()));
     }
 
-    return WebTouchEvent(toWebEventType(event->eventType()), touchPoints, toWebEventModifiers(event->modifiers()), event->timestamp());
+    return WebTouchEvent(toWebEventType(event->eventType()), WTF::move(touchPoints), toWebEventModifiers(event->modifiers()), event->timestamp());
 }
 #endif
 

Modified: trunk/Source/WebKit2/Shared/gtk/NativeWebTouchEventGtk.cpp (182004 => 182005)


--- trunk/Source/WebKit2/Shared/gtk/NativeWebTouchEventGtk.cpp	2015-03-26 07:17:08 UTC (rev 182004)
+++ trunk/Source/WebKit2/Shared/gtk/NativeWebTouchEventGtk.cpp	2015-03-26 07:51:33 UTC (rev 182005)
@@ -31,14 +31,14 @@
 
 namespace WebKit {
 
-NativeWebTouchEvent::NativeWebTouchEvent(GdkEvent* event, const Vector<WebPlatformTouchPoint>& touchPoints)
-    : WebTouchEvent(WebEventFactory::createWebTouchEvent(event, touchPoints))
+NativeWebTouchEvent::NativeWebTouchEvent(GdkEvent* event, Vector<WebPlatformTouchPoint>&& touchPoints)
+    : WebTouchEvent(WebEventFactory::createWebTouchEvent(event, WTF::move(touchPoints)))
     , m_nativeEvent(gdk_event_copy(event))
 {
 }
 
 NativeWebTouchEvent::NativeWebTouchEvent(const NativeWebTouchEvent& event)
-    : WebTouchEvent(WebEventFactory::createWebTouchEvent(event.nativeEvent(), event.touchPoints()))
+    : WebTouchEvent(WebEventFactory::createWebTouchEvent(event.nativeEvent(), Vector<WebPlatformTouchPoint>(event.touchPoints())))
     , m_nativeEvent(gdk_event_copy(event.nativeEvent()))
 {
 }

Modified: trunk/Source/WebKit2/Shared/gtk/WebEventFactory.cpp (182004 => 182005)


--- trunk/Source/WebKit2/Shared/gtk/WebEventFactory.cpp	2015-03-26 07:17:08 UTC (rev 182004)
+++ trunk/Source/WebKit2/Shared/gtk/WebEventFactory.cpp	2015-03-26 07:51:33 UTC (rev 182005)
@@ -204,7 +204,7 @@
                             gdk_event_get_time(event));
 }
 
-WebTouchEvent WebEventFactory::createWebTouchEvent(const GdkEvent* event, const Vector<WebPlatformTouchPoint>& touchPoints)
+WebTouchEvent WebEventFactory::createWebTouchEvent(const GdkEvent* event, Vector<WebPlatformTouchPoint>&& touchPoints)
 {
 #ifndef GTK_API_VERSION_2
     WebEvent::Type type = WebEvent::NoType;
@@ -222,7 +222,7 @@
         ASSERT_NOT_REACHED();
     }
 
-    return WebTouchEvent(type, touchPoints, modifiersForEvent(event), gdk_event_get_time(event));
+    return WebTouchEvent(type, WTF::move(touchPoints), modifiersForEvent(event), gdk_event_get_time(event));
 #else
     return WebTouchEvent();
 #endif // GTK_API_VERSION_2

Modified: trunk/Source/WebKit2/Shared/gtk/WebEventFactory.h (182004 => 182005)


--- trunk/Source/WebKit2/Shared/gtk/WebEventFactory.h	2015-03-26 07:17:08 UTC (rev 182004)
+++ trunk/Source/WebKit2/Shared/gtk/WebEventFactory.h	2015-03-26 07:51:33 UTC (rev 182005)
@@ -39,7 +39,7 @@
     static WebMouseEvent createWebMouseEvent(const GdkEvent*, int);
     static WebWheelEvent createWebWheelEvent(const GdkEvent*);
     static WebKeyboardEvent createWebKeyboardEvent(const GdkEvent*, const WebCore::CompositionResults&);
-    static WebTouchEvent createWebTouchEvent(const GdkEvent*, const Vector<WebPlatformTouchPoint>&);
+    static WebTouchEvent createWebTouchEvent(const GdkEvent*, Vector<WebPlatformTouchPoint>&&);
 };
 
 } // namespace WebKit

Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp (182004 => 182005)


--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp	2015-03-26 07:17:08 UTC (rev 182004)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp	2015-03-26 07:51:33 UTC (rev 182005)
@@ -917,7 +917,7 @@
 
     Vector<WebPlatformTouchPoint> touchPoints;
     webkitWebViewBaseGetTouchPointsForEvent(webViewBase, touchEvent, touchPoints);
-    priv->pageProxy->handleTouchEvent(NativeWebTouchEvent(reinterpret_cast<GdkEvent*>(event), touchPoints));
+    priv->pageProxy->handleTouchEvent(NativeWebTouchEvent(reinterpret_cast<GdkEvent*>(event), WTF::move(touchPoints)));
 
     return TRUE;
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to