Move Modules/websockets to std::unique_ptr
authorgyuyoung.kim@samsung.com <gyuyoung.kim@samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 12 Nov 2014 07:33:13 +0000 (07:33 +0000)
committergyuyoung.kim@samsung.com <gyuyoung.kim@samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 12 Nov 2014 07:33:13 +0000 (07:33 +0000)
https://bugs.webkit.org/show_bug.cgi?id=138649

Reviewed by Chris Dumez.

Remove create() factory function and use std::make_unique<>, std::unique_ptr<>
instead of OwnPtr, PassOwnPtr.
However didReceiveBinaryData() is still using PassOwnPtr. It should be replaced
with std::unique_ptr<>

No new tests, no behavior.

* Modules/websockets/ThreadableWebSocketChannelClientWrapper.h:
* Modules/websockets/WebSocket.cpp:
* Modules/websockets/WebSocketChannel.cpp:
(WebCore::WebSocketChannel::connect):
(WebCore::WebSocketChannel::didFail):
(WebCore::WebSocketChannel::processFrame):
(WebCore::WebSocketChannel::enqueueTextFrame):
(WebCore::WebSocketChannel::enqueueRawFrame):
(WebCore::WebSocketChannel::enqueueBlobFrame):
(WebCore::WebSocketChannel::processOutgoingFrameQueue):
(WebCore::WebSocketChannel::sendFrame):
* Modules/websockets/WebSocketChannel.h:
* Modules/websockets/WebSocketDeflateFramer.cpp:
(WebCore::WebSocketDeflateFramer::createExtensionProcessor):
(WebCore::WebSocketDeflateFramer::enableDeflate):
(WebCore::WebSocketDeflateFramer::deflate):
(WebCore::WebSocketDeflateFramer::inflate):
(WebCore::WebSocketExtensionDeflateFrame::create): Deleted.
* Modules/websockets/WebSocketDeflateFramer.h:
(WebCore::DeflateResultHolder::create): Deleted.
(WebCore::InflateResultHolder::create): Deleted.
* Modules/websockets/WebSocketDeflater.cpp:
(WebCore::WebSocketDeflater::WebSocketDeflater):
(WebCore::WebSocketInflater::WebSocketInflater):
(WebCore::WebSocketDeflater::create): Deleted.
(WebCore::WebSocketInflater::create): Deleted.
* Modules/websockets/WebSocketDeflater.h:
* Modules/websockets/WebSocketExtensionDispatcher.cpp:
(WebCore::WebSocketExtensionDispatcher::addProcessor):
* Modules/websockets/WebSocketExtensionDispatcher.h:
* Modules/websockets/WebSocketHandshake.cpp:
(WebCore::WebSocketHandshake::addExtensionProcessor):
* Modules/websockets/WebSocketHandshake.h:

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

13 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Modules/websockets/ThreadableWebSocketChannelClientWrapper.h
Source/WebCore/Modules/websockets/WebSocket.cpp
Source/WebCore/Modules/websockets/WebSocketChannel.cpp
Source/WebCore/Modules/websockets/WebSocketChannel.h
Source/WebCore/Modules/websockets/WebSocketDeflateFramer.cpp
Source/WebCore/Modules/websockets/WebSocketDeflateFramer.h
Source/WebCore/Modules/websockets/WebSocketDeflater.cpp
Source/WebCore/Modules/websockets/WebSocketDeflater.h
Source/WebCore/Modules/websockets/WebSocketExtensionDispatcher.cpp
Source/WebCore/Modules/websockets/WebSocketExtensionDispatcher.h
Source/WebCore/Modules/websockets/WebSocketHandshake.cpp
Source/WebCore/Modules/websockets/WebSocketHandshake.h

