Diff
Modified: trunk/Source/WebCore/ChangeLog (136493 => 136494)
--- trunk/Source/WebCore/ChangeLog 2012-12-04 10:25:44 UTC (rev 136493)
+++ trunk/Source/WebCore/ChangeLog 2012-12-04 10:32:55 UTC (rev 136494)
@@ -1,3 +1,18 @@
+2012-12-04 Carlos Garcia Campos <cgar...@igalia.com>
+
+ [GTK] Avoid unnecessary heap allocations during drag and drop operations
+ https://bugs.webkit.org/show_bug.cgi?id=87938
+
+ Reviewed by Martin Robinson.
+
+ * platform/gtk/GtkDragAndDropHelper.cpp:
+ (WebCore::GtkDragAndDropHelper::handleDragMotion): Return a
+ pointer to the DataObjectGtk so that the caller can create the
+ DragData object in the stack.
+ (WebCore::GtkDragAndDropHelper::handleDragDataReceived): Ditto.
+ (WebCore::GtkDragAndDropHelper::handleDragDrop): Ditto.
+ * platform/gtk/GtkDragAndDropHelper.h:
+
2012-12-04 Alexander Pavlov <apav...@chromium.org>
Web Inspector: [Overrides] Add ability to override the page CSS media type
Modified: trunk/Source/WebCore/platform/gtk/GtkDragAndDropHelper.cpp (136493 => 136494)
--- trunk/Source/WebCore/platform/gtk/GtkDragAndDropHelper.cpp 2012-12-04 10:25:44 UTC (rev 136493)
+++ trunk/Source/WebCore/platform/gtk/GtkDragAndDropHelper.cpp 2012-12-04 10:32:55 UTC (rev 136494)
@@ -25,7 +25,6 @@
#include "GtkVersioning.h"
#include "PasteboardHelper.h"
#include <gtk/gtk.h>
-#include <wtf/PassOwnPtr.h>
namespace WebCore {
@@ -131,7 +130,7 @@
gtk_drag_get_data(widget, gdkContext, acceptableTargets.at(i), time);
}
-PassOwnPtr<DragData> GtkDragAndDropHelper::handleDragMotion(GdkDragContext* context, const IntPoint& position, unsigned time)
+DataObjectGtk* GtkDragAndDropHelper::handleDragMotion(GdkDragContext* context, const IntPoint& position, unsigned time)
{
DroppingContext* droppingContext = 0;
DroppingContextMap::iterator iterator = m_droppingContexts.find(context);
@@ -149,48 +148,42 @@
// for the drag's data.
ASSERT(droppingContext);
if (droppingContext->pendingDataRequests > 0)
- return adoptPtr(static_cast<DragData*>(0));
+ return 0;
- return adoptPtr(new DragData(droppingContext->dataObject.get(), position,
- convertWidgetPointToScreenPoint(m_widget, position),
- gdkDragActionToDragOperation(gdk_drag_context_get_actions(context))));
+ return droppingContext->dataObject.get();
}
-PassOwnPtr<DragData> GtkDragAndDropHelper::handleDragDataReceived(GdkDragContext* context, GtkSelectionData* selectionData, guint info)
+DataObjectGtk* GtkDragAndDropHelper::handleDragDataReceived(GdkDragContext* context, GtkSelectionData* selectionData, unsigned info, IntPoint& position)
{
DroppingContextMap::iterator iterator = m_droppingContexts.find(context);
if (iterator == m_droppingContexts.end())
- return adoptPtr(static_cast<DragData*>(0));
+ return 0;
DroppingContext* droppingContext = iterator->value;
droppingContext->pendingDataRequests--;
PasteboardHelper::defaultPasteboardHelper()->fillDataObjectFromDropData(selectionData, info, droppingContext->dataObject.get());
if (droppingContext->pendingDataRequests)
- return adoptPtr(static_cast<DragData*>(0));
+ return 0;
// The coordinates passed to drag-data-received signal are sometimes
// inaccurate in DRT, so use the coordinates of the last motion event.
- const IntPoint& position = droppingContext->lastMotionPosition;
+ position = droppingContext->lastMotionPosition;
// If there are no more pending requests, start sending dragging data to WebCore.
- return adoptPtr(new DragData(droppingContext->dataObject.get(), position,
- convertWidgetPointToScreenPoint(m_widget, position),
- gdkDragActionToDragOperation(gdk_drag_context_get_actions(context))));
+ return droppingContext->dataObject.get();
}
-PassOwnPtr<DragData> GtkDragAndDropHelper::handleDragDrop(GdkDragContext* context, const IntPoint& position)
+DataObjectGtk* GtkDragAndDropHelper::handleDragDrop(GdkDragContext* context)
{
DroppingContextMap::iterator iterator = m_droppingContexts.find(context);
if (iterator == m_droppingContexts.end())
- return adoptPtr(static_cast<DragData*>(0));
+ return 0;
DroppingContext* droppingContext = iterator->value;
droppingContext->dropHappened = true;
- return adoptPtr(new DragData(droppingContext->dataObject.get(), position,
- convertWidgetPointToScreenPoint(m_widget, position),
- gdkDragActionToDragOperation(gdk_drag_context_get_actions(context))));
+ return droppingContext->dataObject.get();
}
void GtkDragAndDropHelper::startedDrag(GdkDragContext* context, DataObjectGtk* dataObject)
Modified: trunk/Source/WebCore/platform/gtk/GtkDragAndDropHelper.h (136493 => 136494)
--- trunk/Source/WebCore/platform/gtk/GtkDragAndDropHelper.h 2012-12-04 10:25:44 UTC (rev 136493)
+++ trunk/Source/WebCore/platform/gtk/GtkDragAndDropHelper.h 2012-12-04 10:32:55 UTC (rev 136494)
@@ -47,9 +47,9 @@
void handleGetDragData(GdkDragContext*, GtkSelectionData*, guint info);
void handleDragLeave(GdkDragContext*, DragExitedCallback);
void handleDragLeaveLater(DroppingContext*);
- PassOwnPtr<DragData> handleDragMotion(GdkDragContext*, const IntPoint&, unsigned time);
- PassOwnPtr<DragData> handleDragDataReceived(GdkDragContext*, GtkSelectionData*, guint info);
- PassOwnPtr<DragData> handleDragDrop(GdkDragContext*, const IntPoint&);
+ DataObjectGtk* handleDragMotion(GdkDragContext*, const IntPoint&, unsigned time);
+ DataObjectGtk* handleDragDataReceived(GdkDragContext*, GtkSelectionData*, unsigned info, IntPoint&);
+ DataObjectGtk* handleDragDrop(GdkDragContext*);
void startedDrag(GdkDragContext*, DataObjectGtk*);
private:
Modified: trunk/Source/WebKit/gtk/ChangeLog (136493 => 136494)
--- trunk/Source/WebKit/gtk/ChangeLog 2012-12-04 10:25:44 UTC (rev 136493)
+++ trunk/Source/WebKit/gtk/ChangeLog 2012-12-04 10:32:55 UTC (rev 136494)
@@ -1,3 +1,16 @@
+2012-12-04 Carlos Garcia Campos <cgar...@igalia.com>
+
+ [GTK] Avoid unnecessary heap allocations during drag and drop operations
+ https://bugs.webkit.org/show_bug.cgi?id=87938
+
+ Reviewed by Martin Robinson.
+
+ * webkit/webkitwebview.cpp:
+ (webkit_web_view_drag_motion): Create DragData for the given
+ DataObjectGtk in the stack.
+ (webkit_web_view_drag_data_received): Ditto.
+ (webkit_web_view_drag_drop): Ditto.
+
2012-12-02 Mike West <mk...@chromium.org>
[gtk] Enable the CSP_NEXT runtime flag.
Modified: trunk/Source/WebKit/gtk/webkit/webkitwebview.cpp (136493 => 136494)
--- trunk/Source/WebKit/gtk/webkit/webkitwebview.cpp 2012-12-04 10:25:44 UTC (rev 136493)
+++ trunk/Source/WebKit/gtk/webkit/webkitwebview.cpp 2012-12-04 10:32:55 UTC (rev 136494)
@@ -1543,11 +1543,13 @@
static gboolean webkit_web_view_drag_motion(GtkWidget* widget, GdkDragContext* context, gint x, gint y, guint time)
{
WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
- OwnPtr<DragData> dragData(webView->priv->dragAndDropHelper.handleDragMotion(context, IntPoint(x, y), time));
- if (!dragData)
+ IntPoint position(x, y);
+ DataObjectGtk* dataObject = webView->priv->dragAndDropHelper.handleDragMotion(context, position, time);
+ if (!dataObject)
return TRUE;
- DragOperation operation = core(webView)->dragController()->dragUpdated(dragData.get()).operation;
+ DragData dragData(dataObject, position, convertWidgetPointToScreenPoint(widget, position), gdkDragActionToDragOperation(gdk_drag_context_get_actions(context)));
+ DragOperation operation = core(webView)->dragController()->dragUpdated(&dragData).operation;
gdk_drag_status(context, dragOperationToSingleGdkDragAction(operation), time);
return TRUE;
}
@@ -1555,22 +1557,26 @@
static void webkit_web_view_drag_data_received(GtkWidget* widget, GdkDragContext* context, gint x, gint y, GtkSelectionData* selectionData, guint info, guint time)
{
WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
- OwnPtr<DragData> dragData(webView->priv->dragAndDropHelper.handleDragDataReceived(context, selectionData, info));
- if (!dragData)
+ IntPoint position;
+ DataObjectGtk* dataObject = webView->priv->dragAndDropHelper.handleDragDataReceived(context, selectionData, info, position);
+ if (!dataObject)
return;
- DragOperation operation = core(webView)->dragController()->dragEntered(dragData.get()).operation;
+ DragData dragData(dataObject, position, convertWidgetPointToScreenPoint(widget, position), gdkDragActionToDragOperation(gdk_drag_context_get_actions(context)));
+ DragOperation operation = core(webView)->dragController()->dragEntered(&dragData).operation;
gdk_drag_status(context, dragOperationToSingleGdkDragAction(operation), time);
}
static gboolean webkit_web_view_drag_drop(GtkWidget* widget, GdkDragContext* context, gint x, gint y, guint time)
{
WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
- OwnPtr<DragData> dragData(webView->priv->dragAndDropHelper.handleDragDrop(context, IntPoint(x, y)));
- if (!dragData)
+ DataObjectGtk* dataObject = webView->priv->dragAndDropHelper.handleDragDrop(context);
+ if (!dataObject)
return FALSE;
- core(webView)->dragController()->performDrag(dragData.get());
+ IntPoint position(x, y);
+ DragData dragData(dataObject, position, convertWidgetPointToScreenPoint(widget, position), gdkDragActionToDragOperation(gdk_drag_context_get_actions(context)));
+ core(webView)->dragController()->performDrag(&dragData);
gtk_drag_finish(context, TRUE, FALSE, time);
return TRUE;
}
Modified: trunk/Source/WebKit2/ChangeLog (136493 => 136494)
--- trunk/Source/WebKit2/ChangeLog 2012-12-04 10:25:44 UTC (rev 136493)
+++ trunk/Source/WebKit2/ChangeLog 2012-12-04 10:32:55 UTC (rev 136494)
@@ -1,3 +1,16 @@
+2012-12-04 Carlos Garcia Campos <cgar...@igalia.com>
+
+ [GTK] Avoid unnecessary heap allocations during drag and drop operations
+ https://bugs.webkit.org/show_bug.cgi?id=87938
+
+ Reviewed by Martin Robinson.
+
+ * UIProcess/API/gtk/WebKitWebViewBase.cpp:
+ (webkitWebViewBaseDragDataReceived): Create DragData for the given
+ DataObjectGtk in the stack.
+ (webkitWebViewBaseDragMotion): Ditto.
+ (webkitWebViewBaseDragDrop): Ditto.
+
2012-12-04 Jaehun Lim <ljaehun....@samsung.com>
[EFL][WK2] Use consistent class names inside Ewk classes
Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp (136493 => 136494)
--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp 2012-12-04 10:25:44 UTC (rev 136493)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp 2012-12-04 10:32:55 UTC (rev 136494)
@@ -720,12 +720,14 @@
static void webkitWebViewBaseDragDataReceived(GtkWidget* widget, GdkDragContext* context, gint x, gint y, GtkSelectionData* selectionData, guint info, guint time)
{
WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget);
- OwnPtr<DragData> dragData(webViewBase->priv->dragAndDropHelper.handleDragDataReceived(context, selectionData, info));
- if (!dragData)
+ IntPoint position;
+ DataObjectGtk* dataObject = webViewBase->priv->dragAndDropHelper.handleDragDataReceived(context, selectionData, info, position);
+ if (!dataObject)
return;
+ DragData dragData(dataObject, position, convertWidgetPointToScreenPoint(widget, position), gdkDragActionToDragOperation(gdk_drag_context_get_actions(context)));
webViewBase->priv->pageProxy->resetDragOperation();
- webViewBase->priv->pageProxy->dragEntered(dragData.get());
+ webViewBase->priv->pageProxy->dragEntered(&dragData);
DragOperation operation = webViewBase->priv->pageProxy->dragSession().operation;
gdk_drag_status(context, dragOperationToSingleGdkDragAction(operation), time);
}
@@ -761,11 +763,13 @@
static gboolean webkitWebViewBaseDragMotion(GtkWidget* widget, GdkDragContext* context, gint x, gint y, guint time)
{
WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget);
- OwnPtr<DragData> dragData(webViewBase->priv->dragAndDropHelper.handleDragMotion(context, IntPoint(x, y), time));
- if (!dragData)
+ IntPoint position(x, y);
+ DataObjectGtk* dataObject = webViewBase->priv->dragAndDropHelper.handleDragMotion(context, position, time);
+ if (!dataObject)
return TRUE;
- webViewBase->priv->pageProxy->dragUpdated(dragData.get());
+ DragData dragData(dataObject, position, convertWidgetPointToScreenPoint(widget, position), gdkDragActionToDragOperation(gdk_drag_context_get_actions(context)));
+ webViewBase->priv->pageProxy->dragUpdated(&dragData);
DragOperation operation = webViewBase->priv->pageProxy->dragSession().operation;
gdk_drag_status(context, dragOperationToSingleGdkDragAction(operation), time);
return TRUE;
@@ -791,13 +795,15 @@
static gboolean webkitWebViewBaseDragDrop(GtkWidget* widget, GdkDragContext* context, gint x, gint y, guint time)
{
WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget);
- OwnPtr<DragData> dragData(webViewBase->priv->dragAndDropHelper.handleDragDrop(context, IntPoint(x, y)));
- if (!dragData)
+ DataObjectGtk* dataObject = webViewBase->priv->dragAndDropHelper.handleDragDrop(context);
+ if (!dataObject)
return FALSE;
+ IntPoint position(x, y);
+ DragData dragData(dataObject, position, convertWidgetPointToScreenPoint(widget, position), gdkDragActionToDragOperation(gdk_drag_context_get_actions(context)));
SandboxExtension::Handle handle;
SandboxExtension::HandleArray sandboxExtensionForUpload;
- webViewBase->priv->pageProxy->performDrag(dragData.get(), String(), handle, sandboxExtensionForUpload);
+ webViewBase->priv->pageProxy->performDrag(&dragData, String(), handle, sandboxExtensionForUpload);
gtk_drag_finish(context, TRUE, FALSE, time);
return TRUE;
}