2010-07-12 Maciej Stachowiak <mjs@apple.com>
authormjs@apple.com <mjs@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 Jul 2010 00:37:51 +0000 (00:37 +0000)
committermjs@apple.com <mjs@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 Jul 2010 00:37:51 +0000 (00:37 +0000)
        Reviewed by Anders Carlsson.

        Get rid of auto_ptr use in WebKit2
        https://bugs.webkit.org/show_bug.cgi?id=42119

        Replace all use of auto_ptr with OwnPtr/PassOwnPtr.

        * Platform/CoreIPC/Connection.cpp:
        (CoreIPC::Connection::sendMessage):
        (CoreIPC::Connection::waitForMessage):
        (CoreIPC::Connection::sendSyncMessage):
        (CoreIPC::Connection::processIncomingMessage):
        (CoreIPC::Connection::sendOutgoingMessages):
        (CoreIPC::Connection::dispatchMessages):
        * Platform/CoreIPC/Connection.h:
        (CoreIPC::Connection::Message::Message):
        (CoreIPC::Connection::send):
        (CoreIPC::Connection::sendSync):
        (CoreIPC::Connection::waitFor):
        * Platform/CoreIPC/mac/ConnectionMac.cpp:
        (CoreIPC::Connection::sendOutgoingMessage):
        (CoreIPC::createArgumentDecoder):
        (CoreIPC::Connection::receiveSourceEventHandler):
        * Platform/CoreIPC/qt/ConnectionQt.cpp:
        (CoreIPC::Connection::readyReadHandler):
        (CoreIPC::Connection::sendOutgoingMessage):
        * Platform/CoreIPC/win/ConnectionWin.cpp:
        (CoreIPC::Connection::readEventHandler):
        (CoreIPC::Connection::sendOutgoingMessage):
        * Platform/RunLoop.cpp:
        (RunLoop::performWork):
        (RunLoop::scheduleWork):
        * Platform/RunLoop.h:
        * Platform/WorkItem.h:
        (WorkItem::create):
        * Platform/WorkQueue.h:
        * Platform/mac/WorkQueueMac.cpp:
        (WorkQueue::executeWorkItem):
        (WorkQueue::scheduleWork):
        (WorkQueue::EventSource::EventSource):
        (WorkQueue::registerMachPortEventHandler):
        * Platform/qt/WorkQueueQt.cpp:
        (WorkQueue::connectSignal):
        (WorkQueue::scheduleWork):
        * Platform/win/WorkQueueWin.cpp:
        (WorkQueue::registerHandle):
        (WorkQueue::scheduleWork):
        (WorkQueue::performWork):
        * UIProcess/ChunkedUpdateDrawingAreaProxy.cpp:
        (WebKit::ChunkedUpdateDrawingAreaProxy::paint):
        * UIProcess/WebProcessProxy.cpp:
        (WebKit::WebProcessProxy::sendMessage):
        (WebKit::WebProcessProxy::didFinishLaunching):
        * UIProcess/WebProcessProxy.h:
        (WebKit::WebProcessProxy::send):

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

16 files changed:
WebKit2/ChangeLog
WebKit2/Platform/CoreIPC/Connection.cpp
WebKit2/Platform/CoreIPC/Connection.h
WebKit2/Platform/CoreIPC/mac/ConnectionMac.cpp
WebKit2/Platform/CoreIPC/qt/ConnectionQt.cpp
WebKit2/Platform/CoreIPC/win/ConnectionWin.cpp
WebKit2/Platform/RunLoop.cpp
WebKit2/Platform/RunLoop.h
WebKit2/Platform/WorkItem.h
WebKit2/Platform/WorkQueue.h
WebKit2/Platform/mac/WorkQueueMac.cpp
WebKit2/Platform/qt/WorkQueueQt.cpp
WebKit2/Platform/win/WorkQueueWin.cpp
WebKit2/UIProcess/ChunkedUpdateDrawingAreaProxy.cpp
WebKit2/UIProcess/WebProcessProxy.cpp
WebKit2/UIProcess/WebProcessProxy.h

