diff options
author | ukai@chromium.org <ukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-01 10:22:32 +0000 |
---|---|---|
committer | ukai@chromium.org <ukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-01 10:22:32 +0000 |
commit | d513d6ea5eec4773e299d2bae17e9159cebf0446 (patch) | |
tree | e170a5fea6b4b8a37c2037574cd221a925b43e3e /net/websockets/websocket_job.cc | |
parent | c4e9890a10fb35a78247be5d204d77f512d7654c (diff) | |
download | chromium_src-d513d6ea5eec4773e299d2bae17e9159cebf0446.zip chromium_src-d513d6ea5eec4773e299d2bae17e9159cebf0446.tar.gz chromium_src-d513d6ea5eec4773e299d2bae17e9159cebf0446.tar.bz2 |
Fix regression of websocket/tests/simple-stress.html
Since stress-test.html tries to send 256K message, but we'll set
32K for max_pending_send_allowed in SocketStream.
Thus, WebCore::SocketStreamHandle won't send full websocket frame for
such large message since WebSocketJob doesn't notify OnSentData at all.
Don't parse websocket frame for sending to avoid this issue for now.
Also disable buffering and parsing websocket frame for receiving to fix performance regression.
BUG=32018
TEST=LayoutTests/websocket/tests/stress-test.html passes
Review URL: http://codereview.chromium.org/2453002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48629 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/websockets/websocket_job.cc')
-rw-r--r-- | net/websockets/websocket_job.cc | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/net/websockets/websocket_job.cc b/net/websockets/websocket_job.cc index c096d5c..063b3ab 100644 --- a/net/websockets/websocket_job.cc +++ b/net/websockets/websocket_job.cc @@ -174,9 +174,16 @@ bool WebSocketJob::SendData(const char* data, int len) { send_frame_handler_->AppendData(data, len); // If current buffer is sending now, this data will be sent in // SendPending() after current data was sent. + // Do not buffer sending data for now. Since + // WebCore::SocketStreamHandle controls traffic to keep number of + // pending bytes less than max_pending_send_allowed, so when sending + // larger message than max_pending_send_allowed should not be buffered. + // If we don't call OnSentData, WebCore::SocketStreamHandle would stop + // sending more data when pending data reaches max_pending_send_allowed. + // TODO(ukai): Fix this to support compression for larger message. int err = 0; if (!send_frame_handler_->GetCurrentBuffer() && - (err = send_frame_handler_->UpdateCurrentBuffer()) > 0) { + (err = send_frame_handler_->UpdateCurrentBuffer(false)) > 0) { current_buffer_ = new DrainableIOBuffer( send_frame_handler_->GetCurrentBuffer(), send_frame_handler_->GetCurrentBufferSize()); @@ -278,7 +285,9 @@ void WebSocketJob::OnReceivedData( } std::string received_data; receive_frame_handler_->AppendData(data, len); - while (receive_frame_handler_->UpdateCurrentBuffer() > 0) { + // Don't buffer receiving data for now. + // TODO(ukai): fix performance of WebSocketFrameHandler. + while (receive_frame_handler_->UpdateCurrentBuffer(false) > 0) { received_data += std::string(receive_frame_handler_->GetCurrentBuffer()->data(), receive_frame_handler_->GetCurrentBufferSize()); @@ -496,7 +505,9 @@ void WebSocketJob::SaveNextCookie() { kResponseKeySize, handshake_response_.size() - handshake_response_header_length_ - kResponseKeySize); - while (receive_frame_handler_->UpdateCurrentBuffer() > 0) { + // Don't buffer receiving data for now. + // TODO(ukai): fix performance of WebSocketFrameHandler. + while (receive_frame_handler_->UpdateCurrentBuffer(false) > 0) { received_data += std::string(receive_frame_handler_->GetCurrentBuffer()->data(), receive_frame_handler_->GetCurrentBufferSize()); @@ -596,7 +607,8 @@ void WebSocketJob::SendPending() { if (current_buffer_) return; // Current buffer is done. Try next buffer if any. - if (send_frame_handler_->UpdateCurrentBuffer() <= 0) { + // Don't buffer sending data. See comment on case OPEN in SendData(). + if (send_frame_handler_->UpdateCurrentBuffer(false) <= 0) { // No more data to send. if (state_ == CLOSING) socket_->Close(); |