diff options
author | yutak@chromium.org <yutak@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-15 10:14:02 +0000 |
---|---|---|
committer | yutak@chromium.org <yutak@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-15 10:14:02 +0000 |
commit | b2c5460ef9ff1c85df3baaeb4dca032a8892e20a (patch) | |
tree | e84c98d2e81b318fde70961e7f5def393b4f8460 /net/websockets | |
parent | 53d143fd56935ed1fea50e708835e68f4b82d4e3 (diff) | |
download | chromium_src-b2c5460ef9ff1c85df3baaeb4dca032a8892e20a.zip chromium_src-b2c5460ef9ff1c85df3baaeb4dca032a8892e20a.tar.gz chromium_src-b2c5460ef9ff1c85df3baaeb4dca032a8892e20a.tar.bz2 |
Remove WebSocketFrameHandler.
WebSocketFrameHandler supports only old frame format (hybi-00) and its parser
functionality has never been used (i.e. used with unbuffered mode) for a long
time.
This change removes WebSocketFrameHandler and lets WebSocketJob handle
incoming and outgoing frame data directly.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/9112003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@122074 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/websockets')
-rw-r--r-- | net/websockets/websocket_frame_handler.cc | 140 | ||||
-rw-r--r-- | net/websockets/websocket_frame_handler.h | 83 | ||||
-rw-r--r-- | net/websockets/websocket_frame_handler_unittest.cc | 126 | ||||
-rw-r--r-- | net/websockets/websocket_job.cc | 111 | ||||
-rw-r--r-- | net/websockets/websocket_job.h | 10 |
5 files changed, 49 insertions, 421 deletions
diff --git a/net/websockets/websocket_frame_handler.cc b/net/websockets/websocket_frame_handler.cc deleted file mode 100644 index 5ac395e..0000000 --- a/net/websockets/websocket_frame_handler.cc +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include <algorithm> -#include <limits> - -#include "net/websockets/websocket_frame_handler.h" - -#include "net/base/io_buffer.h" -#include "net/base/net_errors.h" - -namespace net { - -WebSocketFrameHandler::WebSocketFrameHandler() - : current_buffer_size_(0), - original_current_buffer_size_(0) { -} - -WebSocketFrameHandler::~WebSocketFrameHandler() { -} - -void WebSocketFrameHandler::AppendData(const char* data, int length) { - scoped_refptr<IOBufferWithSize> buffer = new IOBufferWithSize(length); - memcpy(buffer->data(), data, length); - pending_buffers_.push_back(buffer); -} - -int WebSocketFrameHandler::UpdateCurrentBuffer(bool buffered) { - if (current_buffer_) - return 0; - DCHECK(!current_buffer_size_); - DCHECK(!original_current_buffer_size_); - - if (pending_buffers_.empty()) - return 0; - scoped_refptr<IOBufferWithSize> buffer = pending_buffers_.front(); - - int buffer_size = 0; - if (buffered) { - std::vector<FrameInfo> frame_info; - buffer_size = - ParseWebSocketFrame(buffer->data(), buffer->size(), &frame_info); - if (buffer_size <= 0) - return buffer_size; - - original_current_buffer_size_ = buffer_size; - - // TODO(ukai): filter(e.g. compress or decompress) frame messages. - } else { - original_current_buffer_size_ = buffer->size(); - buffer_size = buffer->size(); - } - - current_buffer_ = buffer; - current_buffer_size_ = buffer_size; - return buffer_size; -} - -void WebSocketFrameHandler::ReleaseCurrentBuffer() { - DCHECK(!pending_buffers_.empty()); - scoped_refptr<IOBufferWithSize> front_buffer = pending_buffers_.front(); - pending_buffers_.pop_front(); - int remaining_size = front_buffer->size() - original_current_buffer_size_; - if (remaining_size > 0) { - scoped_refptr<IOBufferWithSize> next_buffer = NULL; - int buffer_size = remaining_size; - if (!pending_buffers_.empty()) { - next_buffer = pending_buffers_.front(); - buffer_size += next_buffer->size(); - pending_buffers_.pop_front(); - } - // TODO(ukai): don't copy data. - scoped_refptr<IOBufferWithSize> buffer = new IOBufferWithSize(buffer_size); - memcpy(buffer->data(), front_buffer->data() + original_current_buffer_size_, - remaining_size); - if (next_buffer) - memcpy(buffer->data() + remaining_size, - next_buffer->data(), next_buffer->size()); - pending_buffers_.push_front(buffer); - } - current_buffer_ = NULL; - current_buffer_size_ = 0; - original_current_buffer_size_ = 0; -} - -/* static */ -int WebSocketFrameHandler::ParseWebSocketFrame( - const char* buffer, int size, std::vector<FrameInfo>* frame_info) { - const char* end = buffer + size; - const char* p = buffer; - int buffer_size = 0; - while (p < end) { - FrameInfo frame; - frame.frame_start = p; - frame.message_length = -1; - unsigned char frame_byte = static_cast<unsigned char>(*p++); - if ((frame_byte & 0x80) == 0x80) { - int length = 0; - while (p < end) { - // Note: might overflow later if numeric_limits<int>::max() is not - // n*128-1. - if (length > std::numeric_limits<int>::max() / 128) { - // frame length overflow. - return ERR_INSUFFICIENT_RESOURCES; - } - unsigned char c = static_cast<unsigned char>(*p); - length = length * 128 + (c & 0x7f); - ++p; - if ((c & 0x80) != 0x80) - break; - } - if (end - p >= length) { - frame.message_start = p; - frame.message_length = length; - p += length; - } else { - break; - } - } else { - frame.message_start = p; - while (p < end && *p != '\xff') - ++p; - if (p < end && *p == '\xff') { - frame.message_length = p - frame.message_start; - ++p; - } else { - break; - } - } - if (frame.message_length >= 0 && p <= end) { - frame.frame_length = p - frame.frame_start; - buffer_size += frame.frame_length; - frame_info->push_back(frame); - } - } - return buffer_size; -} - -} // namespace net diff --git a/net/websockets/websocket_frame_handler.h b/net/websockets/websocket_frame_handler.h deleted file mode 100644 index b06122e..0000000 --- a/net/websockets/websocket_frame_handler.h +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef NET_WEBSOCKETS_WEBSOCKET_FRAME_HANDLER_H_ -#define NET_WEBSOCKETS_WEBSOCKET_FRAME_HANDLER_H_ -#pragma once - -#include <deque> -#include <vector> - -#include "base/basictypes.h" -#include "base/memory/ref_counted.h" -#include "net/base/net_export.h" - -namespace net { - -class IOBuffer; -class IOBufferWithSize; - -// Handles WebSocket frame messages. -class NET_EXPORT_PRIVATE WebSocketFrameHandler { - public: - struct FrameInfo { - const char* frame_start; - int frame_length; - const char* message_start; - int message_length; - }; - - WebSocketFrameHandler(); - ~WebSocketFrameHandler(); - - // Appends WebSocket raw data on connection. - // For sending, this is data from WebKit. - // For receiving, this is data from network. - void AppendData(const char* data, int len); - - // Updates current IOBuffer. - // If |buffered| is true, it tries to find WebSocket frames. - // Otherwise, it just picks the first buffer in |pending_buffers_|. - // Returns available size of data, 0 if no more data or current buffer was - // not released, and negative if some error occurred. - int UpdateCurrentBuffer(bool buffered); - - // Gets current IOBuffer. - // For sending, this is data to network. - // For receiving, this is data to WebKit. - // Returns NULL just after ReleaseCurrentBuffer() was called. - IOBuffer* GetCurrentBuffer() { return current_buffer_.get(); } - int GetCurrentBufferSize() const { return current_buffer_size_; } - - // Returns original buffer size of current IOBuffer. - // This might differ from GetCurrentBufferSize() if frame message is - // compressed or decompressed. - int GetOriginalBufferSize() const { return original_current_buffer_size_; } - - // Releases current IOBuffer. - void ReleaseCurrentBuffer(); - - // Parses WebSocket frame in [|buffer|, |buffer|+|size|), fills frame - // information in |frame_info|, and returns number of bytes for - // complete WebSocket frames. - static int ParseWebSocketFrame(const char* buffer, int size, - std::vector<FrameInfo>* frame_info); - - private: - typedef std::deque< scoped_refptr<IOBufferWithSize> > PendingDataQueue; - - scoped_refptr<IOBuffer> current_buffer_; - int current_buffer_size_; - - int original_current_buffer_size_; - - // Deque of IOBuffers in pending. - PendingDataQueue pending_buffers_; - - DISALLOW_COPY_AND_ASSIGN(WebSocketFrameHandler); -}; - -} // namespace net - -#endif // NET_WEBSOCKETS_WEBSOCKET_FRAME_HANDLER_H_ diff --git a/net/websockets/websocket_frame_handler_unittest.cc b/net/websockets/websocket_frame_handler_unittest.cc deleted file mode 100644 index d73d5e5..0000000 --- a/net/websockets/websocket_frame_handler_unittest.cc +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "net/websockets/websocket_frame_handler.h" - -#include "base/memory/scoped_ptr.h" -#include "net/base/io_buffer.h" - -#include "testing/gmock/include/gmock/gmock.h" -#include "testing/gtest/include/gtest/gtest.h" -#include "testing/platform_test.h" - -namespace net { - -TEST(WebSocketFrameHandlerTest, Basic) { - const char kInputData[] = "\0hello, world\xff"; - const int kInputDataLen = sizeof(kInputData) - 1; // no terminating NUL. - - scoped_ptr<WebSocketFrameHandler> handler(new WebSocketFrameHandler); - - // No data. - EXPECT_EQ(0, handler->UpdateCurrentBuffer(true)); - EXPECT_TRUE(handler->GetCurrentBuffer() == NULL); - EXPECT_EQ(0, handler->GetCurrentBufferSize()); - - // WebKit sends data (WebSocketJob::SendData), - // or data is received from network (WebSocketJob::OnReceivedData) - handler->AppendData(kInputData, kInputDataLen); - EXPECT_TRUE(handler->GetCurrentBuffer() == NULL); - EXPECT_GT(handler->UpdateCurrentBuffer(true), 0); - // Get data to send to the socket (send), - // or to send to WebKit (receive). - IOBuffer* buf = handler->GetCurrentBuffer(); - ASSERT_TRUE(buf != NULL); - EXPECT_TRUE(memcmp(buf->data(), kInputData, kInputDataLen) == 0); - EXPECT_EQ(kInputDataLen, handler->GetCurrentBufferSize()); - EXPECT_EQ(kInputDataLen, handler->GetOriginalBufferSize()); - // Data was sent. (WebSocketJob::OnSentData) - buf = NULL; - handler->ReleaseCurrentBuffer(); - EXPECT_TRUE(handler->GetCurrentBuffer() == NULL); - EXPECT_EQ(0, handler->GetCurrentBufferSize()); - EXPECT_EQ(0, handler->UpdateCurrentBuffer(true)); -} - -TEST(WebSocketFrameHandlerTest, ParseFrame) { - std::vector<WebSocketFrameHandler::FrameInfo> frames; - const char kInputData[] = "\0hello, world\xff\xff\0"; - const int kInputDataLen = sizeof(kInputData) - 1; - const int kHelloWorldFrameLen = 14; - - EXPECT_EQ(kInputDataLen, - WebSocketFrameHandler::ParseWebSocketFrame( - kInputData, kInputDataLen, &frames)); - EXPECT_EQ(2UL, frames.size()); - - EXPECT_EQ(kInputData, frames[0].frame_start); - EXPECT_EQ(kHelloWorldFrameLen, frames[0].frame_length); - EXPECT_EQ(kInputData + 1, frames[0].message_start); - EXPECT_EQ(kHelloWorldFrameLen - 2, frames[0].message_length); - - EXPECT_EQ(kInputData + kHelloWorldFrameLen, frames[1].frame_start); - EXPECT_EQ(2, frames[1].frame_length); - EXPECT_EQ(0, frames[1].message_length); -} - -TEST(WebSocketFrameHandlerTest, ParseFrameLength) { - std::vector<WebSocketFrameHandler::FrameInfo> frames; - const char kHelloWorldFrame[] = "\0hello, world\xff"; - const int kHelloWorldFrameLen = sizeof(kHelloWorldFrame) - 1; - const char kLengthFrame[3 + 129] = "\x80\x81\x01\x01\0should be skipped\xff"; - const int kLengthFrameLen = sizeof(kLengthFrame); - const int kInputDataLen = kHelloWorldFrameLen + - kLengthFrameLen + - kHelloWorldFrameLen; - char inputData[kInputDataLen]; - memcpy(inputData, kHelloWorldFrame, kHelloWorldFrameLen); - memcpy(inputData + kHelloWorldFrameLen, kLengthFrame, kLengthFrameLen); - memcpy(inputData + kHelloWorldFrameLen + kLengthFrameLen, - kHelloWorldFrame, kHelloWorldFrameLen); - - EXPECT_EQ(kInputDataLen, - WebSocketFrameHandler::ParseWebSocketFrame( - inputData, kInputDataLen, &frames)); - ASSERT_EQ(3UL, frames.size()); - - EXPECT_EQ(inputData, frames[0].frame_start); - EXPECT_EQ(kHelloWorldFrameLen, frames[0].frame_length); - EXPECT_EQ(inputData + 1, frames[0].message_start); - EXPECT_EQ(kHelloWorldFrameLen - 2, frames[0].message_length); - - EXPECT_EQ(inputData + kHelloWorldFrameLen, frames[1].frame_start); - EXPECT_EQ(kLengthFrameLen, frames[1].frame_length); - EXPECT_EQ(inputData + kHelloWorldFrameLen + 3, frames[1].message_start); - EXPECT_EQ(kLengthFrameLen - 3, frames[1].message_length); - - EXPECT_EQ(inputData + kHelloWorldFrameLen + kLengthFrameLen, - frames[2].frame_start); - EXPECT_EQ(kHelloWorldFrameLen, frames[2].frame_length); - EXPECT_EQ(inputData + kHelloWorldFrameLen + kLengthFrameLen + 1, - frames[2].message_start); - EXPECT_EQ(kHelloWorldFrameLen - 2, frames[2].message_length); -} - -TEST(WebSocketFrameHandlerTest, ParsePartialFrame) { - std::vector<WebSocketFrameHandler::FrameInfo> frames; - const char kInputData[] = "\0hello, world\xff" - "\x80\x81\x01" // skip 1*128+1 bytes. - "\x01\xff" - "\0should be skipped\xff"; - const int kInputDataLen = sizeof(kInputData) - 1; - const int kHelloWorldFrameLen = 14; - - EXPECT_EQ(kHelloWorldFrameLen, - WebSocketFrameHandler::ParseWebSocketFrame( - kInputData, kInputDataLen, &frames)); - ASSERT_EQ(1UL, frames.size()); - - EXPECT_EQ(kInputData, frames[0].frame_start); - EXPECT_EQ(kHelloWorldFrameLen, frames[0].frame_length); - EXPECT_EQ(kInputData + 1, frames[0].message_start); - EXPECT_EQ(kHelloWorldFrameLen - 2, frames[0].message_length); -} - -} // namespace net diff --git a/net/websockets/websocket_job.cc b/net/websockets/websocket_job.cc index f989c06..b6f1b2b 100644 --- a/net/websockets/websocket_job.cc +++ b/net/websockets/websocket_job.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -20,7 +20,6 @@ #include "net/spdy/spdy_session.h" #include "net/spdy/spdy_session_pool.h" #include "net/url_request/url_request_context.h" -#include "net/websockets/websocket_frame_handler.h" #include "net/websockets/websocket_handshake_handler.h" #include "net/websockets/websocket_net_log_params.h" #include "net/websockets/websocket_throttle.h" @@ -81,8 +80,6 @@ WebSocketJob::WebSocketJob(SocketStream::Delegate* delegate) started_to_send_handshake_request_(false), handshake_request_sent_(0), response_cookies_save_index_(0), - send_frame_handler_(new WebSocketFrameHandler), - receive_frame_handler_(new WebSocketFrameHandler), ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)), ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_for_send_pending_(this)) { } @@ -110,28 +107,15 @@ bool WebSocketJob::SendData(const char* data, int len) { case OPEN: { - 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(false)) > 0) { - DCHECK(!current_buffer_); - current_buffer_ = new DrainableIOBuffer( - send_frame_handler_->GetCurrentBuffer(), - send_frame_handler_->GetCurrentBufferSize()); - return SendDataInternal( - current_buffer_->data(), current_buffer_->BytesRemaining()); + scoped_refptr<IOBufferWithSize> buffer = new IOBufferWithSize(len); + memcpy(buffer->data(), data, len); + if (current_send_buffer_ || !send_buffer_queue_.empty()) { + send_buffer_queue_.push_back(buffer); + return true; } - return err >= 0; + current_send_buffer_ = new DrainableIOBuffer(buffer.get(), len); + return SendDataInternal(current_send_buffer_->data(), + current_send_buffer_->BytesRemaining()); } case CLOSING: @@ -146,7 +130,7 @@ void WebSocketJob::Close() { return; state_ = CLOSING; - if (current_buffer_) { + if (current_send_buffer_) { // Will close in SendPending. return; } @@ -219,20 +203,20 @@ void WebSocketJob::OnSentData(SocketStream* socket, int amount_sent) { } if (delegate_) { DCHECK(state_ == OPEN || state_ == CLOSING); - if (current_buffer_ == NULL) { - VLOG(1) << "OnSentData current_buffer=NULL amount_sent=" << amount_sent; + if (!current_send_buffer_) { + VLOG(1) << "OnSentData current_send_buffer=NULL amount_sent=" + << amount_sent; return; } - current_buffer_->DidConsume(amount_sent); - if (current_buffer_->BytesRemaining() > 0) + current_send_buffer_->DidConsume(amount_sent); + if (current_send_buffer_->BytesRemaining() > 0) return; // We need to report amount_sent of original buffer size, instead of // amount sent to |socket|. - amount_sent = send_frame_handler_->GetOriginalBufferSize(); + amount_sent = current_send_buffer_->size(); DCHECK_GT(amount_sent, 0); - current_buffer_ = NULL; - send_frame_handler_->ReleaseCurrentBuffer(); + current_send_buffer_ = NULL; if (!weak_ptr_factory_for_send_pending_.HasWeakPtrs()) { MessageLoopForIO::current()->PostTask( FROM_HERE, @@ -253,19 +237,8 @@ void WebSocketJob::OnReceivedData( return; } DCHECK(state_ == OPEN || state_ == CLOSING); - std::string received_data; - receive_frame_handler_->AppendData(data, len); - // 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()); - receive_frame_handler_->ReleaseCurrentBuffer(); - } - if (delegate_ && !received_data.empty()) - delegate_->OnReceivedData( - socket, received_data.data(), received_data.size()); + if (delegate_ && len > 0) + delegate_->OnReceivedData(socket, data, len); } void WebSocketJob::OnClose(SocketStream* socket) { @@ -449,7 +422,8 @@ void WebSocketJob::OnReceivedHandshakeResponse( if (handshake_response_->HasResponse()) { // If we already has handshake response, received data should be frame // data, not handshake message. - receive_frame_handler_->AppendData(data, len); + received_data_after_handshake_.insert( + received_data_after_handshake_.end(), data, data + len); return; } @@ -465,8 +439,8 @@ void WebSocketJob::OnReceivedHandshakeResponse( handshake_response_->GetRawResponse()))); if (len - response_length > 0) { // If we received extra data, it should be frame data. - receive_frame_handler_->AppendData(data + response_length, - len - response_length); + DCHECK(received_data_after_handshake_.empty()); + received_data_after_handshake_.assign(data + response_length, data + len); } SaveCookiesAndNotifyHeaderComplete(); } @@ -494,20 +468,20 @@ void WebSocketJob::SaveNextCookie() { // Actual handshake should be done in WebKit. handshake_response_->RemoveHeaders( kSetCookieHeaders, arraysize(kSetCookieHeaders)); - std::string received_data = handshake_response_->GetResponse(); - // 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()); - receive_frame_handler_->ReleaseCurrentBuffer(); - } + std::string handshake_response = handshake_response_->GetResponse(); + std::vector<char> received_data(handshake_response.begin(), + handshake_response.end()); + received_data.insert(received_data.end(), + received_data_after_handshake_.begin(), + received_data_after_handshake_.end()); + received_data_after_handshake_.clear(); state_ = OPEN; + + DCHECK(!received_data.empty()); if (delegate_) delegate_->OnReceivedData( - socket_, received_data.data(), received_data.size()); + socket_, &received_data.front(), received_data.size()); handshake_response_.reset(); @@ -659,20 +633,23 @@ void WebSocketJob::CloseInternal() { } void WebSocketJob::SendPending() { - if (current_buffer_) + if (current_send_buffer_) return; - // Current buffer is done. Try next buffer if any. - // Don't buffer sending data. See comment on case OPEN in SendData(). - if (send_frame_handler_->UpdateCurrentBuffer(false) <= 0) { + + // Current buffer has been sent. Try next if any. + if (send_buffer_queue_.empty()) { // No more data to send. if (state_ == CLOSING) CloseInternal(); return; } - current_buffer_ = new DrainableIOBuffer( - send_frame_handler_->GetCurrentBuffer(), - send_frame_handler_->GetCurrentBufferSize()); - SendDataInternal(current_buffer_->data(), current_buffer_->BytesRemaining()); + + scoped_refptr<IOBufferWithSize> next_buffer = send_buffer_queue_.front(); + send_buffer_queue_.pop_front(); + current_send_buffer_ = new DrainableIOBuffer(next_buffer, + next_buffer->size()); + SendDataInternal(current_send_buffer_->data(), + current_send_buffer_->BytesRemaining()); } } // namespace net diff --git a/net/websockets/websocket_job.h b/net/websockets/websocket_job.h index 61b1d8d..64f20ce 100644 --- a/net/websockets/websocket_job.h +++ b/net/websockets/websocket_job.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -6,6 +6,7 @@ #define NET_WEBSOCKETS_WEBSOCKET_JOB_H_ #pragma once +#include <deque> #include <string> #include <vector> @@ -20,7 +21,6 @@ class GURL; namespace net { class DrainableIOBuffer; -class WebSocketFrameHandler; class WebSocketHandshakeRequestHandler; class WebSocketHandshakeResponseHandler; @@ -130,9 +130,9 @@ class NET_EXPORT WebSocketJob std::vector<std::string> response_cookies_; size_t response_cookies_save_index_; - scoped_ptr<WebSocketFrameHandler> send_frame_handler_; - scoped_refptr<DrainableIOBuffer> current_buffer_; - scoped_ptr<WebSocketFrameHandler> receive_frame_handler_; + std::deque<scoped_refptr<IOBufferWithSize> > send_buffer_queue_; + scoped_refptr<DrainableIOBuffer> current_send_buffer_; + std::vector<char> received_data_after_handshake_; scoped_ptr<SpdyWebSocketStream> spdy_websocket_stream_; std::string challenge_; |