index 4048162a297094b6d25ba0617a28aa37f7be074d..bb0a505179f9f5bdb191d824b429320b3315729a 100644 (file)
@@ -1,3 +1,61 @@
+2010-07-12  Maciej Stachowiak  <mjs@apple.com>
+
+        Reviewed by Anders Carlsson.
+
+        Get rid of auto_ptr use in WebKit2
+        https://bugs.webkit.org/show_bug.cgi?id=42119
+        
+        Replace all use of auto_ptr with OwnPtr/PassOwnPtr.
+
+        * Platform/CoreIPC/Connection.cpp:
+        (CoreIPC::Connection::sendMessage):
+        (CoreIPC::Connection::waitForMessage):
+        (CoreIPC::Connection::sendSyncMessage):
+        (CoreIPC::Connection::processIncomingMessage):
+        (CoreIPC::Connection::sendOutgoingMessages):
+        (CoreIPC::Connection::dispatchMessages):
+        * Platform/CoreIPC/Connection.h:
+        (CoreIPC::Connection::Message::Message):
+        (CoreIPC::Connection::send):
+        (CoreIPC::Connection::sendSync):
+        (CoreIPC::Connection::waitFor):
+        * Platform/CoreIPC/mac/ConnectionMac.cpp:
+        (CoreIPC::Connection::sendOutgoingMessage):
+        (CoreIPC::createArgumentDecoder):
+        (CoreIPC::Connection::receiveSourceEventHandler):
+        * Platform/CoreIPC/qt/ConnectionQt.cpp:
+        (CoreIPC::Connection::readyReadHandler):
+        (CoreIPC::Connection::sendOutgoingMessage):
+        * Platform/CoreIPC/win/ConnectionWin.cpp:
+        (CoreIPC::Connection::readEventHandler):
+        (CoreIPC::Connection::sendOutgoingMessage):
+        * Platform/RunLoop.cpp:
+        (RunLoop::performWork):
+        (RunLoop::scheduleWork):
+        * Platform/RunLoop.h:
+        * Platform/WorkItem.h:
+        (WorkItem::create):
+        * Platform/WorkQueue.h:
+        * Platform/mac/WorkQueueMac.cpp:
+        (WorkQueue::executeWorkItem):
+        (WorkQueue::scheduleWork):
+        (WorkQueue::EventSource::EventSource):
+        (WorkQueue::registerMachPortEventHandler):
+        * Platform/qt/WorkQueueQt.cpp:
+        (WorkQueue::connectSignal):
+        (WorkQueue::scheduleWork):
+        * Platform/win/WorkQueueWin.cpp:
+        (WorkQueue::registerHandle):
+        (WorkQueue::scheduleWork):
+        (WorkQueue::performWork):
+        * UIProcess/ChunkedUpdateDrawingAreaProxy.cpp:
+        (WebKit::ChunkedUpdateDrawingAreaProxy::paint):
+        * UIProcess/WebProcessProxy.cpp:
+        (WebKit::WebProcessProxy::sendMessage):
+        (WebKit::WebProcessProxy::didFinishLaunching):
+        * UIProcess/WebProcessProxy.h:
+        (WebKit::WebProcessProxy::send):
+
 2010-07-12  Ada Chan  <adachan@apple.com>
 
         Build fix.  Copy WKArray.h to the include directory.
index 609e9041e9b73773f21e5e63cc3f0c4588aad008..35e4e3f2a3a226ce74cd2d32379ec449faa252cb 100644 (file)
@@ -77,7 +77,7 @@ void Connection::invalidate()
     m_connectionQueue.scheduleWork(WorkItem::create(this, &Connection::platformInvalidate));
 }
 
