[WebSocket] Send requires super linear time against data size
authortoyoshim@chromium.org <toyoshim@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Jun 2012 00:51:56 +0000 (00:51 +0000)
committertoyoshim@chromium.org <toyoshim@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Jun 2012 00:51:56 +0000 (00:51 +0000)
commit926b93209bbc725d048ef187bd50aab78b34b477
tree79d95ddf40d360c331c7b44b1b8a13549ade1a61
parent05f425a8f6b6df69e6456be807ed475a87ed9c11
[WebSocket] Send requires super linear time against data size
https://bugs.webkit.org/show_bug.cgi?id=87383

Reviewed by Kent Tamura.

Source/WebCore:

WebSocket send operation requires super linear time to send data
against data size. This is because removing sent data in Vector<char>
always requires data copy.
Introduced wtf/StreamBuffer realizes O(n) buffer operations.
This patch is only for optimization. No new tests are needed.

* platform/network/SocketStreamHandleBase.cpp:
(WebCore::SocketStreamHandleBase::sendPendingData):
* platform/network/SocketStreamHandleBase.h:
(SocketStreamHandleBase):

Source/WTF:

* wtf/StreamBuffer.h: Added.
(WTF):
(StreamBuffer):
(WTF::StreamBuffer::StreamBuffer):
(WTF::StreamBuffer::~StreamBuffer):
(WTF::StreamBuffer::isEmpty):
(WTF::StreamBuffer::append):
(WTF::StreamBuffer::consume):
(WTF::StreamBuffer::size):
(WTF::StreamBuffer::firstBlockData):
(WTF::StreamBuffer::firstBlockSize):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@119446 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WTF/ChangeLog
Source/WTF/wtf/StreamBuffer.h [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/platform/network/SocketStreamHandleBase.cpp
Source/WebCore/platform/network/SocketStreamHandleBase.h