Diff
Modified: trunk/Source/WebCore/ChangeLog (176779 => 176780)
--- trunk/Source/WebCore/ChangeLog 2014-12-04 02:52:51 UTC (rev 176779)
+++ trunk/Source/WebCore/ChangeLog 2014-12-04 03:02:57 UTC (rev 176780)
@@ -1,3 +1,43 @@
+2014-12-03 Joonghun Park <[email protected]>
+
+ Use std::unique_ptr instead of PassOwnPtr|OwnPtr for Pasteboard
+ https://bugs.webkit.org/show_bug.cgi?id=139019
+
+ Reviewed by Darin Adler.
+
+ No new tests, no behavior changes.
+
+ * dom/DataTransfer.cpp:
+ (WebCore::DataTransfer::DataTransfer):
+ * dom/DataTransfer.h:
+ * editing/Editor.cpp:
+ (WebCore::Editor::dispatchCPPEvent):
+ * page/mac/EventHandlerMac.mm:
+ (WebCore::EventHandler::createDraggingDataTransfer):
+ * platform/Pasteboard.h:
+ * platform/efl/PasteboardEfl.cpp:
+ (WebCore::Pasteboard::createForCopyAndPaste):
+ (WebCore::Pasteboard::createPrivate):
+ (WebCore::Pasteboard::createForDragAndDrop):
+ * platform/gtk/PasteboardGtk.cpp:
+ (WebCore::Pasteboard::createForCopyAndPaste):
+ (WebCore::Pasteboard::createForGlobalSelection):
+ (WebCore::Pasteboard::createPrivate):
+ (WebCore::Pasteboard::createForDragAndDrop):
+ (WebCore::Pasteboard::create): Deleted.
+ * platform/ios/PasteboardIOS.mm:
+ (WebCore::Pasteboard::createForCopyAndPaste):
+ (WebCore::Pasteboard::createPrivate):
+ * platform/mac/PasteboardMac.mm:
+ (WebCore::Pasteboard::createForCopyAndPaste):
+ (WebCore::Pasteboard::createPrivate):
+ (WebCore::Pasteboard::createForDragAndDrop):
+ (WebCore::Pasteboard::create): Deleted.
+ * platform/win/PasteboardWin.cpp:
+ (WebCore::Pasteboard::createForCopyAndPaste):
+ (WebCore::Pasteboard::createPrivate):
+ (WebCore::Pasteboard::createForDragAndDrop):
+
2014-12-03 Benjamin Poulain <[email protected]>
Get rid of FrameLoaderClient::dispatchWillRequestResource
Modified: trunk/Source/WebCore/dom/DataTransfer.cpp (176779 => 176780)
--- trunk/Source/WebCore/dom/DataTransfer.cpp 2014-12-04 02:52:51 UTC (rev 176779)
+++ trunk/Source/WebCore/dom/DataTransfer.cpp 2014-12-04 03:02:57 UTC (rev 176780)
@@ -55,9 +55,9 @@
#endif
-DataTransfer::DataTransfer(DataTransferAccessPolicy policy, PassOwnPtr<Pasteboard> pasteboard, Type type, bool forFileDrag)
+DataTransfer::DataTransfer(DataTransferAccessPolicy policy, std::unique_ptr<Pasteboard> pasteboard, Type type, bool forFileDrag)
: m_policy(policy)
- , m_pasteboard(pasteboard)
+ , m_pasteboard(WTF::move(pasteboard))
#if ENABLE(DRAG_SUPPORT)
, m_forDrag(type != CopyAndPaste)
, m_forFileDrag(forFileDrag)
Modified: trunk/Source/WebCore/dom/DataTransfer.h (176779 => 176780)
--- trunk/Source/WebCore/dom/DataTransfer.h 2014-12-04 02:52:51 UTC (rev 176779)
+++ trunk/Source/WebCore/dom/DataTransfer.h 2014-12-04 03:02:57 UTC (rev 176780)
@@ -99,14 +99,14 @@
private:
enum Type { CopyAndPaste, DragAndDrop };
- DataTransfer(DataTransferAccessPolicy, PassOwnPtr<Pasteboard>, Type = CopyAndPaste, bool forFileDrag = false);
+ DataTransfer(DataTransferAccessPolicy, std::unique_ptr<Pasteboard>, Type = CopyAndPaste, bool forFileDrag = false);
#if ENABLE(DRAG_SUPPORT)
bool canSetDragImage() const;
#endif
DataTransferAccessPolicy m_policy;
- OwnPtr<Pasteboard> m_pasteboard;
+ std::unique_ptr<Pasteboard> m_pasteboard;
mutable RefPtr<FileList> m_fileList;
Modified: trunk/Source/WebCore/editing/Editor.cpp (176779 => 176780)
--- trunk/Source/WebCore/editing/Editor.cpp 2014-12-04 02:52:51 UTC (rev 176779)
+++ trunk/Source/WebCore/editing/Editor.cpp 2014-12-04 03:02:57 UTC (rev 176780)
@@ -857,7 +857,7 @@
target->dispatchEvent(event, IGNORE_EXCEPTION);
bool noDefaultProcessing = event->defaultPrevented();
if (noDefaultProcessing && policy == DataTransferAccessPolicy::Writable) {
- OwnPtr<Pasteboard> pasteboard = Pasteboard::createForCopyAndPaste();
+ auto pasteboard = Pasteboard::createForCopyAndPaste();
pasteboard->clear();
pasteboard->writePasteboard(dataTransfer->pasteboard());
}
Modified: trunk/Source/WebCore/page/mac/EventHandlerMac.mm (176779 => 176780)
--- trunk/Source/WebCore/page/mac/EventHandlerMac.mm 2014-12-04 02:52:51 UTC (rev 176779)
+++ trunk/Source/WebCore/page/mac/EventHandlerMac.mm 2014-12-04 03:02:57 UTC (rev 176780)
@@ -681,7 +681,7 @@
{
// Must be done before ondragstart adds types and data to the pboard,
// also done for security, as it erases data from the last drag.
- OwnPtr<Pasteboard> pasteboard = Pasteboard::create(NSDragPboard);
+ auto pasteboard = std::make_unique<Pasteboard>(NSDragPboard);
pasteboard->clear();
return DataTransfer::createForDragAndDrop();
}
Modified: trunk/Source/WebCore/platform/Pasteboard.h (176779 => 176780)
--- trunk/Source/WebCore/platform/Pasteboard.h 2014-12-04 02:52:51 UTC (rev 176779)
+++ trunk/Source/WebCore/platform/Pasteboard.h 2014-12-04 03:02:57 UTC (rev 176780)
@@ -139,11 +139,23 @@
class Pasteboard {
WTF_MAKE_NONCOPYABLE(Pasteboard); WTF_MAKE_FAST_ALLOCATED;
public:
+ Pasteboard();
~Pasteboard();
- WEBCORE_EXPORT static PassOwnPtr<Pasteboard> createForCopyAndPaste();
- static PassOwnPtr<Pasteboard> createPrivate(); // Temporary pasteboard. Can put data on this and then write to another pasteboard with writePasteboard.
+#if PLATFORM(GTK)
+ explicit Pasteboard(PassRefPtr<DataObjectGtk>);
+ explicit Pasteboard(GtkClipboard*);
+#endif
+#if PLATFORM(WIN)
+ explicit Pasteboard(IDataObject*);
+ explicit Pasteboard(WCDataObject*);
+ explicit Pasteboard(const DragDataMap&);
+#endif
+
+ WEBCORE_EXPORT static std::unique_ptr<Pasteboard> createForCopyAndPaste();
+ static std::unique_ptr<Pasteboard> createPrivate(); // Temporary pasteboard. Can put data on this and then write to another pasteboard with writePasteboard.
+
bool hasData();
Vector<String> types();
String readString(const String& type);
@@ -168,8 +180,8 @@
void writePasteboard(const Pasteboard& sourcePasteboard);
#if ENABLE(DRAG_SUPPORT)
- static PassOwnPtr<Pasteboard> createForDragAndDrop();
- static PassOwnPtr<Pasteboard> createForDragAndDrop(const DragData&);
+ static std::unique_ptr<Pasteboard> createForDragAndDrop();
+ static std::unique_ptr<Pasteboard> createForDragAndDrop(const DragData&);
void setDragImage(DragImageRef, const IntPoint& hotSpot);
#endif
@@ -181,10 +193,8 @@
#endif
#if PLATFORM(GTK)
- static PassOwnPtr<Pasteboard> create(PassRefPtr<DataObjectGtk>);
- static PassOwnPtr<Pasteboard> create(GtkClipboard*);
PassRefPtr<DataObjectGtk> dataObject() const;
- static PassOwnPtr<Pasteboard> createForGlobalSelection();
+ static std::unique_ptr<Pasteboard> createForGlobalSelection();
#endif
#if PLATFORM(IOS)
@@ -194,7 +204,6 @@
#if PLATFORM(MAC)
explicit Pasteboard(const String& pasteboardName);
- static PassOwnPtr<Pasteboard> create(const String& pasteboardName);
const String& name() const { return m_pasteboardName; }
#endif
@@ -209,18 +218,7 @@
#endif
private:
- Pasteboard();
-
-#if PLATFORM(GTK)
- Pasteboard(PassRefPtr<DataObjectGtk>);
- Pasteboard(GtkClipboard*);
-#endif
-
#if PLATFORM(WIN)
- explicit Pasteboard(IDataObject*);
- explicit Pasteboard(WCDataObject*);
- explicit Pasteboard(const DragDataMap&);
-
void finishCreatingPasteboard();
void writeRangeToDataObject(Range&, Frame&); // FIXME: Layering violation.
void writeURLToDataObject(const URL&, const String&);
Modified: trunk/Source/WebCore/platform/efl/PasteboardEfl.cpp (176779 => 176780)
--- trunk/Source/WebCore/platform/efl/PasteboardEfl.cpp 2014-12-04 02:52:51 UTC (rev 176779)
+++ trunk/Source/WebCore/platform/efl/PasteboardEfl.cpp 2014-12-04 03:02:57 UTC (rev 176780)
@@ -24,7 +24,6 @@
#include "Pasteboard.h"
#include "NotImplemented.h"
-#include <wtf/PassOwnPtr.h>
namespace WebCore {
@@ -48,25 +47,25 @@
return false;
}
-PassOwnPtr<Pasteboard> Pasteboard::createForCopyAndPaste()
+std::unique_ptr<Pasteboard> Pasteboard::createForCopyAndPaste()
{
- return adoptPtr(new Pasteboard);
+ return std::make_unique<Pasteboard>();
}
-PassOwnPtr<Pasteboard> Pasteboard::createPrivate()
+std::unique_ptr<Pasteboard> Pasteboard::createPrivate()
{
- return createForCopyAndPaste();
+ return std::make_unique<Pasteboard>();
}
#if ENABLE(DRAG_SUPPORT)
-PassOwnPtr<Pasteboard> Pasteboard::createForDragAndDrop()
+std::unique_ptr<Pasteboard> Pasteboard::createForDragAndDrop()
{
- return createForCopyAndPaste();
+ return std::make_unique<Pasteboard>();
}
-PassOwnPtr<Pasteboard> Pasteboard::createForDragAndDrop(const DragData&)
+std::unique_ptr<Pasteboard> Pasteboard::createForDragAndDrop(const DragData&)
{
- return createForCopyAndPaste();
+ return std::make_unique<Pasteboard>();
}
#endif
Modified: trunk/Source/WebCore/platform/gtk/PasteboardGtk.cpp (176779 => 176780)
--- trunk/Source/WebCore/platform/gtk/PasteboardGtk.cpp 2014-12-04 02:52:51 UTC (rev 176779)
+++ trunk/Source/WebCore/platform/gtk/PasteboardGtk.cpp 2014-12-04 03:02:57 UTC (rev 176780)
@@ -26,7 +26,6 @@
#include "URL.h"
#include "PasteboardHelper.h"
#include <gtk/gtk.h>
-#include <wtf/PassOwnPtr.h>
namespace WebCore {
@@ -39,40 +38,30 @@
ClipboardDataTypeUnknown
};
-PassOwnPtr<Pasteboard> Pasteboard::create(GtkClipboard* gtkClipboard)
+std::unique_ptr<Pasteboard> Pasteboard::createForCopyAndPaste()
{
- return adoptPtr(new Pasteboard(gtkClipboard));
+ return std::make_unique<Pasteboard>(gtk_clipboard_get(GDK_SELECTION_CLIPBOARD));
}
-PassOwnPtr<Pasteboard> Pasteboard::create(PassRefPtr<DataObjectGtk> dataObject)
+std::unique_ptr<Pasteboard> Pasteboard::createForGlobalSelection()
{
- return adoptPtr(new Pasteboard(dataObject));
+ return std::make_unique<Pasteboard>(gtk_clipboard_get(GDK_SELECTION_PRIMARY));
}
-PassOwnPtr<Pasteboard> Pasteboard::createForCopyAndPaste()
+std::unique_ptr<Pasteboard> Pasteboard::createPrivate()
{
- return create(gtk_clipboard_get(GDK_SELECTION_CLIPBOARD));
+ return std::make_unique<Pasteboard>(DataObjectGtk::create());
}
-PassOwnPtr<Pasteboard> Pasteboard::createForGlobalSelection()
-{
- return create(gtk_clipboard_get(GDK_SELECTION_PRIMARY));
-}
-
-PassOwnPtr<Pasteboard> Pasteboard::createPrivate()
-{
- return create(DataObjectGtk::create());
-}
-
#if ENABLE(DRAG_SUPPORT)
-PassOwnPtr<Pasteboard> Pasteboard::createForDragAndDrop()
+std::unique_ptr<Pasteboard> Pasteboard::createForDragAndDrop()
{
- return create(DataObjectGtk::create());
+ return std::make_unique<Pasteboard>(DataObjectGtk::create());
}
-PassOwnPtr<Pasteboard> Pasteboard::createForDragAndDrop(const DragData& dragData)
+std::unique_ptr<Pasteboard> Pasteboard::createForDragAndDrop(const DragData& dragData)
{
- return create(dragData.platformData());
+ return std::make_unique<Pasteboard>(dragData.platformData());
}
#endif
Modified: trunk/Source/WebCore/platform/ios/PasteboardIOS.mm (176779 => 176780)
--- trunk/Source/WebCore/platform/ios/PasteboardIOS.mm 2014-12-04 02:52:51 UTC (rev 176779)
+++ trunk/Source/WebCore/platform/ios/PasteboardIOS.mm 2014-12-04 03:02:57 UTC (rev 176780)
@@ -121,14 +121,14 @@
{
}
-PassOwnPtr<Pasteboard> Pasteboard::createForCopyAndPaste()
+std::unique_ptr<Pasteboard> Pasteboard::createForCopyAndPaste()
{
- return adoptPtr(new Pasteboard);
+ return std::make_unique<Pasteboard>();
}
-PassOwnPtr<Pasteboard> Pasteboard::createPrivate()
+std::unique_ptr<Pasteboard> Pasteboard::createPrivate()
{
- return adoptPtr(new Pasteboard);
+ return std::make_unique<Pasteboard>();
}
void Pasteboard::write(const PasteboardWebContent& content)
Modified: trunk/Source/WebCore/platform/mac/PasteboardMac.mm (176779 => 176780)
--- trunk/Source/WebCore/platform/mac/PasteboardMac.mm 2014-12-04 02:52:51 UTC (rev 176779)
+++ trunk/Source/WebCore/platform/mac/PasteboardMac.mm 2014-12-04 03:02:57 UTC (rev 176780)
@@ -123,30 +123,25 @@
ASSERT(pasteboardName);
}
-PassOwnPtr<Pasteboard> Pasteboard::create(const String& pasteboardName)
+std::unique_ptr<Pasteboard> Pasteboard::createForCopyAndPaste()
{
- return adoptPtr(new Pasteboard(pasteboardName));
+ return std::make_unique<Pasteboard>(NSGeneralPboard);
}
-PassOwnPtr<Pasteboard> Pasteboard::createForCopyAndPaste()
+std::unique_ptr<Pasteboard> Pasteboard::createPrivate()
{
- return create(NSGeneralPboard);
+ return std::make_unique<Pasteboard>(platformStrategies()->pasteboardStrategy()->uniqueName());
}
-PassOwnPtr<Pasteboard> Pasteboard::createPrivate()
-{
- return create(platformStrategies()->pasteboardStrategy()->uniqueName());
-}
-
#if ENABLE(DRAG_SUPPORT)
-PassOwnPtr<Pasteboard> Pasteboard::createForDragAndDrop()
+std::unique_ptr<Pasteboard> Pasteboard::createForDragAndDrop()
{
- return create(NSDragPboard);
+ return std::make_unique<Pasteboard>(NSDragPboard);
}
-PassOwnPtr<Pasteboard> Pasteboard::createForDragAndDrop(const DragData& dragData)
+std::unique_ptr<Pasteboard> Pasteboard::createForDragAndDrop(const DragData& dragData)
{
- return create(dragData.pasteboardName());
+ return std::make_unique<Pasteboard>(dragData.pasteboardName());
}
#endif
Modified: trunk/Source/WebCore/platform/win/PasteboardWin.cpp (176779 => 176780)
--- trunk/Source/WebCore/platform/win/PasteboardWin.cpp 2014-12-04 02:52:51 UTC (rev 176779)
+++ trunk/Source/WebCore/platform/win/PasteboardWin.cpp 2014-12-04 03:02:57 UTC (rev 176780)
@@ -90,37 +90,37 @@
return lresult;
}
-PassOwnPtr<Pasteboard> Pasteboard::createForCopyAndPaste()
+std::unique_ptr<Pasteboard> Pasteboard::createForCopyAndPaste()
{
- OwnPtr<Pasteboard> pasteboard = adoptPtr(new Pasteboard);
+ auto pasteboard = std::make_unique<Pasteboard>();
COMPtr<IDataObject> clipboardData;
if (!SUCCEEDED(OleGetClipboard(&clipboardData)))
clipboardData = 0;
pasteboard->setExternalDataObject(clipboardData.get());
- return pasteboard.release();
+ return pasteboard;
}
-PassOwnPtr<Pasteboard> Pasteboard::createPrivate()
+std::unique_ptr<Pasteboard> Pasteboard::createPrivate()
{
// Windows has no "Private pasteboard" concept.
return createForCopyAndPaste();
}
#if ENABLE(DRAG_SUPPORT)
-PassOwnPtr<Pasteboard> Pasteboard::createForDragAndDrop()
+std::unique_ptr<Pasteboard> Pasteboard::createForDragAndDrop()
{
COMPtr<WCDataObject> dataObject;
WCDataObject::createInstance(&dataObject);
- return adoptPtr(new Pasteboard(dataObject.get()));
+ return std::make_unique<Pasteboard>(dataObject.get());
}
// static
-PassOwnPtr<Pasteboard> Pasteboard::createForDragAndDrop(const DragData& dragData)
+std::unique_ptr<Pasteboard> Pasteboard::createForDragAndDrop(const DragData& dragData)
{
if (dragData.platformData())
- return adoptPtr(new Pasteboard(dragData.platformData()));
+ return std::make_unique<Pasteboard>(dragData.platformData());
// FIXME: Should add a const overload of dragDataMap so we don't need a const_cast here.
- return adoptPtr(new Pasteboard(const_cast<DragData&>(dragData).dragDataMap()));
+ return std::make_unique<Pasteboard>(const_cast<DragData&>(dragData).dragDataMap());
}
#endif