-bool Connection::sendMessage(MessageID messageID, auto_ptr<ArgumentEncoder> arguments)
+bool Connection::sendMessage(MessageID messageID, PassOwnPtr<ArgumentEncoder> arguments)
 {
     if (!isValid())
         return false;
@@ -90,7 +90,7 @@ bool Connection::sendMessage(MessageID messageID, auto_ptr<ArgumentEncoder> argu
     return true;
 }
 
-std::auto_ptr<ArgumentDecoder> Connection::waitForMessage(MessageID messageID, uint64_t destinationID, double timeout)
+PassOwnPtr<ArgumentDecoder> Connection::waitForMessage(MessageID messageID, uint64_t destinationID, double timeout)
 {
     // First, check if this message is already in the incoming messages queue.
     {
@@ -100,11 +100,11 @@ std::auto_ptr<ArgumentDecoder> Connection::waitForMessage(MessageID messageID, u
             const IncomingMessage& message = m_incomingMessages[i];
 
             if (message.messageID() == messageID && message.arguments()->destinationID() == destinationID) {
-                std::auto_ptr<ArgumentDecoder> arguments(message.arguments());
+                OwnPtr<ArgumentDecoder> arguments(message.arguments());
                 
                 // Erase the incoming message.
                 m_incomingMessages.remove(i);
-                return arguments;
+                return arguments.release();
             }
         }
     }
@@ -131,10 +131,10 @@ std::auto_ptr<ArgumentDecoder> Connection::waitForMessage(MessageID messageID, u
 
         HashMap<std::pair<unsigned, uint64_t>, ArgumentDecoder*>::iterator it = m_waitForMessageMap.find(messageAndDestination);
         if (it->second) {
-            std::auto_ptr<ArgumentDecoder> arguments(it->second);
+            OwnPtr<ArgumentDecoder> arguments(it->second);
             m_waitForMessageMap.remove(it);
             
-            return arguments;
+            return arguments.release();
         }
         
         // We didn't find it, keep waiting.
@@ -147,20 +147,20 @@ std::auto_ptr<ArgumentDecoder> Connection::waitForMessage(MessageID messageID, u
         m_waitForMessageMap.remove(messageAndDestination);
     }
     
-    return std::auto_ptr<ArgumentDecoder>();
+    return PassOwnPtr<ArgumentDecoder>();
 }
 
-std::auto_ptr<ArgumentDecoder> Connection::sendSyncMessage(MessageID messageID, uint64_t syncRequestID, std::auto_ptr<ArgumentEncoder> encoder, double timeout)
+PassOwnPtr<ArgumentDecoder> Connection::sendSyncMessage(MessageID messageID, uint64_t syncRequestID, PassOwnPtr<ArgumentEncoder> encoder, double timeout)
 {
     // First send the message.
     if (!sendMessage(messageID, encoder))
-        return std::auto_ptr<ArgumentDecoder>();
+        return PassOwnPtr<ArgumentDecoder>();
 
     // Now wait for a reply and return it.
     return waitForMessage(MessageID(CoreIPCMessage::SyncMessageReply), syncRequestID, timeout);
 }
 
-void Connection::processIncomingMessage(MessageID messageID, std::auto_ptr<ArgumentDecoder> arguments)
+void Connection::processIncomingMessage(MessageID messageID, PassOwnPtr<ArgumentDecoder> arguments)
 {
     // First, check if we're waiting for this message.
     {
@@ -168,7 +168,7 @@ void Connection::processIncomingMessage(MessageID messageID, std::auto_ptr<Argum
         
         HashMap<std::pair<unsigned, uint64_t>, ArgumentDecoder*>::iterator it = m_waitForMessageMap.find(std::make_pair(messageID.toInt(), arguments->destinationID()));
         if (it != m_waitForMessageMap.end()) {
-            it->second = arguments.release();
+            it->second = arguments.leakPtr();
         
             m_waitForMessageCondition.signal();
             return;
@@ -216,7 +216,7 @@ void Connection::sendOutgoingMessages()
 
     // Send messages.
     for (size_t i = 0; i < outgoingMessages.size(); ++i)
-        sendOutgoingMessage(outgoingMessages[i].messageID(), std::auto_ptr<ArgumentEncoder>(outgoingMessages[i].arguments()));
+        sendOutgoingMessage(outgoingMessages[i].messageID(), adoptPtr(outgoingMessages[i].arguments()));
 }
 
 void Connection::dispatchMessages()
@@ -243,13 +243,13 @@ void Connection::dispatchMessages()
             }
 
             // Create our reply encoder.
-            std::auto_ptr<ArgumentEncoder> replyEncoder(new ArgumentEncoder(syncRequestID));
+            OwnPtr<ArgumentEncoder> replyEncoder(new ArgumentEncoder(syncRequestID));
             
             // Hand off both the decoder and encoder to the client..
             m_client->didReceiveSyncMessage(this, message.messageID(), arguments, replyEncoder.get());
             
             // Send the reply.
-            sendMessage(MessageID(CoreIPCMessage::SyncMessageReply), replyEncoder);
+            sendMessage(MessageID(CoreIPCMessage::SyncMessageReply), replyEncoder.release());
         } else
             m_client->didReceiveMessage(this, message.messageID(), arguments);
 
index 8d8e0cc76ce2a129f548fbcb445c7b05f3c95ed5..eace6e997ba4513dfd2589072e8dcaa09a4f2a11 100644 (file)
@@ -32,7 +32,6 @@
 #include "Arguments.h"
 #include "MessageID.h"
 #include "WorkQueue.h"
-#include <memory>
 #include <wtf/HashMap.h>
 #include <wtf/PassRefPtr.h>
 #include <wtf/OwnPtr.h>
@@ -86,16 +85,16 @@ public:
     static const unsigned long long NoTimeout = 10000000000ULL;
     template<typename E, typename T, typename U> bool sendSync(E messageID, uint64_t destinationID, const T& arguments, const U& reply, double timeout);
 
-    template<typename E> std::auto_ptr<ArgumentDecoder> waitFor(E messageID, uint64_t destinationID, double timeout);
+    template<typename E> PassOwnPtr<ArgumentDecoder> waitFor(E messageID, uint64_t destinationID, double timeout);
 
-    bool sendMessage(MessageID, std::auto_ptr<ArgumentEncoder>);
+    bool sendMessage(MessageID, PassOwnPtr<ArgumentEncoder>);
 
 private:
     template<typename T> class Message {
     public:
-        Message(MessageID messageID, std::auto_ptr<T> arguments)
+        Message(MessageID messageID, PassOwnPtr<T> arguments)
             : m_messageID(messageID)
-            , m_arguments(arguments.release())
+            , m_arguments(arguments.leakPtr())
         {
         }
         
@@ -122,13 +121,13 @@ private:
     
     bool isValid() const { return m_client; }
     
-    std::auto_ptr<ArgumentDecoder> sendSyncMessage(MessageID, uint64_t syncRequestID, std::auto_ptr<ArgumentEncoder>, double timeout);
-    std::auto_ptr<ArgumentDecoder> waitForMessage(MessageID, uint64_t destinationID, double timeout);
+    PassOwnPtr<ArgumentDecoder> sendSyncMessage(MessageID, uint64_t syncRequestID, PassOwnPtr<ArgumentEncoder>, double timeout);
+    PassOwnPtr<ArgumentDecoder> waitForMessage(MessageID, uint64_t destinationID, double timeout);
     
     // Called on the connection work queue.
-    void processIncomingMessage(MessageID, std::auto_ptr<ArgumentDecoder>);
+    void processIncomingMessage(MessageID, PassOwnPtr<ArgumentDecoder>);
     void sendOutgoingMessages();
-    void sendOutgoingMessage(MessageID, std::auto_ptr<ArgumentEncoder>);
+    void sendOutgoingMessage(MessageID, PassOwnPtr<ArgumentEncoder>);
     void connectionDidClose();
     
     // Called on the listener thread.
@@ -185,16 +184,16 @@ private:
 template<typename E, typename T>
 bool Connection::send(E messageID, uint64_t destinationID, const T& arguments)
 {
-    std::auto_ptr<ArgumentEncoder> argumentEncoder(new ArgumentEncoder(destinationID));
+    OwnPtr<ArgumentEncoder> argumentEncoder(new ArgumentEncoder(destinationID));
     argumentEncoder->encode(arguments);
 
-    return sendMessage(MessageID(messageID), argumentEncoder);
+    return sendMessage(MessageID(messageID), argumentEncoder.release());
 }
 
 template<typename E, typename T, typename U>
 inline bool Connection::sendSync(E messageID, uint64_t destinationID, const T& arguments, const U& reply, double timeout)
 {
-    std::auto_ptr<ArgumentEncoder> argumentEncoder(new ArgumentEncoder(destinationID));
+    OwnPtr<ArgumentEncoder> argumentEncoder(new ArgumentEncoder(destinationID));
 
     uint64_t syncRequestID = ++m_syncRequestID;
     
@@ -205,15 +204,15 @@ inline bool Connection::sendSync(E messageID, uint64_t destinationID, const T& a
     argumentEncoder->encode(arguments);
     
     // Now send the message and wait for a reply.
-    std::auto_ptr<ArgumentDecoder> replyDecoder = sendSyncMessage(MessageID(messageID, MessageID::SyncMessage), syncRequestID, argumentEncoder, timeout);
-    if (!replyDecoder.get())
+    OwnPtr<ArgumentDecoder> replyDecoder = sendSyncMessage(MessageID(messageID, MessageID::SyncMessage), syncRequestID, argumentEncoder.release(), timeout);
+    if (!replyDecoder)
         return false;
     
     // Decode the reply.
     return replyDecoder->decode(const_cast<U&>(reply));
 }
 
-template<typename E> inline std::auto_ptr<ArgumentDecoder> Connection::waitFor(E messageID, uint64_t destinationID, double timeout)
+template<typename E> inline PassOwnPtr<ArgumentDecoder> Connection::waitFor(E messageID, uint64_t destinationID, double timeout)
 {
     return waitForMessage(MessageID(messageID), destinationID, timeout);
 }
index 0941cc9f7114c1f5dda18869fcc48fd132ad2b49..efec2c84935862de0d4b3ad2a3e451be38859185 100644 (file)
@@ -111,7 +111,7 @@ static inline size_t machMessageSize(size_t bodySize, size_t numberOfPortDescrip
     return round_msg(size);
 }
 
-void Connection::sendOutgoingMessage(MessageID messageID, auto_ptr<ArgumentEncoder> arguments)
+void Connection::sendOutgoingMessage(MessageID messageID, PassOwnPtr<ArgumentEncoder> arguments)
 {
     Vector<Attachment> attachments = arguments->releaseAttachments();
     
@@ -205,14 +205,14 @@ void Connection::initializeDeadNameSource()
     m_connectionQueue.registerMachPortEventHandler(m_sendPort, WorkQueue::MachPortDeadNameNotification, WorkItem::create(this, &Connection::connectionDidClose));
 }
 
-static auto_ptr<ArgumentDecoder> createArgumentDecoder(mach_msg_header_t* header)
+static PassOwnPtr<ArgumentDecoder> createArgumentDecoder(mach_msg_header_t* header)
 {
     if (!(header->msgh_bits & MACH_MSGH_BITS_COMPLEX)) {
         // We have a simple message.
         size_t bodySize = header->msgh_size - sizeof(mach_msg_header_t);
         uint8_t* body = reinterpret_cast<uint8_t*>(header + 1);
         
-        return auto_ptr<ArgumentDecoder>(new ArgumentDecoder(body, bodySize));
+        return adoptPtr(new ArgumentDecoder(body, bodySize));
     }
 
     bool messageBodyIsOOL = header->msgh_id & MessageBodyIsOOL;
@@ -266,13 +266,13 @@ static auto_ptr<ArgumentDecoder> createArgumentDecoder(mach_msg_header_t* header
 
         vm_deallocate(mach_task_self(), reinterpret_cast<vm_address_t>(messageBodyAttachment.address()), messageBodyAttachment.size());
 
-        return auto_ptr<ArgumentDecoder>(argumentDecoder);
+        return adoptPtr(argumentDecoder);
     }
 
     uint8_t* messageBody = descriptorData;
     size_t messageBodySize = header->msgh_size - (descriptorData - reinterpret_cast<uint8_t*>(header));
 
-    return auto_ptr<ArgumentDecoder>(new ArgumentDecoder(messageBody, messageBodySize, attachments));
+    return adoptPtr(new ArgumentDecoder(messageBody, messageBodySize, attachments));
 }
 
 void Connection::receiveSourceEventHandler()
@@ -293,8 +293,8 @@ void Connection::receiveSourceEventHandler()
     }
     
     MessageID messageID = MessageID::fromInt(header->msgh_id);
-    std::auto_ptr<ArgumentDecoder> arguments = createArgumentDecoder(header);
-    ASSERT(arguments.get());
+    OwnPtr<ArgumentDecoder> arguments = createArgumentDecoder(header);
+    ASSERT(arguments);
 
     if (messageID == MessageID(CoreIPCMessage::InitializeConnection)) {
         ASSERT(m_isServer);
@@ -321,7 +321,7 @@ void Connection::receiveSourceEventHandler()
         return;
     }
     
-    processIncomingMessage(messageID, arguments);
+    processIncomingMessage(messageID, arguments.release());
 }    
 
 } // namespace CoreIPC
index 44958949bc9e68320dacd9a94d20ef9939d3b628..2ee20bc6e12ef165fbdaa030376bde97fc00ec76 100644 (file)
@@ -77,8 +77,7 @@ void Connection::readyReadHandler()
         size_t realBufferSize = m_currentMessageSize - sizeof(MessageID);
         unsigned messageID = *reinterpret_cast<unsigned*>(m_readBuffer.data() + realBufferSize);
 
-        std::auto_ptr<ArgumentDecoder> arguments(new ArgumentDecoder(m_readBuffer.data(), realBufferSize));
-        processIncomingMessage(MessageID::fromInt(messageID), arguments);
+        processIncomingMessage(MessageID::fromInt(messageID), adoptPtr(new ArgumentDecoder(m_readBuffer.data(), realBufferSize)));
 
         m_currentMessageSize = 0;
     }
@@ -105,7 +104,7 @@ bool Connection::open()
     return m_isConnected;
 }
 