index 0e6911a..164d45a 100644 (file)
@@ -1,3 +1,51 @@
+2014-11-11  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
+
+        Move Modules/websockets to std::unique_ptr
+        https://bugs.webkit.org/show_bug.cgi?id=138649
+
+        Reviewed by Chris Dumez.
+
+        Remove create() factory function and use std::make_unique<>, std::unique_ptr<>
+        instead of OwnPtr, PassOwnPtr.
+        However didReceiveBinaryData() is still using PassOwnPtr. It should be replaced
+        with std::unique_ptr<>
+
+        No new tests, no behavior.
+
+        * Modules/websockets/ThreadableWebSocketChannelClientWrapper.h:
+        * Modules/websockets/WebSocket.cpp:
+        * Modules/websockets/WebSocketChannel.cpp:
+        (WebCore::WebSocketChannel::connect):
+        (WebCore::WebSocketChannel::didFail):
+        (WebCore::WebSocketChannel::processFrame):
+        (WebCore::WebSocketChannel::enqueueTextFrame):
+        (WebCore::WebSocketChannel::enqueueRawFrame):
+        (WebCore::WebSocketChannel::enqueueBlobFrame):
+        (WebCore::WebSocketChannel::processOutgoingFrameQueue):
+        (WebCore::WebSocketChannel::sendFrame):
+        * Modules/websockets/WebSocketChannel.h:
+        * Modules/websockets/WebSocketDeflateFramer.cpp:
+        (WebCore::WebSocketDeflateFramer::createExtensionProcessor):
+        (WebCore::WebSocketDeflateFramer::enableDeflate):
+        (WebCore::WebSocketDeflateFramer::deflate):
+        (WebCore::WebSocketDeflateFramer::inflate):
+        (WebCore::WebSocketExtensionDeflateFrame::create): Deleted.
+        * Modules/websockets/WebSocketDeflateFramer.h:
+        (WebCore::DeflateResultHolder::create): Deleted.
+        (WebCore::InflateResultHolder::create): Deleted.
+        * Modules/websockets/WebSocketDeflater.cpp:
+        (WebCore::WebSocketDeflater::WebSocketDeflater):
+        (WebCore::WebSocketInflater::WebSocketInflater):
+        (WebCore::WebSocketDeflater::create): Deleted.
+        (WebCore::WebSocketInflater::create): Deleted.
+        * Modules/websockets/WebSocketDeflater.h:
+        * Modules/websockets/WebSocketExtensionDispatcher.cpp:
+        (WebCore::WebSocketExtensionDispatcher::addProcessor):
+        * Modules/websockets/WebSocketExtensionDispatcher.h:
+        * Modules/websockets/WebSocketHandshake.cpp:
+        (WebCore::WebSocketHandshake::addExtensionProcessor):
+        * Modules/websockets/WebSocketHandshake.h:
+
 2014-11-11  Chris Dumez  <cdumez@apple.com>
 
         Unreviewed iOS build fix after r176001.
index b20ed0c..e4bd6b0 100644 (file)
@@ -39,7 +39,6 @@
 #include "WorkerThreadableWebSocketChannel.h"
 #include <memory>
 #include <wtf/Forward.h>
-#include <wtf/PassOwnPtr.h>
 #include <wtf/Threading.h>
 #include <wtf/Vector.h>
 #include <wtf/text/WTFString.h>
index fd47796..e0483c5 100644 (file)
@@ -56,7 +56,6 @@
 #include <runtime/ArrayBuffer.h>
 #include <runtime/ArrayBufferView.h>
 #include <wtf/HashSet.h>
-#include <wtf/PassOwnPtr.h>
 #include <wtf/StdLibExtras.h>
 #include <wtf/text/CString.h>
 #include <wtf/text/StringBuilder.h>
index 7fd621e..d9c6abd 100644 (file)
@@ -56,8 +56,6 @@
 #include <wtf/Deque.h>
 #include <wtf/FastMalloc.h>
 #include <wtf/HashMap.h>
-#include <wtf/OwnPtr.h>
-#include <wtf/PassOwnPtr.h>
 #include <wtf/text/CString.h>
 #include <wtf/text/StringHash.h>
 #include <wtf/text/WTFString.h>
@@ -99,7 +97,7 @@ void WebSocketChannel::connect(const URL& url, const String& protocol)
     LOG(Network, "WebSocketChannel %p connect()", this);
     ASSERT(!m_handle);
     ASSERT(!m_suspended);
-    m_handshake = adoptPtr(new WebSocketHandshake(url, protocol, m_document));
+    m_handshake = std::make_unique<WebSocketHandshake>(url, protocol, m_document);
     m_handshake->reset();
     if (m_deflateFramer.canDeflate())
         m_handshake->addExtensionProcessor(m_deflateFramer.createExtensionProcessor());
