2010-07-12 Maciej Stachowiak <mjs@apple.com>
authormjs@apple.com <mjs@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 Jul 2010 03:39:08 +0000 (03:39 +0000)
committermjs@apple.com <mjs@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 Jul 2010 03:39:08 +0000 (03:39 +0000)
        Reviewed by Dan Bernstein.

        Remove use of auto_ptr in WebKitTestRunner
        https://bugs.webkit.org/show_bug.cgi?id=42134

        Replaced auto_ptr with PassOwnPtr / OwnPtr.

        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
        (WTR::WKStringToUTF8):
        (WTR::InjectedBundlePage::dump):
        (WTR::InjectedBundlePage::addMessageToConsole):
        * WebKitTestRunner/TestInvocation.cpp:
        (WTR::WKStringToUTF8):
        (WTR::TestInvocation::didRecieveMessageFromInjectedBundle):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@63164 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKitTools/ChangeLog
WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
WebKitTools/WebKitTestRunner/TestInvocation.cpp

index 212c8b78ad5bb094a0c88139ca134b22f46774d0..b6233c49c089a3216946b52212471f032a1483e6 100644 (file)
@@ -1,3 +1,20 @@
+2010-07-12  Maciej Stachowiak  <mjs@apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        Remove use of auto_ptr in WebKitTestRunner
+        https://bugs.webkit.org/show_bug.cgi?id=42134
+        
+        Replaced auto_ptr with PassOwnPtr / OwnPtr.
+
+        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
+        (WTR::WKStringToUTF8):
+        (WTR::InjectedBundlePage::dump):
+        (WTR::InjectedBundlePage::addMessageToConsole):
+        * WebKitTestRunner/TestInvocation.cpp:
+        (WTR::WKStringToUTF8):
+        (WTR::TestInvocation::didRecieveMessageFromInjectedBundle):
+
 2010-07-12  Maciej Stachowiak  <mjs@apple.com>
 
         Reviewed by Sam Weinig.
index c0060c37964d143654d0cd5c3449f593d13f9253..b25440587c331ce3426de3d984a3e0740adda5c6 100644 (file)
@@ -31,6 +31,7 @@
 #include <WebKit2/WKRetainPtr.h>
 #include <WebKit2/WKString.h>
 #include <WebKit2/WKStringCF.h>
+#include <wtf/PassOwnPtr.h>
 #include <wtf/RetainPtr.h>
 #include <wtf/Vector.h>
 
@@ -127,17 +128,17 @@ void InjectedBundlePage::didCommitLoadForFrame(WKBundleFrameRef frame)
 {
 }
 
-static std::auto_ptr<Vector<char> > WKStringToUTF8(WKStringRef wkStringRef)
+static PassOwnPtr<Vector<char> > WKStringToUTF8(WKStringRef wkStringRef)
 {
     RetainPtr<CFStringRef> cfString(AdoptCF, WKStringCopyCFString(0, wkStringRef));
     CFIndex bufferLength = CFStringGetMaximumSizeForEncoding(CFStringGetLength(cfString.get()), kCFStringEncodingUTF8) + 1;
-    std::auto_ptr<Vector<char> > buffer(new Vector<char>(bufferLength));
+    OwnPtr<Vector<char> > buffer(new Vector<char>(bufferLength));
     if (!CFStringGetCString(cfString.get(), buffer->data(), bufferLength, kCFStringEncodingUTF8)) {
         buffer->shrink(1);
         (*buffer)[0] = 0;
     } else
         buffer->shrink(strlen(buffer->data()) + 1);
-    return buffer;
+    return buffer.release();
 }
 
 void InjectedBundlePage::dump()
@@ -147,11 +148,11 @@ void InjectedBundlePage::dump()
     if (InjectedBundle::shared().layoutTestController()->dumpAsText()) {
         // FIXME: Support dumping subframes when layoutTestController()->dumpChildFramesAsText() is true.
         WKRetainPtr<WKStringRef> innerText(AdoptWK, WKBundleFrameCopyInnerText(WKBundlePageGetMainFrame(m_page)));
-        std::auto_ptr<Vector<char> > utf8InnerText = WKStringToUTF8(innerText.get());
+        OwnPtr<Vector<char> > utf8InnerText = WKStringToUTF8(innerText.get());
         InjectedBundle::shared().os() << utf8InnerText->data() << "\n";
     } else {
         WKRetainPtr<WKStringRef> externalRepresentation(AdoptWK, WKBundlePageCopyRenderTreeExternalRepresentation(m_page));
-        std::auto_ptr<Vector<char> > utf8externalRepresentation = WKStringToUTF8(externalRepresentation.get());
+        OwnPtr<Vector<char> > utf8externalRepresentation = WKStringToUTF8(externalRepresentation.get());
         InjectedBundle::shared().os() << utf8externalRepresentation->data();
     }
     InjectedBundle::shared().done();
@@ -200,7 +201,7 @@ void InjectedBundlePage::_addMessageToConsole(WKBundlePageRef page, WKStringRef
 void InjectedBundlePage::addMessageToConsole(WKStringRef message, uint32_t lineNumber)
 {
     // FIXME: Strip file: urls.
-    std::auto_ptr<Vector<char> > utf8Message = WKStringToUTF8(message);
+    OwnPtr<Vector<char> > utf8Message = WKStringToUTF8(message);
     InjectedBundle::shared().os() << "CONSOLE MESSAGE: line " << lineNumber << ": " << utf8Message->data() << "\n";
 }
 
index 8da23916ac99ba57cd4870fac42bdddd5bc93168..d3bb8d20847963cb93b63d24a8dae825b253d168 100644 (file)
@@ -31,8 +31,9 @@
 #include <WebKit2/WKRetainPtr.h>
 #include <WebKit2/WKStringCF.h>
 #include <WebKit2/WKURLCF.h>
-#include <wtf/Vector.h>
+#include <wtf/PassOwnPtr.h>
 #include <wtf/RetainPtr.h>
+#include <wtf/Vector.h>
 
 using namespace WebKit;
 
@@ -49,17 +50,17 @@ static WKURLRef createWKURL(const char* pathOrURL)
     return WKURLCreateWithCFURL(cfURL.get());
 }
 
-static std::auto_ptr<Vector<char> > WKStringToUTF8(WKStringRef wkStringRef)
+static PassOwnPtr<Vector<char> > WKStringToUTF8(WKStringRef wkStringRef)
 {
     RetainPtr<CFStringRef> cfString(AdoptCF, WKStringCopyCFString(0, wkStringRef));
     CFIndex bufferLength = CFStringGetMaximumSizeForEncoding(CFStringGetLength(cfString.get()), kCFStringEncodingUTF8) + 1;
-    std::auto_ptr<Vector<char> > buffer(new Vector<char>(bufferLength));
+    OwnPtr<Vector<char> > buffer(new Vector<char>(bufferLength));
     if (!CFStringGetCString(cfString.get(), buffer->data(), bufferLength, kCFStringEncodingUTF8)) {
         buffer->shrink(1);
         (*buffer)[0] = 0;
     } else
         buffer->shrink(strlen(buffer->data()) + 1);
-    return buffer;
+    return buffer.release();
 }
 
 TestInvocation::TestInvocation(const char* pathOrURL)
@@ -142,7 +143,7 @@ void TestInvocation::didRecieveMessageFromInjectedBundle(WKStringRef message)
         return;
     }
 
-    std::auto_ptr<Vector<char> > utf8Message = WKStringToUTF8(message);
+    OwnPtr<Vector<char> > utf8Message = WKStringToUTF8(message);
 
     dump(utf8Message->data());
     m_gotFinalMessage = true;