-void Connection::sendOutgoingMessage(MessageID messageID, auto_ptr<ArgumentEncoder> arguments)
+void Connection::sendOutgoingMessage(MessageID messageID, PassOwnPtr<ArgumentEncoder> arguments)
 {
     if (!m_socket)
         return;
index e1f0d3e839e7d45fcd1df339ba91d9162c49bff5..d13b5801c3d269338088e5ac9afe82be94a478b3 100644 (file)
@@ -137,8 +137,7 @@ void Connection::readEventHandler()
 
             unsigned messageID = *reinterpret_cast<unsigned*>(m_readBuffer.data() + realBufferSize);
 
-            std::auto_ptr<ArgumentDecoder> arguments(new ArgumentDecoder(m_readBuffer.data(), realBufferSize));
-            processIncomingMessage(MessageID::fromInt(messageID), arguments);
+            processIncomingMessage(MessageID::fromInt(messageID), adoptPtr(new ArgumentDecoder(m_readBuffer.data(), realBufferSize)));
         }
 
         // FIXME: Do this somewhere else.
@@ -197,7 +196,7 @@ bool Connection::open()
     return true;
 }
 
-void Connection::sendOutgoingMessage(MessageID messageID, auto_ptr<ArgumentEncoder> arguments)
+void Connection::sendOutgoingMessage(MessageID messageID, PassOwnPtr<ArgumentEncoder> arguments)
 {
     // Just bail if the handle has been closed.
     if (m_connectionPipe == INVALID_HANDLE_VALUE)
index ee4a61b47c23d2d188146a66e566e13ac577be1a..606aba1c768479f8426171821fb46627932d37a3 100644 (file)
@@ -58,15 +58,15 @@ void RunLoop::performWork()
     }
 
     for (size_t i = 0; i < workItemQueue.size(); ++i) {
-        std::auto_ptr<WorkItem> item(workItemQueue[i]);
+        OwnPtr<WorkItem> item(workItemQueue[i]);
         item->execute();
     }
 }
 
