Diff
Modified: trunk/Tools/ChangeLog (156099 => 156100)
--- trunk/Tools/ChangeLog 2013-09-19 16:00:36 UTC (rev 156099)
+++ trunk/Tools/ChangeLog 2013-09-19 16:06:06 UTC (rev 156100)
@@ -1,3 +1,22 @@
+2013-09-18 Sam Weinig <[email protected]>
+
+ Replace use of OwnArrayPtr<Foo> with std::unique_ptr<Foo[]> in Tools
+ https://bugs.webkit.org/show_bug.cgi?id=121588
+
+ Reviewed by Anders Carlsson.
+
+ * DumpRenderTree/TestRunner.cpp:
+ * ImageDiff/efl/ImageDiff.cpp:
+ * TestWebKitAPI/_javascript_Test.cpp:
+ * TestWebKitAPI/PlatformUtilities.cpp:
+ * TestWebKitAPI/mac/PlatformUtilitiesMac.mm:
+ * WebKitTestRunner/InjectedBundle/EventSendingController.cpp:
+ * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+ * WebKitTestRunner/StringFunctions.h:
+ * WebKitTestRunner/TestInvocation.cpp:
+ * WebKitTestRunner/efl/EventSenderProxyEfl.cpp:
+ * WebKitTestRunner/gtk/EventSenderProxyGtk.cpp:
+
2013-09-18 Bem Jones-Bey <[email protected]>
W3C Test Import script reformats test HTML
Modified: trunk/Tools/DumpRenderTree/TestRunner.cpp (156099 => 156100)
--- trunk/Tools/DumpRenderTree/TestRunner.cpp 2013-09-19 16:00:36 UTC (rev 156099)
+++ trunk/Tools/DumpRenderTree/TestRunner.cpp 2013-09-19 16:06:06 UTC (rev 156100)
@@ -42,8 +42,8 @@
#include <wtf/Assertions.h>
#include <wtf/CurrentTime.h>
#include <wtf/MathExtras.h>
-#include <wtf/OwnArrayPtr.h>
#include <wtf/RefPtr.h>
+#include <wtf/StdLibExtras.h>
#if PLATFORM(MAC)
#include <Carbon/Carbon.h>
@@ -337,7 +337,7 @@
ASSERT(!*exception);
size_t maxLength = JSStringGetMaximumUTF8CStringSize(encodedAudioData.get());
- OwnArrayPtr<char> encodedAudioDataBuffer = adoptArrayPtr(new char[maxLength + 1]);
+ auto encodedAudioDataBuffer = std::make_unique<char[]>(maxLength + 1);
JSStringGetUTF8CString(encodedAudioData.get(), encodedAudioDataBuffer.get(), maxLength + 1);
TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject));
@@ -388,11 +388,11 @@
ASSERT(!*exception);
size_t maxLength = JSStringGetMaximumUTF8CStringSize(origin.get());
- OwnArrayPtr<char> originBuffer = adoptArrayPtr(new char[maxLength + 1]);
+ auto originBuffer = std::make_unique<char[]>(maxLength + 1);
JSStringGetUTF8CString(origin.get(), originBuffer.get(), maxLength + 1);
maxLength = JSStringGetMaximumUTF8CStringSize(destination.get());
- OwnArrayPtr<char> destinationBuffer = adoptArrayPtr(new char[maxLength + 1]);
+ auto destinationBuffer = std::make_unique<char[]>(maxLength + 1);
JSStringGetUTF8CString(destination.get(), destinationBuffer.get(), maxLength + 1);
TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject));
@@ -1417,7 +1417,7 @@
ASSERT(!*exception);
size_t maxLength = JSStringGetMaximumUTF8CStringSize(header.get());
- OwnArrayPtr<char> headerBuffer = adoptArrayPtr(new char[maxLength + 1]);
+ auto headerBuffer = std::make_unique<char[]>(maxLength + 1);
JSStringGetUTF8CString(header.get(), headerBuffer.get(), maxLength + 1);
TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject));
Modified: trunk/Tools/ImageDiff/efl/ImageDiff.cpp (156099 => 156100)
--- trunk/Tools/ImageDiff/efl/ImageDiff.cpp 2013-09-19 16:00:36 UTC (rev 156099)
+++ trunk/Tools/ImageDiff/efl/ImageDiff.cpp 2013-09-19 16:06:06 UTC (rev 156100)
@@ -42,10 +42,10 @@
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
-#include <wtf/OwnArrayPtr.h>
#include <wtf/OwnPtr.h>
#include <wtf/PassOwnPtr.h>
#include <wtf/PassRefPtr.h>
+#include <wtf/StdLibExtras.h>
#include <wtf/efl/RefPtrEfl.h>
enum PixelComponent {
@@ -119,7 +119,7 @@
return 100; // Completely different.
}
- OwnArrayPtr<unsigned char> diffBuffer = adoptArrayPtr(new unsigned char[width * height]);
+ auto diffBuffer = std::make_unique<unsigned char[]>(width * height);
if (!diffBuffer)
abortWithErrorMessage("could not create difference buffer");
@@ -258,7 +258,7 @@
static PassRefPtr<Evas_Object> readImageFromStdin(Evas* evas, long imageSize)
{
- OwnArrayPtr<unsigned char> imageBuffer = adoptArrayPtr(new unsigned char[imageSize]);
+ auto imageBuffer = std::make_unique<unsigned char[]>(imageSize);
if (!imageBuffer)
abortWithErrorMessage("cannot allocate image");
Modified: trunk/Tools/TestWebKitAPI/_javascript_Test.cpp (156099 => 156100)
--- trunk/Tools/TestWebKitAPI/_javascript_Test.cpp 2013-09-19 16:00:36 UTC (rev 156099)
+++ trunk/Tools/TestWebKitAPI/_javascript_Test.cpp 2013-09-19 16:06:06 UTC (rev 156100)
@@ -32,7 +32,7 @@
#include <_javascript_Core/JSRetainPtr.h>
#include <WebKit2/WKRetainPtr.h>
#include <WebKit2/WKSerializedScriptValue.h>
-#include <wtf/OwnArrayPtr.h>
+#include <wtf/StdLibExtras.h>
namespace TestWebKitAPI {
@@ -72,7 +72,7 @@
Util::run(&context.didFinish);
size_t bufferSize = JSStringGetMaximumUTF8CStringSize(context.actualString.get());
- OwnArrayPtr<char> buffer = adoptArrayPtr(new char[bufferSize]);
+ auto buffer = std::make_unique<char[]>(bufferSize);
JSStringGetUTF8CString(context.actualString.get(), buffer.get(), bufferSize);
return compareJSResult(script, buffer.get(), expectedResult);
Modified: trunk/Tools/TestWebKitAPI/PlatformUtilities.cpp (156099 => 156100)
--- trunk/Tools/TestWebKitAPI/PlatformUtilities.cpp 2013-09-19 16:00:36 UTC (rev 156099)
+++ trunk/Tools/TestWebKitAPI/PlatformUtilities.cpp 2013-09-19 16:06:06 UTC (rev 156100)
@@ -26,7 +26,7 @@
#include "config.h"
#include "PlatformUtilities.h"
-#include <wtf/OwnArrayPtr.h>
+#include <wtf/StdLibExtras.h>
namespace TestWebKitAPI {
namespace Util {
@@ -66,7 +66,7 @@
std::string toSTD(WKStringRef string)
{
size_t bufferSize = WKStringGetMaximumUTF8CStringSize(string);
- OwnArrayPtr<char> buffer = adoptArrayPtr(new char[bufferSize]);
+ auto buffer = std::make_unique<char[]>(bufferSize);
size_t stringLength = WKStringGetUTF8CString(string, buffer.get(), bufferSize);
return std::string(buffer.get(), stringLength - 1);
}
Modified: trunk/Tools/TestWebKitAPI/mac/PlatformUtilitiesMac.mm (156099 => 156100)
--- trunk/Tools/TestWebKitAPI/mac/PlatformUtilitiesMac.mm 2013-09-19 16:00:36 UTC (rev 156099)
+++ trunk/Tools/TestWebKitAPI/mac/PlatformUtilitiesMac.mm 2013-09-19 16:06:06 UTC (rev 156100)
@@ -30,8 +30,8 @@
#include <WebKit2/WKStringCF.h>
#include <WebKit2/WKURLCF.h>
#include <WebKit2/WKURLResponseNS.h>
-#include <wtf/OwnArrayPtr.h>
#include <wtf/RetainPtr.h>
+#include <wtf/StdLibExtras.h>
namespace TestWebKitAPI {
namespace Util {
@@ -82,7 +82,7 @@
return std::string();
size_t bufferSize = [string lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
- OwnArrayPtr<char> buffer = adoptArrayPtr(new char[bufferSize]);
+ auto buffer = std::make_unique<char[]>(bufferSize);
NSUInteger stringLength;
[string getBytes:buffer.get() maxLength:bufferSize usedLength:&stringLength encoding:NSUTF8StringEncoding options:0 range:NSMakeRange(0, [string length]) remainingRange:0];
return std::string(buffer.get(), stringLength);
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp (156099 => 156100)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp 2013-09-19 16:00:36 UTC (rev 156099)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp 2013-09-19 16:06:06 UTC (rev 156100)
@@ -37,6 +37,7 @@
#include <WebKit2/WKContextMenuItem.h>
#include <WebKit2/WKMutableDictionary.h>
#include <WebKit2/WKNumber.h>
+#include <wtf/StdLibExtras.h>
namespace WTR {
@@ -381,7 +382,7 @@
WKRetainPtr<WKArrayRef> menuEntries = adoptWK(WKBundlePageCopyContextMenuItems(page));
size_t entriesSize = WKArrayGetSize(menuEntries.get());
- OwnArrayPtr<JSValueRef> jsValuesArray = adoptArrayPtr(new JSValueRef[entriesSize]);
+ auto jsValuesArray = std::make_unique<JSValueRef[]>(entriesSize);
for (size_t i = 0; i < entriesSize; ++i) {
ASSERT(WKGetTypeID(WKArrayGetItemAtIndex(menuEntries.get(), i)) == WKContextMenuItemGetTypeID());
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (156099 => 156100)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp 2013-09-19 16:00:36 UTC (rev 156099)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp 2013-09-19 16:06:06 UTC (rev 156100)
@@ -49,7 +49,7 @@
#include <WebKit2/WebKit2_C.h>
#include <wtf/CurrentTime.h>
#include <wtf/HashMap.h>
-#include <wtf/OwnArrayPtr.h>
+#include <wtf/StdLibExtras.h>
#include <wtf/text/CString.h>
#include <wtf/text/StringBuilder.h>
@@ -279,7 +279,7 @@
{
const size_t count = WKArrayGetSize(strings);
- OwnArrayPtr<JSValueRef> jsStringsArray = adoptArrayPtr(new JSValueRef[count]);
+ auto jsStringsArray = std::make_unique<JSValueRef[]>(count);
for (size_t i = 0; i < count; ++i) {
WKStringRef stringRef = static_cast<WKStringRef>(WKArrayGetItemAtIndex(strings, i));
JSRetainPtr<JSStringRef> stringJS = toJS(stringRef);
Modified: trunk/Tools/WebKitTestRunner/StringFunctions.h (156099 => 156100)
--- trunk/Tools/WebKitTestRunner/StringFunctions.h 2013-09-19 16:00:36 UTC (rev 156099)
+++ trunk/Tools/WebKitTestRunner/StringFunctions.h 2013-09-19 16:06:06 UTC (rev 156100)
@@ -35,11 +35,11 @@
#include <WebKit2/WKString.h>
#include <WebKit2/WKStringPrivate.h>
#include <WebKit2/WKURL.h>
-#include <wtf/OwnArrayPtr.h>
#include <wtf/Platform.h>
+#include <wtf/StdLibExtras.h>
+#include <wtf/Vector.h>
#include <wtf/text/CString.h>
#include <wtf/text/WTFString.h>
-#include <wtf/Vector.h>
namespace WTR {
@@ -73,7 +73,7 @@
inline std::string toSTD(WKStringRef string)
{
size_t bufferSize = WKStringGetMaximumUTF8CStringSize(string);
- OwnArrayPtr<char> buffer = adoptArrayPtr(new char[bufferSize]);
+ auto buffer = std::make_unique<char[]>(bufferSize);
size_t stringLength = WKStringGetUTF8CString(string, buffer.get(), bufferSize);
return std::string(buffer.get(), stringLength - 1);
}
@@ -86,7 +86,7 @@
inline WTF::String toWTFString(WKStringRef string)
{
size_t bufferSize = WKStringGetMaximumUTF8CStringSize(string);
- OwnArrayPtr<char> buffer = adoptArrayPtr(new char[bufferSize]);
+ auto buffer = std::make_unique<char[]>(bufferSize);
size_t stringLength = WKStringGetUTF8CString(string, buffer.get(), bufferSize);
return WTF::String::fromUTF8WithLatin1Fallback(buffer.get(), stringLength - 1);
}
Modified: trunk/Tools/WebKitTestRunner/TestInvocation.cpp (156099 => 156100)
--- trunk/Tools/WebKitTestRunner/TestInvocation.cpp 2013-09-19 16:00:36 UTC (rev 156099)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.cpp 2013-09-19 16:06:06 UTC (rev 156100)
@@ -37,8 +37,8 @@
#include <WebKit2/WKDictionary.h>
#include <WebKit2/WKInspector.h>
#include <WebKit2/WKRetainPtr.h>
-#include <wtf/OwnArrayPtr.h>
#include <wtf/PassOwnPtr.h>
+#include <wtf/StdLibExtras.h>
#include <wtf/text/CString.h>
#if PLATFORM(MAC)
@@ -81,13 +81,13 @@
#endif
static const size_t prefixLength = strlen(filePrefix);
- OwnArrayPtr<char> buffer;
+ std::unique_ptr<char[]> buffer;
if (isAbsolutePath) {
- buffer = adoptArrayPtr(new char[prefixLength + length + 1]);
+ buffer = std::make_unique<char[]>(prefixLength + length + 1);
strcpy(buffer.get(), filePrefix);
strcpy(buffer.get() + prefixLength, pathOrURL);
} else {
- buffer = adoptArrayPtr(new char[prefixLength + PATH_MAX + length + 2]); // 1 for the separator
+ buffer = std::make_unique<char[]>(prefixLength + PATH_MAX + length + 2); // 1 for the separator
strcpy(buffer.get(), filePrefix);
if (!getcwd(buffer.get() + prefixLength, PATH_MAX))
return 0;
Modified: trunk/Tools/WebKitTestRunner/efl/EventSenderProxyEfl.cpp (156099 => 156100)
--- trunk/Tools/WebKitTestRunner/efl/EventSenderProxyEfl.cpp 2013-09-19 16:00:36 UTC (rev 156099)
+++ trunk/Tools/WebKitTestRunner/efl/EventSenderProxyEfl.cpp 2013-09-19 16:06:06 UTC (rev 156100)
@@ -38,7 +38,7 @@
#include <Ecore.h>
#include <Ecore_Evas.h>
#include <unistd.h>
-#include <wtf/OwnArrayPtr.h>
+#include <wtf/StdLibExtras.h>
#include <wtf/text/CString.h>
#include <wtf/text/WTFString.h>
@@ -191,7 +191,7 @@
return adoptRef(new KeyEventInfo("KP_Delete", ""));
size_t bufferSize = WKStringGetMaximumUTF8CStringSize(keyRef);
- OwnArrayPtr<char> buffer = adoptArrayPtr(new char[bufferSize]);
+ auto buffer = std::make_unique<char[]>(bufferSize);
WKStringGetUTF8CString(keyRef, buffer.get(), bufferSize);
return adoptRef(new KeyEventInfo(buffer.get(), buffer.get()));
}
@@ -260,7 +260,7 @@
return adoptRef(new KeyEventInfo("F12", ""));
size_t bufferSize = WKStringGetMaximumUTF8CStringSize(keyRef);
- OwnArrayPtr<char> buffer = adoptArrayPtr(new char[bufferSize]);
+ auto buffer = std::make_unique<char[]>(bufferSize);
WKStringGetUTF8CString(keyRef, buffer.get(), bufferSize);
char charCode = buffer.get()[0];
Modified: trunk/Tools/WebKitTestRunner/gtk/EventSenderProxyGtk.cpp (156099 => 156100)
--- trunk/Tools/WebKitTestRunner/gtk/EventSenderProxyGtk.cpp 2013-09-19 16:00:36 UTC (rev 156099)
+++ trunk/Tools/WebKitTestRunner/gtk/EventSenderProxyGtk.cpp 2013-09-19 16:06:06 UTC (rev 156100)
@@ -35,9 +35,9 @@
#include "PlatformWebView.h"
#include "TestController.h"
-#include <wtf/OwnArrayPtr.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
+#include <wtf/StdLibExtras.h>
#include <wtf/gobject/GOwnPtr.h>
#include <wtf/text/WTFString.h>
@@ -266,7 +266,7 @@
return GDK_KEY_F12;
size_t bufferSize = WKStringGetMaximumUTF8CStringSize(keyRef);
- OwnArrayPtr<char> buffer = adoptArrayPtr(new char[bufferSize]);
+ auto buffer = std::make_unique<char[]>(bufferSize);
WKStringGetUTF8CString(keyRef, buffer.get(), bufferSize);
char charCode = buffer.get()[0];