@@ -375,7 +373,7 @@ void WebSocketChannel::didFail(int errorCode)
     LOG(Network, "WebSocketChannel %p didFail() errorCode=%d", this, errorCode);
     ASSERT(m_blobLoader);
     ASSERT(m_blobLoaderStatus == BlobLoaderStarted);
-    m_blobLoader.clear();
+    m_blobLoader = nullptr;
     m_blobLoaderStatus = BlobLoaderFailed;
     fail("Failed to load Blob: error code = " + String::number(errorCode)); // FIXME: Generate human-friendly reason message.
     deref();
@@ -518,7 +516,7 @@ bool WebSocketChannel::processFrame()
     ASSERT(m_buffer.data() < frameEnd);
     ASSERT(frameEnd <= m_buffer.data() + m_buffer.size());
 
-    OwnPtr<InflateResultHolder> inflateResult = m_deflateFramer.inflate(frame);
+    auto inflateResult = m_deflateFramer.inflate(frame);
     if (!inflateResult->succeeded()) {
         fail(inflateResult->failureReason());
         return false;
@@ -685,7 +683,7 @@ bool WebSocketChannel::processFrame()
 void WebSocketChannel::enqueueTextFrame(const CString& string)
 {
     ASSERT(m_outgoingFrameQueueStatus == OutgoingFrameQueueOpen);
-    OwnPtr<QueuedFrame> frame = adoptPtr(new QueuedFrame);
+    auto frame = std::make_unique<QueuedFrame>();
     frame->opCode = WebSocketFrame::OpCodeText;
     frame->frameType = QueuedFrameTypeString;
     frame->stringData = string;
@@ -695,7 +693,7 @@ void WebSocketChannel::enqueueTextFrame(const CString& string)
 void WebSocketChannel::enqueueRawFrame(WebSocketFrame::OpCode opCode, const char* data, size_t dataLength)
 {
     ASSERT(m_outgoingFrameQueueStatus == OutgoingFrameQueueOpen);
-    OwnPtr<QueuedFrame> frame = adoptPtr(new QueuedFrame);
+    auto frame = std::make_unique<QueuedFrame>();
     frame->opCode = opCode;
     frame->frameType = QueuedFrameTypeVector;
     frame->vectorData.resize(dataLength);
@@ -707,7 +705,7 @@ void WebSocketChannel::enqueueRawFrame(WebSocketFrame::OpCode opCode, const char
 void WebSocketChannel::enqueueBlobFrame(WebSocketFrame::OpCode opCode, Blob& blob)
 {
     ASSERT(m_outgoingFrameQueueStatus == OutgoingFrameQueueOpen);
-    OwnPtr<QueuedFrame> frame = adoptPtr(new QueuedFrame);
+    auto frame = std::make_unique<QueuedFrame>();
     frame->opCode = opCode;
     frame->frameType = QueuedFrameTypeBlob;
     frame->blobData = &blob;
@@ -722,7 +720,7 @@ void WebSocketChannel::processOutgoingFrameQueue()
     Ref<WebSocketChannel> protect(*this); // Any call to fail() will get the channel closed and dereferenced.
 
     while (!m_outgoingFrameQueue.isEmpty()) {
-        OwnPtr<QueuedFrame> frame = m_outgoingFrameQueue.takeFirst();
+        auto frame = m_outgoingFrameQueue.takeFirst();
         switch (frame->frameType) {
         case QueuedFrameTypeString: {
             if (!sendFrame(frame->opCode, frame->stringData.data(), frame->stringData.length()))
@@ -740,7 +738,7 @@ void WebSocketChannel::processOutgoingFrameQueue()
             case BlobLoaderNotStarted:
                 ref(); // Will be derefed after didFinishLoading() or didFail().
                 ASSERT(!m_blobLoader);
-                m_blobLoader = adoptPtr(new FileReaderLoader(FileReaderLoader::ReadAsArrayBuffer, this));
+                m_blobLoader = std::make_unique<FileReaderLoader>(FileReaderLoader::ReadAsArrayBuffer, this);
                 m_blobLoaderStatus = BlobLoaderStarted;
                 m_blobLoader->start(m_document, frame->blobData.get());
                 m_outgoingFrameQueue.prepend(frame.release());
@@ -753,7 +751,7 @@ void WebSocketChannel::processOutgoingFrameQueue()
 
             case BlobLoaderFinished: {
                 RefPtr<ArrayBuffer> result = m_blobLoader->arrayBufferResult();
-                m_blobLoader.clear();
+                m_blobLoader = nullptr;
                 m_blobLoaderStatus = BlobLoaderNotStarted;
                 if (!sendFrame(frame->opCode, static_cast<const char*>(result->data()), result->byteLength()))
                     fail("Failed to send WebSocket frame.");
@@ -794,7 +792,7 @@ bool WebSocketChannel::sendFrame(WebSocketFrame::OpCode opCode, const char* data
     WebSocketFrame frame(opCode, true, false, true, data, dataLength);
     InspectorInstrumentation::didSendWebSocketFrame(m_document, m_identifier, frame);
 
-    OwnPtr<DeflateResultHolder> deflateResult = m_deflateFramer.deflate(frame);
+    auto deflateResult = m_deflateFramer.deflate(frame);
     if (!deflateResult->succeeded()) {
         fail(deflateResult->failureReason());
         return false;
index e4fac2b..be75d33 100644 (file)
@@ -186,7 +186,7 @@ private:
 
     Document* m_document;
     WebSocketChannelClient* m_client;
-    OwnPtr<WebSocketHandshake> m_handshake;
+    std::unique_ptr<WebSocketHandshake> m_handshake;
     RefPtr<SocketStreamHandle> m_handle;
     Vector<char> m_buffer;
 
@@ -208,11 +208,11 @@ private:
     unsigned short m_closeEventCode;
     String m_closeEventReason;
 
-    Deque<OwnPtr<QueuedFrame>> m_outgoingFrameQueue;
+    Deque<std::unique_ptr<QueuedFrame>> m_outgoingFrameQueue;
     OutgoingFrameQueueStatus m_outgoingFrameQueueStatus;
 
     // FIXME: Load two or more Blobs simultaneously for better performance.
-    OwnPtr<FileReaderLoader> m_blobLoader;
+    std::unique_ptr<FileReaderLoader> m_blobLoader;
     BlobLoaderStatus m_blobLoaderStatus;
 
     WebSocketDeflateFramer m_deflateFramer;
index f3aa3f0..9453628 100644 (file)
@@ -43,10 +43,7 @@ namespace WebCore {
 class WebSocketExtensionDeflateFrame : public WebSocketExtensionProcessor {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    static PassOwnPtr<WebSocketExtensionDeflateFrame> create(WebSocketDeflateFramer* framer)
-    {
-        return adoptPtr(new WebSocketExtensionDeflateFrame(framer));
-    }
+    explicit WebSocketExtensionDeflateFrame(WebSocketDeflateFramer*);
     virtual ~WebSocketExtensionDeflateFrame() { }
 
     virtual String handshakeString() override;
@@ -54,8 +51,6 @@ public:
     virtual String failureReason() override { return m_failureReason; }
 
 private:
-    WebSocketExtensionDeflateFrame(WebSocketDeflateFramer*);
-
     WebSocketDeflateFramer* m_framer;
     bool m_responseProcessed;
     String m_failureReason;
@@ -161,9 +156,9 @@ WebSocketDeflateFramer::WebSocketDeflateFramer()
 {
 }
 
-PassOwnPtr<WebSocketExtensionProcessor> WebSocketDeflateFramer::createExtensionProcessor()
+std::unique_ptr<WebSocketExtensionProcessor> WebSocketDeflateFramer::createExtensionProcessor()
 {
-    return WebSocketExtensionDeflateFrame::create(this);
+    return std::make_unique<WebSocketExtensionDeflateFrame>(this);
 }
 
 bool WebSocketDeflateFramer::canDeflate() const
@@ -178,33 +173,33 @@ bool WebSocketDeflateFramer::canDeflate() const
 #if USE(ZLIB)
 void WebSocketDeflateFramer::enableDeflate(int windowBits, WebSocketDeflater::ContextTakeOverMode mode)
 {
-    m_deflater = WebSocketDeflater::create(windowBits, mode);
-    m_inflater = WebSocketInflater::create();
+    m_deflater = std::make_unique<WebSocketDeflater>(windowBits, mode);
+    m_inflater = std::make_unique<WebSocketInflater>();
     if (!m_deflater->initialize() || !m_inflater->initialize()) {
-        m_deflater.clear();
-        m_inflater.clear();
+        m_deflater = nullptr;
+        m_inflater = nullptr;
         return;
     }
     m_enabled = true;
 }
 #endif
 
-PassOwnPtr<DeflateResultHolder> WebSocketDeflateFramer::deflate(WebSocketFrame& frame)
+std::unique_ptr<DeflateResultHolder> WebSocketDeflateFramer::deflate(WebSocketFrame& frame)
 {
 #if USE(ZLIB)
-    OwnPtr<DeflateResultHolder> result = DeflateResultHolder::create(this);
+    auto result = std::make_unique<DeflateResultHolder>(this);
     if (!enabled() || !WebSocketFrame::isNonControlOpCode(frame.opCode) || !frame.payloadLength)
-        return result.release();
+        return result;
     if (!m_deflater->addBytes(frame.payload, frame.payloadLength) || !m_deflater->finish()) {
         result->fail("Failed to compress frame");
-        return result.release();
+        return result;
     }
     frame.compress = true;
     frame.payload = m_deflater->data();
     frame.payloadLength = m_deflater->size();
-    return result.release();
+    return result;
 #else
-    return DeflateResultHolder::create(this);
+    return std::make_unique<DeflateResultHolder>(this);
 #endif
 }
 
@@ -216,30 +211,30 @@ void WebSocketDeflateFramer::resetDeflateContext()
 #endif
 }
 
-PassOwnPtr<InflateResultHolder> WebSocketDeflateFramer::inflate(WebSocketFrame& frame)
+std::unique_ptr<InflateResultHolder> WebSocketDeflateFramer::inflate(WebSocketFrame& frame)
 {
-    OwnPtr<InflateResultHolder> result = InflateResultHolder::create(this);
+    auto result = std::make_unique<InflateResultHolder>(this);
     if (!enabled() && frame.compress) {
         result->fail("Compressed bit must be 0 if no negotiated deflate-frame extension");
-        return result.release();
+        return result;
     }
 #if USE(ZLIB)
     if (!frame.compress)
-        return result.release();
+        return result;
     if (!WebSocketFrame::isNonControlOpCode(frame.opCode)) {
         result->fail("Received unexpected compressed frame");
-        return result.release();
+        return result;
     }
     if (!m_inflater->addBytes(frame.payload, frame.payloadLength) || !m_inflater->finish()) {
         result->fail("Failed to decompress frame");
-        return result.release();
+        return result;
     }
     frame.compress = false;
     frame.payload = m_inflater->data();
     frame.payloadLength = m_inflater->size();
-    return result.release();
+    return result;
 #else
-    return result.release();
+    return result;
 #endif
 }
 
index f3232af..c7f657d 100644 (file)
@@ -38,8 +38,6 @@
 #endif
 #include "WebSocketExtensionProcessor.h"
 #include "WebSocketFrame.h"
-#include <wtf/OwnPtr.h>
-#include <wtf/PassOwnPtr.h>
 
 namespace WebCore {
 
@@ -48,11 +46,7 @@ class WebSocketDeflateFramer;
 class DeflateResultHolder {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    static PassOwnPtr<DeflateResultHolder> create(WebSocketDeflateFramer* framer)
-    {
-        return adoptPtr(new DeflateResultHolder(framer));
-    }
-
+    explicit DeflateResultHolder(WebSocketDeflateFramer*);
     ~DeflateResultHolder();
 
     bool succeeded() const { return m_succeeded; }
@@ -61,8 +55,6 @@ public:
     void fail(const String& failureReason);
 
 private:
-    explicit DeflateResultHolder(WebSocketDeflateFramer*);
-
     WebSocketDeflateFramer* m_framer;
     bool m_succeeded;
     String m_failureReason;
@@ -71,11 +63,7 @@ private:
 class InflateResultHolder {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    static PassOwnPtr<InflateResultHolder> create(WebSocketDeflateFramer* framer)
-    {
-        return adoptPtr(new InflateResultHolder(framer));
-    }
-
+    explicit InflateResultHolder(WebSocketDeflateFramer*);
     ~InflateResultHolder();
 
     bool succeeded() const { return m_succeeded; }
@@ -84,8 +72,6 @@ public:
     void fail(const String& failureReason);
 
 private:
-    explicit InflateResultHolder(WebSocketDeflateFramer*);
-
     WebSocketDeflateFramer* m_framer;
     bool m_succeeded;
     String m_failureReason;
@@ -95,14 +81,14 @@ class WebSocketDeflateFramer {
 public:
     WebSocketDeflateFramer();
 
-    PassOwnPtr<WebSocketExtensionProcessor> createExtensionProcessor();
+    std::unique_ptr<WebSocketExtensionProcessor> createExtensionProcessor();
 
     bool canDeflate() const;
     bool enabled() const { return m_enabled; }
 
-    PassOwnPtr<DeflateResultHolder> deflate(WebSocketFrame&);
+    std::unique_ptr<DeflateResultHolder> deflate(WebSocketFrame&);
     void resetDeflateContext();
-    PassOwnPtr<InflateResultHolder> inflate(WebSocketFrame&);
+    std::unique_ptr<InflateResultHolder> inflate(WebSocketFrame&);
     void resetInflateContext();
 
     void didFail();
@@ -114,8 +100,8 @@ public:
 private:
     bool m_enabled;
 #if USE(ZLIB)
-    OwnPtr<WebSocketDeflater> m_deflater;
-    OwnPtr<WebSocketInflater> m_inflater;
+    std::unique_ptr<WebSocketDeflater> m_deflater;
+    std::unique_ptr<WebSocketInflater> m_inflater;
 #endif
 };
 
index aef4b1e..497b293 100644 (file)
@@ -47,18 +47,13 @@ namespace WebCore {
 static const int defaultMemLevel = 1;
 static const size_t bufferIncrementUnit = 4096;
 
-PassOwnPtr<WebSocketDeflater> WebSocketDeflater::create(int windowBits, ContextTakeOverMode contextTakeOverMode)
-{
-    return adoptPtr(new WebSocketDeflater(windowBits, contextTakeOverMode));
-}
-
 WebSocketDeflater::WebSocketDeflater(int windowBits, ContextTakeOverMode contextTakeOverMode)
     : m_windowBits(windowBits)
     , m_contextTakeOverMode(contextTakeOverMode)
 {
     ASSERT(m_windowBits >= 8);
     ASSERT(m_windowBits <= 15);
-    m_stream = adoptPtr(new z_stream);
+    m_stream = std::make_unique<z_stream>();
     memset(m_stream.get(), 0, sizeof(z_stream));
 }
 
@@ -127,15 +122,10 @@ void WebSocketDeflater::reset()
         deflateReset(m_stream.get());
 }
 
-PassOwnPtr<WebSocketInflater> WebSocketInflater::create(int windowBits)
-{
-    return adoptPtr(new WebSocketInflater(windowBits));
-}
-
 WebSocketInflater::WebSocketInflater(int windowBits)
     : m_windowBits(windowBits)
 {
-    m_stream = adoptPtr(new z_stream);
+    m_stream = std::make_unique<z_stream>();
     memset(m_stream.get(), 0, sizeof(z_stream));
 }
 
index f73eb20..c3c3635 100644 (file)
@@ -34,8 +34,6 @@
 #if ENABLE(WEB_SOCKETS)
 
 #include <wtf/Noncopyable.h>
-#include <wtf/OwnPtr.h>
-#include <wtf/PassOwnPtr.h>
 #include <wtf/Vector.h>
 
 struct z_stream_s;
@@ -50,8 +48,8 @@ public:
         DoNotTakeOverContext,
         TakeOverContext
     };
-    static PassOwnPtr<WebSocketDeflater> create(int windowBits, ContextTakeOverMode = TakeOverContext);
 
+    explicit WebSocketDeflater(int windowBits, ContextTakeOverMode = TakeOverContext);
     ~WebSocketDeflater();
 
     bool initialize();
@@ -62,19 +60,16 @@ public:
     void reset();
 
 private:
-    WebSocketDeflater(int windowBits, ContextTakeOverMode);
-
     int m_windowBits;
     ContextTakeOverMode m_contextTakeOverMode;
     Vector<char> m_buffer;
-    OwnPtr<z_stream> m_stream;
+    std::unique_ptr<z_stream> m_stream;
 };
 
 class WebSocketInflater {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    static PassOwnPtr<WebSocketInflater> create(int windowBits = 15);
-
+    explicit WebSocketInflater(int windowBits = 15);
     ~WebSocketInflater();
 
     bool initialize();
@@ -85,11 +80,9 @@ public:
     void reset();
 
 private:
-    explicit WebSocketInflater(int windowBits);
-
     int m_windowBits;
     Vector<char> m_buffer;
-    OwnPtr<z_stream> m_stream;
+    std::unique_ptr<z_stream> m_stream;
 };
 
 }
index 8daa69c..19e25a1 100644 (file)
@@ -48,7 +48,7 @@ void WebSocketExtensionDispatcher::reset()
     m_processors.clear();
 }
 
-void WebSocketExtensionDispatcher::addProcessor(PassOwnPtr<WebSocketExtensionProcessor> processor)
+void WebSocketExtensionDispatcher::addProcessor(std::unique_ptr<WebSocketExtensionProcessor> processor)
 {
     for (size_t i = 0; i < m_processors.size(); ++i) {
         if (m_processors[i]->extensionToken() == processor->extensionToken())
@@ -57,7 +57,7 @@ void WebSocketExtensionDispatcher::addProcessor(PassOwnPtr<WebSocketExtensionPro
     ASSERT(processor->handshakeString().length());
     ASSERT(!processor->handshakeString().contains('\n'));
     ASSERT(!processor->handshakeString().contains(static_cast<UChar>('\0')));
-    m_processors.append(processor);
+    m_processors.append(WTF::move(processor));
 }
 
 const String WebSocketExtensionDispatcher::createHeaderValue() const
index 2430017..1bb9727 100644 (file)
@@ -34,8 +34,6 @@
 #if ENABLE(WEB_SOCKETS)
 
 #include "WebSocketExtensionProcessor.h"
-#include <wtf/OwnPtr.h>
-#include <wtf/PassOwnPtr.h>
 #include <wtf/Vector.h>
 #include <wtf/text/StringBuilder.h>
 #include <wtf/text/WTFString.h>
@@ -47,7 +45,7 @@ public:
     WebSocketExtensionDispatcher() { }
 
     void reset();
-    void addProcessor(PassOwnPtr<WebSocketExtensionProcessor>);
+    void addProcessor(std::unique_ptr<WebSocketExtensionProcessor>);
     const String createHeaderValue() const;
 
     bool processHeaderValue(const String&);
@@ -58,7 +56,7 @@ private:
     void appendAcceptedExtension(const String& extensionToken, HashMap<String, String>& extensionParameters);
     void fail(const String& reason);
 
-    Vector<OwnPtr<WebSocketExtensionProcessor>> m_processors;
+    Vector<std::unique_ptr<WebSocketExtensionProcessor>> m_processors;
     StringBuilder m_acceptedExtensionsBuilder;
     String m_failureReason;
 };
index c730461..11265e1 100644 (file)
@@ -376,9 +376,9 @@ const ResourceResponse& WebSocketHandshake::serverHandshakeResponse() const
     return m_serverHandshakeResponse;
 }
 
-void WebSocketHandshake::addExtensionProcessor(PassOwnPtr<WebSocketExtensionProcessor> processor)
+void WebSocketHandshake::addExtensionProcessor(std::unique_ptr<WebSocketExtensionProcessor> processor)
 {
-    m_extensionDispatcher.addProcessor(processor);
+    m_extensionDispatcher.addProcessor(WTF::move(processor));
 }
 
 URL WebSocketHandshake::httpURLForAuthenticationAndCookies() const
index ccab045..0d5900b 100644 (file)
@@ -37,7 +37,6 @@
 #include "ResourceResponse.h"
 #include "WebSocketExtensionDispatcher.h"
 #include "WebSocketExtensionProcessor.h"
-#include <wtf/PassOwnPtr.h>
 #include <wtf/text/WTFString.h>
 
 namespace WebCore {
@@ -86,7 +85,7 @@ public:
 
     const ResourceResponse& serverHandshakeResponse() const;
 
-    void addExtensionProcessor(PassOwnPtr<WebSocketExtensionProcessor>);
+    void addExtensionProcessor(std::unique_ptr<WebSocketExtensionProcessor>);
 
     static String getExpectedWebSocketAccept(const String& secWebSocketKey);