-void RunLoop::scheduleWork(std::auto_ptr<WorkItem> item)
+void RunLoop::scheduleWork(PassOwnPtr<WorkItem> item)
 {
     MutexLocker locker(m_workItemQueueLock);
-    m_workItemQueue.append(item.release());
+    m_workItemQueue.append(item.leakPtr());
 
     wakeUp();
 }
index 350f079a83fcbd772e8047ef83c62f805a36c21a..5d96983516fd0ca22fdf88570917d516a58a9c1c 100644 (file)
@@ -27,8 +27,8 @@
 #ifndef RunLoop_h
 #define RunLoop_h
 
-#include <memory>
 #include <wtf/HashMap.h>
+#include <wtf/PassOwnPtr.h>
 #include <wtf/ThreadSpecific.h>
 #include <wtf/Threading.h>
 #include <wtf/Vector.h>
@@ -43,7 +43,7 @@ public:
     static RunLoop* current();
     static RunLoop* main();
 
-    void scheduleWork(std::auto_ptr<WorkItem>);
+    void scheduleWork(PassOwnPtr<WorkItem>);
 
     static void run();
     void stop();
index 1ac0bc2ef19d2cac8fe8fc0ea89cae4873588c22..2792dff599515e8c2a42826e91567ae4e45ad5a3 100644 (file)
 #ifndef WorkItem_h
 #define WorkItem_h
 
-#include <memory>
+#include <wtf/PassOwnPtr.h>
 
 class WorkItem {
 public:
     template<typename C> 
-    static std::auto_ptr<WorkItem> create(C*, void (C::*)());
+    static PassOwnPtr<WorkItem> create(C*, void (C::*)());
 
     template<typename C, typename T0, typename T1>
-    static std::auto_ptr<WorkItem> create(C*, void (C::*)(T0, T1), T0, T1);
+    static PassOwnPtr<WorkItem> create(C*, void (C::*)(T0, T1), T0, T1);
 
     virtual ~WorkItem() { }
     virtual void execute() = 0;
@@ -108,15 +108,15 @@ class MemberFunctionWorkItem2 : private WorkItem {
 };
 
 template<typename C>
-std::auto_ptr<WorkItem> WorkItem::create(C* ptr, void (C::*function)())
+PassOwnPtr<WorkItem> WorkItem::create(C* ptr, void (C::*function)())
 {
-    return std::auto_ptr<WorkItem>(new MemberFunctionWorkItem0<C>(ptr, function));
+    return adoptPtr(static_cast<WorkItem*>(new MemberFunctionWorkItem0<C>(ptr, function)));
 }
 
 template<typename C, typename T0, typename T1>
-std::auto_ptr<WorkItem> WorkItem::create(C* ptr, void (C::*function)(T0, T1), T0 t0, T1 t1)
+PassOwnPtr<WorkItem> WorkItem::create(C* ptr, void (C::*function)(T0, T1), T0 t0, T1 t1)
 {
-    return std::auto_ptr<WorkItem>(new MemberFunctionWorkItem2<C, T0, T1>(ptr, function, t0, t1));
+    return adoptPtr(static_cast<WorkItem*>(new MemberFunctionWorkItem2<C, T0, T1>(ptr, function, t0, t1)));
 }
 
 #endif // WorkItem_h
index bbacc0ba57108b8625977ef4de029624e96953ca..397cd127ed7127ae10bf60fe5c1f225959f5e546 100644 (file)
@@ -34,6 +34,7 @@
 
 #include "WorkItem.h"
 #include <wtf/HashMap.h>
+#include <wtf/PassOwnPtr.h>
 #include <wtf/Threading.h>
 #include <wtf/Vector.h>
 
@@ -48,7 +49,7 @@ public:
     explicit WorkQueue(const char* name);
     ~WorkQueue();
 
-    void scheduleWork(std::auto_ptr<WorkItem>);
+    void scheduleWork(PassOwnPtr<WorkItem>);
     void invalidate();
 
 #if PLATFORM(MAC)
@@ -62,13 +63,13 @@ public:
     
     // Will execute the given work item whenever the given mach port event fires.
     // Note that this will adopt the mach port and destroy it when the work queue is invalidated.
-    void registerMachPortEventHandler(mach_port_t, MachPortEventType, std::auto_ptr<WorkItem>);
+    void registerMachPortEventHandler(mach_port_t, MachPortEventType, PassOwnPtr<WorkItem>);
     void unregisterMachPortEventHandler(mach_port_t);
 #elif PLATFORM(WIN)
-    void registerHandle(HANDLE, std::auto_ptr<WorkItem>);
+    void registerHandle(HANDLE, PassOwnPtr<WorkItem>);
     void unregisterHandle(HANDLE);
 #elif PLATFORM(QT)
-    void connectSignal(QObject*, const char* signal, std::auto_ptr<WorkItem>);
+    void connectSignal(QObject*, const char* signal, PassOwnPtr<WorkItem>);
     void disconnectSignal(QObject*, const char* signal);
 
     void moveSocketToWorkThread(QLocalSocket*);
index a0d970a67917d80366aa5cd9a83f9e711503b6aa..4fcf313ea8e268f0422bd51820169cc62184a63e 100644 (file)
 #include "WorkQueue.h"
 
 #include <mach/mach_port.h>
+#include <wtf/PassOwnPtr.h>
 
 #if HAVE(DISPATCH_H)
 
 void WorkQueue::executeWorkItem(void* item)
 {
     WorkQueue* queue = static_cast<WorkQueue*>(dispatch_get_context(dispatch_get_current_queue()));
-    std::auto_ptr<WorkItem> workItem(static_cast<WorkItem*>(item));
+    OwnPtr<WorkItem> workItem(static_cast<WorkItem*>(item));
     
     {
         MutexLocker locker(queue->m_isValidMutex);
@@ -43,14 +44,14 @@ void WorkQueue::executeWorkItem(void* item)
     workItem->execute();
 }
 
-void WorkQueue::scheduleWork(std::auto_ptr<WorkItem> item)
+void WorkQueue::scheduleWork(PassOwnPtr<WorkItem> item)
 {
-    dispatch_async_f(m_dispatchQueue, item.release(), executeWorkItem);
+    dispatch_async_f(m_dispatchQueue, item.leakPtr(), executeWorkItem);
 }
 
 class WorkQueue::EventSource {
 public:
-    EventSource(MachPortEventType eventType, dispatch_source_t dispatchSource, std::auto_ptr<WorkItem> workItem)
+    EventSource(MachPortEventType eventType, dispatch_source_t dispatchSource, PassOwnPtr<WorkItem> workItem)
         : m_eventType(eventType)
         , m_dispatchSource(dispatchSource)
         , m_workItem(workItem)
@@ -97,10 +98,10 @@ private:
     // This is a weak reference, since m_dispatchSource references the event source.
     dispatch_source_t m_dispatchSource;
     
-    std::auto_ptr<WorkItem> m_workItem;
+    OwnPtr<WorkItem> m_workItem;
 };
 
-void WorkQueue::registerMachPortEventHandler(mach_port_t machPort, MachPortEventType eventType, std::auto_ptr<WorkItem> workItem)
+void WorkQueue::registerMachPortEventHandler(mach_port_t machPort, MachPortEventType eventType, PassOwnPtr<WorkItem> workItem)
 {
     dispatch_source_type_t sourceType = 0;
     switch (eventType) {
@@ -169,11 +170,11 @@ void WorkQueue::platformInvalidate()
 
 #else /* !HAVE(DISPATCH_H) */
 
-void WorkQueue::scheduleWork(std::auto_ptr<WorkItem> item)
+void WorkQueue::scheduleWork(PassOwnPtr<WorkItem> item)
 {
 }
 
-void WorkQueue::registerMachPortEventHandler(mach_port_t, MachPortEventType, std::auto_ptr<WorkItem>)
+void WorkQueue::registerMachPortEventHandler(mach_port_t, MachPortEventType, PassOwnPtr<WorkItem>)
 {
 }
 
index f50c59a6dc1367ac1a91c33d5c4f8a7774b9aec7..814bbc1c2ddfa3f06361b09f3dadba713e3f65ba 100644 (file)
@@ -74,9 +74,9 @@ public:
     WorkItem* m_workItem;
 };
 
-void WorkQueue::connectSignal(QObject* o, const char* signal, std::auto_ptr<WorkItem> workItem)
+void WorkQueue::connectSignal(QObject* o, const char* signal, PassOwnPtr<WorkItem> workItem)
 {
-    WorkQueue::WorkItemQt* itemQt = new WorkQueue::WorkItemQt(this, o, signal, workItem.release());
+    WorkQueue::WorkItemQt* itemQt = new WorkQueue::WorkItemQt(this, o, signal, workItem.leakPtr());
     itemQt->moveToThread(m_workThread);
     m_signalListeners.add(o, itemQt);
 }
@@ -116,9 +116,9 @@ void WorkQueue::platformInvalidate()
     deleteAllValues(m_signalListeners);
 }
 
-void WorkQueue::scheduleWork(std::auto_ptr<WorkItem> item)
+void WorkQueue::scheduleWork(PassOwnPtr<WorkItem> item)
 {
-    WorkQueue::WorkItemQt* itemQt = new WorkQueue::WorkItemQt(this, item.release());
+    WorkQueue::WorkItemQt* itemQt = new WorkQueue::WorkItemQt(this, item.leakPtr());
     itemQt->startTimer(0);
     itemQt->moveToThread(m_workThread);
 }
index 9188b1cd93480090f6fdfca53fd1e5bf853f9b17..3fa4536c5c0aa31f512f8979eb4f9b1f18b17286 100644 (file)
 #include <process.h>
 #include <wtf/Threading.h>
 
-void WorkQueue::registerHandle(HANDLE handle, std::auto_ptr<WorkItem> item)
+void WorkQueue::registerHandle(HANDLE handle, PassOwnPtr<WorkItem> item)
 {
     // Add the item.
     {
         MutexLocker locker(m_handlesLock);
-        m_handles.set(handle, item.release());
+        m_handles.set(handle, item.leakPtr());
     }
 
     // Set the work event.
@@ -102,10 +102,10 @@ void WorkQueue::platformInvalidate()
     // FIXME: Stop the thread and do other cleanup.
 }
 
-void WorkQueue::scheduleWork(std::auto_ptr<WorkItem> item)
+void WorkQueue::scheduleWork(PassOwn<WorkItem> item)
 {
     MutexLocker locker(m_workItemQueueLock);
-    m_workItemQueue.append(item.release());
+    m_workItemQueue.append(item.leakPtr());
 
     // Set the work event.
     ::SetEvent(m_performWorkEvent);
@@ -120,7 +120,7 @@ void WorkQueue::performWork()
     }
 
     for (size_t i = 0; i < workItemQueue.size(); ++i) {
-        std::auto_ptr<WorkItem> item(workItemQueue[i]);
+        OwnPtr<WorkItem> item(workItemQueue[i]);
 
         MutexLocker locker(m_isValidMutex);
         if (m_isValid)
index 87e360cb5863171e01a9235daf8db9620237017a..754e4ca613840c07565ecdec3e0d3b14bd53b989 100644 (file)
@@ -59,8 +59,8 @@ void ChunkedUpdateDrawingAreaProxy::paint(const IntRect& rect, PlatformDrawingCo
         if (page->process()->isLaunching())
             return;
 
-        std::auto_ptr<CoreIPC::ArgumentDecoder> arguments = page->process()->connection()->waitFor(DrawingAreaProxyMessage::DidSetSize, page->pageID(), 0.04);
-        if (arguments.get())
+        OwnPtr<CoreIPC::ArgumentDecoder> arguments = page->process()->connection()->waitFor(DrawingAreaProxyMessage::DidSetSize, page->pageID(), 0.04);
+        if (arguments)
             didReceiveMessage(page->process()->connection(), CoreIPC::MessageID(DrawingAreaProxyMessage::DidSetSize), *arguments.get());
     }
 
index 01fe911c640fb8f0fe06093e4994347fb17a33de..e924f8212ff4bd394bb4718dbc03c4996ff8efcc 100644 (file)
@@ -92,7 +92,7 @@ void WebProcessProxy::connect()
     m_processLauncher = ProcessLauncher::create(this);
 }
 
-bool WebProcessProxy::sendMessage(CoreIPC::MessageID messageID, std::auto_ptr<CoreIPC::ArgumentEncoder> arguments)
+bool WebProcessProxy::sendMessage(CoreIPC::MessageID messageID, PassOwnPtr<CoreIPC::ArgumentEncoder> arguments)
 {
     // If we're waiting for the web process to launch, we need to stash away the messages so we can send them once we have
     // a CoreIPC connection.
@@ -301,7 +301,7 @@ void WebProcessProxy::didFinishLaunching(ProcessLauncher*, const CoreIPC::Connec
     
     for (size_t i = 0; i < m_pendingMessages.size(); ++i) {
         CoreIPC::Connection::OutgoingMessage& outgoingMessage = m_pendingMessages[i];
-        m_connection->sendMessage(outgoingMessage.messageID(), std::auto_ptr<CoreIPC::ArgumentEncoder>(outgoingMessage.arguments()));
+        m_connection->sendMessage(outgoingMessage.messageID(), adoptPtr(outgoingMessage.arguments()));
     }
 
     m_pendingMessages.clear();    
index f691eb03d9127a82bf0615618afe0ac7fafbdc60..452bf6f3b3c007507a763d0782db7646ae08e16b 100644 (file)
@@ -89,7 +89,7 @@ private:
     void setUpAcceleratedCompositing();
 #endif
 
-    bool sendMessage(CoreIPC::MessageID, std::auto_ptr<CoreIPC::ArgumentEncoder>);
+    bool sendMessage(CoreIPC::MessageID, PassOwnPtr<CoreIPC::ArgumentEncoder>);
 
     void forwardMessageToWebContext(const WebCore::String&);
     void getPlugins(bool refresh, Vector<WebCore::PluginInfo>&);
@@ -122,10 +122,10 @@ private:
 template<typename E, typename T>
 bool WebProcessProxy::send(E messageID, uint64_t destinationID, const T& arguments)
 {
-    std::auto_ptr<CoreIPC::ArgumentEncoder> argumentEncoder(new CoreIPC::ArgumentEncoder(destinationID));
+    OwnPtr<CoreIPC::ArgumentEncoder> argumentEncoder(new CoreIPC::ArgumentEncoder(destinationID));
     argumentEncoder->encode(arguments);
 
-    return sendMessage(CoreIPC::MessageID(messageID), argumentEncoder);
+    return sendMessage(CoreIPC::MessageID(messageID), argumentEncoder.release());
 }
 
 } // namespace WebKit