From f54c8579cc1645a8accff998f0effbf6cea5fc78 Mon Sep 17 00:00:00 2001 From: "rtenneti@chromium.org" Date: Thu, 8 Mar 2012 19:06:41 +0000 Subject: SPDY - pass spdy protocol version that will be used by the SpdyFramer. A minor change to use BufferedSpdyFramer in unittests (thus added couple of API calls to BufferedSpdyFramer that in turn call SpdyFramer's API calls. Minor cleanup of include of spdy_framer.h R=rch TEST=network unittests BUG=117287 Review URL: http://codereview.chromium.org/9622017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@125651 0039d316-1c4b-4281-b951-d872f2087c98 --- net/spdy/buffered_spdy_framer.cc | 50 +++++++++++++++++++--- net/spdy/buffered_spdy_framer.h | 15 ++++++- net/spdy/buffered_spdy_framer_spdy2_unittest.cc | 9 ++-- net/spdy/buffered_spdy_framer_spdy3_unittest.cc | 9 ++-- .../spdy_network_transaction_spdy21_unittest.cc | 11 ++--- .../spdy_network_transaction_spdy2_unittest.cc | 11 ++--- .../spdy_network_transaction_spdy3_unittest.cc | 11 ++--- .../spdy_proxy_client_socket_spdy2_unittest.cc | 5 ++- .../spdy_proxy_client_socket_spdy3_unittest.cc | 5 ++- net/spdy/spdy_session.cc | 10 ++--- net/spdy/spdy_stream_spdy2_unittest.cc | 3 +- net/spdy/spdy_stream_spdy3_unittest.cc | 3 +- net/spdy/spdy_test_util_spdy2.cc | 20 ++++----- net/spdy/spdy_test_util_spdy2.h | 1 - net/spdy/spdy_test_util_spdy3.cc | 20 ++++----- net/spdy/spdy_test_util_spdy3.h | 1 - net/spdy/spdy_websocket_test_util_spdy2.cc | 4 +- net/spdy/spdy_websocket_test_util_spdy3.cc | 4 +- net/tools/flip_server/spdy_interface.cc | 4 +- 19 files changed, 126 insertions(+), 70 deletions(-) (limited to 'net') diff --git a/net/spdy/buffered_spdy_framer.cc b/net/spdy/buffered_spdy_framer.cc index a1d12da..a07cb61 100644 --- a/net/spdy/buffered_spdy_framer.cc +++ b/net/spdy/buffered_spdy_framer.cc @@ -8,8 +8,9 @@ namespace spdy { -BufferedSpdyFramer::BufferedSpdyFramer() - : visitor_(NULL), +BufferedSpdyFramer::BufferedSpdyFramer(int version) + : spdy_framer_(), + visitor_(NULL), header_buffer_used_(0), header_buffer_valid_(false), header_stream_id_(SpdyFramer::kInvalidStream), @@ -39,19 +40,19 @@ void BufferedSpdyFramer::OnControl(const SpdyControlFrame* frame) { case HEADERS: InitHeaderStreaming(frame); break; - case spdy::GOAWAY: + case GOAWAY: visitor_->OnGoAway( *reinterpret_cast(frame)); break; - case spdy::PING: + case PING: visitor_->OnPing( *reinterpret_cast(frame)); break; - case spdy::SETTINGS: + case SETTINGS: visitor_->OnSettings( *reinterpret_cast(frame)); break; - case spdy::RST_STREAM: + case RST_STREAM: visitor_->OnRstStream( *reinterpret_cast(frame)); break; @@ -80,7 +81,7 @@ bool BufferedSpdyFramer::OnControlFrameHeaderData(SpdyStreamId stream_id, CHECK(header_buffer_valid_); const linked_ptr headers(new SpdyHeaderBlock); - bool parsed_headers = SpdyFramer::ParseHeaderBlockInBuffer( + bool parsed_headers = spdy_framer_.ParseHeaderBlockInBuffer( header_buffer_, header_buffer_used_, headers.get()); if (!parsed_headers) { visitor_->OnStreamError( @@ -135,6 +136,9 @@ void BufferedSpdyFramer::OnStreamFrameData(SpdyStreamId stream_id, visitor_->OnStreamFrameData(stream_id, data, len); } +int BufferedSpdyFramer::protocol_version() { + return spdy_framer_.protocol_version(); +} size_t BufferedSpdyFramer::ProcessInput(const char* data, size_t len) { return spdy_framer_.ProcessInput(data, len); @@ -184,6 +188,27 @@ SpdySynReplyControlFrame* BufferedSpdyFramer::CreateSynReply( return spdy_framer_.CreateSynReply(stream_id, flags, compressed, headers); } +SpdyRstStreamControlFrame* BufferedSpdyFramer::CreateRstStream( + SpdyStreamId stream_id, + SpdyStatusCodes status) const { + return spdy_framer_.CreateRstStream(stream_id, status); +} + +SpdySettingsControlFrame* BufferedSpdyFramer::CreateSettings( + const SpdySettings& values) const { + return spdy_framer_.CreateSettings(values); +} + +SpdyPingControlFrame* BufferedSpdyFramer::CreatePingFrame( + uint32 unique_id) const { + return spdy_framer_.CreatePingFrame(unique_id); +} + +SpdyGoAwayControlFrame* BufferedSpdyFramer::CreateGoAway( + SpdyStreamId last_accepted_stream_id) const { + return spdy_framer_.CreateGoAway(last_accepted_stream_id); +} + SpdyHeadersControlFrame* BufferedSpdyFramer::CreateHeaders( SpdyStreamId stream_id, SpdyControlFlags flags, @@ -192,6 +217,17 @@ SpdyHeadersControlFrame* BufferedSpdyFramer::CreateHeaders( return spdy_framer_.CreateHeaders(stream_id, flags, compressed, headers); } +SpdyWindowUpdateControlFrame* BufferedSpdyFramer::CreateWindowUpdate( + SpdyStreamId stream_id, + uint32 delta_window_size) const { + return spdy_framer_.CreateWindowUpdate(stream_id, delta_window_size); +} + +SpdyCredentialControlFrame* BufferedSpdyFramer::CreateCredentialFrame( + const spdy::SpdyCredential& credential) const { + return spdy_framer_.CreateCredentialFrame(credential); +} + SpdyDataFrame* BufferedSpdyFramer::CreateDataFrame(SpdyStreamId stream_id, const char* data, uint32 len, diff --git a/net/spdy/buffered_spdy_framer.h b/net/spdy/buffered_spdy_framer.h index ae6b9ba..c784764 100644 --- a/net/spdy/buffered_spdy_framer.h +++ b/net/spdy/buffered_spdy_framer.h @@ -67,6 +67,7 @@ class NET_EXPORT_PRIVATE BufferedSpdyFramerVisitorInterface { virtual void OnStreamFrameData(SpdyStreamId stream_id, const char* data, size_t len) = 0; + private: DISALLOW_COPY_AND_ASSIGN(BufferedSpdyFramerVisitorInterface); }; @@ -74,7 +75,7 @@ class NET_EXPORT_PRIVATE BufferedSpdyFramerVisitorInterface { class NET_EXPORT_PRIVATE BufferedSpdyFramer : public SpdyFramerVisitorInterface { public: - BufferedSpdyFramer(); + explicit BufferedSpdyFramer(int version); virtual ~BufferedSpdyFramer(); // Sets callbacks to be called from the buffered spdy framer. A visitor must @@ -98,6 +99,7 @@ class NET_EXPORT_PRIVATE BufferedSpdyFramer // SpdyFramer methods. size_t ProcessInput(const char* data, size_t len); + int protocol_version(); void Reset(); SpdyFramer::SpdyError error_code() const; SpdyFramer::SpdyState state() const; @@ -114,10 +116,21 @@ class NET_EXPORT_PRIVATE BufferedSpdyFramer SpdyControlFlags flags, bool compressed, const SpdyHeaderBlock* headers); + SpdyRstStreamControlFrame* CreateRstStream(SpdyStreamId stream_id, + SpdyStatusCodes status) const; + SpdySettingsControlFrame* CreateSettings(const SpdySettings& values) const; + SpdyPingControlFrame* CreatePingFrame(uint32 unique_id) const; + SpdyGoAwayControlFrame* CreateGoAway( + SpdyStreamId last_accepted_stream_id) const; SpdyHeadersControlFrame* CreateHeaders(SpdyStreamId stream_id, SpdyControlFlags flags, bool compressed, const SpdyHeaderBlock* headers); + SpdyWindowUpdateControlFrame* CreateWindowUpdate( + SpdyStreamId stream_id, + uint32 delta_window_size) const; + SpdyCredentialControlFrame* CreateCredentialFrame( + const spdy::SpdyCredential& credential) const; SpdyDataFrame* CreateDataFrame(SpdyStreamId stream_id, const char* data, uint32 len, diff --git a/net/spdy/buffered_spdy_framer_spdy2_unittest.cc b/net/spdy/buffered_spdy_framer_spdy2_unittest.cc index 135a635..e267603 100644 --- a/net/spdy/buffered_spdy_framer_spdy2_unittest.cc +++ b/net/spdy/buffered_spdy_framer_spdy2_unittest.cc @@ -16,7 +16,8 @@ namespace { class TestBufferedSpdyVisitor : public BufferedSpdyFramerVisitorInterface { public: TestBufferedSpdyVisitor() - : error_count_(0), + : buffered_spdy_framer_(2), + error_count_(0), syn_frame_count_(0), syn_reply_frame_count_(0), headers_frame_count_(0), @@ -175,7 +176,7 @@ TEST_F(BufferedSpdyFramerSpdy2Test, ReadSynStreamHeaderBlock) { SpdyHeaderBlock headers; headers["aa"] = "vv"; headers["bb"] = "ww"; - BufferedSpdyFramer framer; + BufferedSpdyFramer framer(2); scoped_ptr control_frame( framer.CreateSynStream(1, // stream_id 0, // associated_stream_id @@ -202,7 +203,7 @@ TEST_F(BufferedSpdyFramerSpdy2Test, ReadSynReplyHeaderBlock) { SpdyHeaderBlock headers; headers["alpha"] = "beta"; headers["gamma"] = "delta"; - BufferedSpdyFramer framer; + BufferedSpdyFramer framer(2); scoped_ptr control_frame( framer.CreateSynReply(1, // stream_id CONTROL_FLAG_NONE, @@ -227,7 +228,7 @@ TEST_F(BufferedSpdyFramerSpdy2Test, ReadHeadersHeaderBlock) { SpdyHeaderBlock headers; headers["alpha"] = "beta"; headers["gamma"] = "delta"; - BufferedSpdyFramer framer; + BufferedSpdyFramer framer(2); scoped_ptr control_frame( framer.CreateHeaders(1, // stream_id CONTROL_FLAG_NONE, diff --git a/net/spdy/buffered_spdy_framer_spdy3_unittest.cc b/net/spdy/buffered_spdy_framer_spdy3_unittest.cc index 85a6c45..19f07c3 100644 --- a/net/spdy/buffered_spdy_framer_spdy3_unittest.cc +++ b/net/spdy/buffered_spdy_framer_spdy3_unittest.cc @@ -16,7 +16,8 @@ namespace { class TestBufferedSpdyVisitor : public BufferedSpdyFramerVisitorInterface { public: TestBufferedSpdyVisitor() - : error_count_(0), + : buffered_spdy_framer_(3), + error_count_(0), syn_frame_count_(0), syn_reply_frame_count_(0), headers_frame_count_(0), @@ -175,7 +176,7 @@ TEST_F(BufferedSpdyFramerSpdy3Test, ReadSynStreamHeaderBlock) { SpdyHeaderBlock headers; headers["aa"] = "vv"; headers["bb"] = "ww"; - BufferedSpdyFramer framer; + BufferedSpdyFramer framer(3); scoped_ptr control_frame( framer.CreateSynStream(1, // stream_id 0, // associated_stream_id @@ -202,7 +203,7 @@ TEST_F(BufferedSpdyFramerSpdy3Test, ReadSynReplyHeaderBlock) { SpdyHeaderBlock headers; headers["alpha"] = "beta"; headers["gamma"] = "delta"; - BufferedSpdyFramer framer; + BufferedSpdyFramer framer(3); scoped_ptr control_frame( framer.CreateSynReply(1, // stream_id CONTROL_FLAG_NONE, @@ -227,7 +228,7 @@ TEST_F(BufferedSpdyFramerSpdy3Test, ReadHeadersHeaderBlock) { SpdyHeaderBlock headers; headers["alpha"] = "beta"; headers["gamma"] = "delta"; - BufferedSpdyFramer framer; + BufferedSpdyFramer framer(3); scoped_ptr control_frame( framer.CreateHeaders(1, // stream_id CONTROL_FLAG_NONE, diff --git a/net/spdy/spdy_network_transaction_spdy21_unittest.cc b/net/spdy/spdy_network_transaction_spdy21_unittest.cc index 749ee22..e4a5f22 100644 --- a/net/spdy/spdy_network_transaction_spdy21_unittest.cc +++ b/net/spdy/spdy_network_transaction_spdy21_unittest.cc @@ -14,6 +14,7 @@ #include "net/http/http_network_session_peer.h" #include "net/http/http_transaction_unittest.h" #include "net/socket/client_socket_pool_base.h" +#include "net/spdy/buffered_spdy_framer.h" #include "net/spdy/spdy_http_stream.h" #include "net/spdy/spdy_http_utils.h" #include "net/spdy/spdy_session.h" @@ -3949,7 +3950,7 @@ TEST_P(SpdyNetworkTransactionSpdy21Test, NetLog) { TEST_P(SpdyNetworkTransactionSpdy21Test, BufferFull) { SpdySession::set_use_flow_control(SpdySession::kDisableFlowControl); - spdy::SpdyFramer framer; + spdy::BufferedSpdyFramer framer(2); scoped_ptr req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); MockWrite writes[] = { CreateMockWrite(*req) }; @@ -4048,7 +4049,7 @@ TEST_P(SpdyNetworkTransactionSpdy21Test, BufferFull) { TEST_P(SpdyNetworkTransactionSpdy21Test, Buffering) { SpdySession::set_use_flow_control(SpdySession::kDisableFlowControl); - spdy::SpdyFramer framer; + spdy::BufferedSpdyFramer framer(2); scoped_ptr req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); MockWrite writes[] = { CreateMockWrite(*req) }; @@ -4145,7 +4146,7 @@ TEST_P(SpdyNetworkTransactionSpdy21Test, Buffering) { // Verify the case where we buffer data but read it after it has been buffered. TEST_P(SpdyNetworkTransactionSpdy21Test, BufferedAll) { - spdy::SpdyFramer framer; + spdy::BufferedSpdyFramer framer(2); scoped_ptr req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); MockWrite writes[] = { CreateMockWrite(*req) }; @@ -4237,7 +4238,7 @@ TEST_P(SpdyNetworkTransactionSpdy21Test, BufferedAll) { // Verify the case where we buffer data and close the connection. TEST_P(SpdyNetworkTransactionSpdy21Test, BufferedClosed) { - spdy::SpdyFramer framer; + spdy::BufferedSpdyFramer framer(2); scoped_ptr req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); MockWrite writes[] = { CreateMockWrite(*req) }; @@ -4328,7 +4329,7 @@ TEST_P(SpdyNetworkTransactionSpdy21Test, BufferedClosed) { // Verify the case where we buffer data and cancel the transaction. TEST_P(SpdyNetworkTransactionSpdy21Test, BufferedCancelled) { - spdy::SpdyFramer framer; + spdy::BufferedSpdyFramer framer(2); scoped_ptr req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); MockWrite writes[] = { CreateMockWrite(*req) }; diff --git a/net/spdy/spdy_network_transaction_spdy2_unittest.cc b/net/spdy/spdy_network_transaction_spdy2_unittest.cc index 5859a98..a083b53 100644 --- a/net/spdy/spdy_network_transaction_spdy2_unittest.cc +++ b/net/spdy/spdy_network_transaction_spdy2_unittest.cc @@ -14,6 +14,7 @@ #include "net/http/http_network_session_peer.h" #include "net/http/http_transaction_unittest.h" #include "net/socket/client_socket_pool_base.h" +#include "net/spdy/buffered_spdy_framer.h" #include "net/spdy/spdy_http_stream.h" #include "net/spdy/spdy_http_utils.h" #include "net/spdy/spdy_session.h" @@ -3569,7 +3570,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, NetLog) { TEST_P(SpdyNetworkTransactionSpdy2Test, BufferFull) { SpdySession::set_use_flow_control(SpdySession::kDisableFlowControl); - spdy::SpdyFramer framer; + spdy::BufferedSpdyFramer framer(2); scoped_ptr req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); MockWrite writes[] = { CreateMockWrite(*req) }; @@ -3668,7 +3669,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, BufferFull) { TEST_P(SpdyNetworkTransactionSpdy2Test, Buffering) { SpdySession::set_use_flow_control(SpdySession::kDisableFlowControl); - spdy::SpdyFramer framer; + spdy::BufferedSpdyFramer framer(2); scoped_ptr req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); MockWrite writes[] = { CreateMockWrite(*req) }; @@ -3765,7 +3766,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, Buffering) { // Verify the case where we buffer data but read it after it has been buffered. TEST_P(SpdyNetworkTransactionSpdy2Test, BufferedAll) { - spdy::SpdyFramer framer; + spdy::BufferedSpdyFramer framer(2); scoped_ptr req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); MockWrite writes[] = { CreateMockWrite(*req) }; @@ -3857,7 +3858,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, BufferedAll) { // Verify the case where we buffer data and close the connection. TEST_P(SpdyNetworkTransactionSpdy2Test, BufferedClosed) { - spdy::SpdyFramer framer; + spdy::BufferedSpdyFramer framer(2); scoped_ptr req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); MockWrite writes[] = { CreateMockWrite(*req) }; @@ -3948,7 +3949,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, BufferedClosed) { // Verify the case where we buffer data and cancel the transaction. TEST_P(SpdyNetworkTransactionSpdy2Test, BufferedCancelled) { - spdy::SpdyFramer framer; + spdy::BufferedSpdyFramer framer(2); scoped_ptr req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); MockWrite writes[] = { CreateMockWrite(*req) }; diff --git a/net/spdy/spdy_network_transaction_spdy3_unittest.cc b/net/spdy/spdy_network_transaction_spdy3_unittest.cc index ab5ff07..c156345 100644 --- a/net/spdy/spdy_network_transaction_spdy3_unittest.cc +++ b/net/spdy/spdy_network_transaction_spdy3_unittest.cc @@ -14,6 +14,7 @@ #include "net/http/http_network_session_peer.h" #include "net/http/http_transaction_unittest.h" #include "net/socket/client_socket_pool_base.h" +#include "net/spdy/buffered_spdy_framer.h" #include "net/spdy/spdy_http_stream.h" #include "net/spdy/spdy_http_utils.h" #include "net/spdy/spdy_session.h" @@ -3948,7 +3949,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, NetLog) { TEST_P(SpdyNetworkTransactionSpdy3Test, BufferFull) { SpdySession::set_use_flow_control(SpdySession::kDisableFlowControl); - spdy::SpdyFramer framer; + spdy::BufferedSpdyFramer framer(3); scoped_ptr req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); MockWrite writes[] = { CreateMockWrite(*req) }; @@ -4047,7 +4048,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, BufferFull) { TEST_P(SpdyNetworkTransactionSpdy3Test, Buffering) { SpdySession::set_use_flow_control(SpdySession::kDisableFlowControl); - spdy::SpdyFramer framer; + spdy::BufferedSpdyFramer framer(3); scoped_ptr req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); MockWrite writes[] = { CreateMockWrite(*req) }; @@ -4144,7 +4145,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, Buffering) { // Verify the case where we buffer data but read it after it has been buffered. TEST_P(SpdyNetworkTransactionSpdy3Test, BufferedAll) { - spdy::SpdyFramer framer; + spdy::BufferedSpdyFramer framer(3); scoped_ptr req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); MockWrite writes[] = { CreateMockWrite(*req) }; @@ -4236,7 +4237,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, BufferedAll) { // Verify the case where we buffer data and close the connection. TEST_P(SpdyNetworkTransactionSpdy3Test, BufferedClosed) { - spdy::SpdyFramer framer; + spdy::BufferedSpdyFramer framer(3); scoped_ptr req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); MockWrite writes[] = { CreateMockWrite(*req) }; @@ -4327,7 +4328,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, BufferedClosed) { // Verify the case where we buffer data and cancel the transaction. TEST_P(SpdyNetworkTransactionSpdy3Test, BufferedCancelled) { - spdy::SpdyFramer framer; + spdy::BufferedSpdyFramer framer(3); scoped_ptr req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); MockWrite writes[] = { CreateMockWrite(*req) }; diff --git a/net/spdy/spdy_proxy_client_socket_spdy2_unittest.cc b/net/spdy/spdy_proxy_client_socket_spdy2_unittest.cc index e20a189..eaf4fbe 100644 --- a/net/spdy/spdy_proxy_client_socket_spdy2_unittest.cc +++ b/net/spdy/spdy_proxy_client_socket_spdy2_unittest.cc @@ -18,6 +18,7 @@ #include "net/socket/client_socket_factory.h" #include "net/socket/tcp_client_socket.h" #include "net/socket/socket_test_util.h" +#include "net/spdy/buffered_spdy_framer.h" #include "net/spdy/spdy_http_utils.h" #include "net/spdy/spdy_protocol.h" #include "net/spdy/spdy_session_pool.h" @@ -114,7 +115,7 @@ class SpdyProxyClientSocketSpdy2Test : public PlatformTest { MockConnect connect_data_; scoped_refptr spdy_session_; scoped_refptr spdy_stream_; - spdy::SpdyFramer framer_; + spdy::BufferedSpdyFramer framer_; std::string user_agent_; GURL url_; @@ -136,7 +137,7 @@ SpdyProxyClientSocketSpdy2Test::SpdyProxyClientSocketSpdy2Test() connect_data_(SYNCHRONOUS, OK), spdy_session_(NULL), spdy_stream_(NULL), - framer_(), + framer_(2), user_agent_(kUserAgent), url_(kUrl), proxy_host_port_(kProxyHost, kProxyPort), diff --git a/net/spdy/spdy_proxy_client_socket_spdy3_unittest.cc b/net/spdy/spdy_proxy_client_socket_spdy3_unittest.cc index f3921a1..da3456b 100644 --- a/net/spdy/spdy_proxy_client_socket_spdy3_unittest.cc +++ b/net/spdy/spdy_proxy_client_socket_spdy3_unittest.cc @@ -18,6 +18,7 @@ #include "net/socket/client_socket_factory.h" #include "net/socket/tcp_client_socket.h" #include "net/socket/socket_test_util.h" +#include "net/spdy/buffered_spdy_framer.h" #include "net/spdy/spdy_http_utils.h" #include "net/spdy/spdy_protocol.h" #include "net/spdy/spdy_session_pool.h" @@ -114,7 +115,7 @@ class SpdyProxyClientSocketSpdy3Test : public PlatformTest { MockConnect connect_data_; scoped_refptr spdy_session_; scoped_refptr spdy_stream_; - spdy::SpdyFramer framer_; + spdy::BufferedSpdyFramer framer_; std::string user_agent_; GURL url_; @@ -136,7 +137,7 @@ SpdyProxyClientSocketSpdy3Test::SpdyProxyClientSocketSpdy3Test() connect_data_(SYNCHRONOUS, OK), spdy_session_(NULL), spdy_stream_(NULL), - framer_(), + framer_(3), user_agent_(kUserAgent), url_(kUrl), proxy_host_port_(kProxyHost, kProxyPort), diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc index 06abd11..9a8063b 100644 --- a/net/spdy/spdy_session.cc +++ b/net/spdy/spdy_session.cc @@ -398,7 +398,7 @@ net::Error SpdySession::InitializeWithSocket( } } - buffered_spdy_framer_.reset(new spdy::BufferedSpdyFramer()); + buffered_spdy_framer_.reset(new spdy::BufferedSpdyFramer(2)); buffered_spdy_framer_->set_visitor(this); SendSettings(); @@ -673,7 +673,7 @@ int SpdySession::WriteCredentialFrame(const std::string& origin, DCHECK(buffered_spdy_framer_.get()); scoped_ptr credential_frame( - spdy::SpdyFramer::CreateCredentialFrame(credential)); + buffered_spdy_framer_->CreateCredentialFrame(credential)); QueueFrame(credential_frame.get(), priority, NULL); if (net_log().IsLoggingAllEvents()) { @@ -771,7 +771,7 @@ void SpdySession::ResetStream(spdy::SpdyStreamId stream_id, DCHECK(buffered_spdy_framer_.get()); scoped_ptr rst_frame( - spdy::SpdyFramer::CreateRstStream(stream_id, status)); + buffered_spdy_framer_->CreateRstStream(stream_id, status)); // Default to lowest priority unless we know otherwise. int priority = 3; @@ -1611,7 +1611,7 @@ void SpdySession::SendWindowUpdate(spdy::SpdyStreamId stream_id, DCHECK(buffered_spdy_framer_.get()); scoped_ptr window_update_frame( - spdy::SpdyFramer::CreateWindowUpdate(stream_id, delta_window_size)); + buffered_spdy_framer_->CreateWindowUpdate(stream_id, delta_window_size)); QueueFrame(window_update_frame.get(), stream->priority(), NULL); } @@ -1676,7 +1676,7 @@ void SpdySession::SendSettings() { // Create the SETTINGS frame and send it. DCHECK(buffered_spdy_framer_.get()); scoped_ptr settings_frame( - spdy::SpdyFramer::CreateSettings(settings)); + buffered_spdy_framer_->CreateSettings(settings)); sent_settings_ = true; QueueFrame(settings_frame.get(), 0, NULL); } diff --git a/net/spdy/spdy_stream_spdy2_unittest.cc b/net/spdy/spdy_stream_spdy2_unittest.cc index b59324e..e57105c 100644 --- a/net/spdy/spdy_stream_spdy2_unittest.cc +++ b/net/spdy/spdy_stream_spdy2_unittest.cc @@ -5,6 +5,7 @@ #include "base/memory/ref_counted.h" #include "net/base/completion_callback.h" #include "net/base/net_log_unittest.h" +#include "net/spdy/buffered_spdy_framer.h" #include "net/spdy/spdy_stream.h" #include "net/spdy/spdy_http_utils.h" #include "net/spdy/spdy_session.h" @@ -92,7 +93,7 @@ class TestSpdyStreamDelegate : public SpdyStream::Delegate { }; spdy::SpdyFrame* ConstructSpdyBodyFrame(const char* data, int length) { - spdy::SpdyFramer framer; + spdy::BufferedSpdyFramer framer(2); return framer.CreateDataFrame(1, data, length, spdy::DATA_FLAG_NONE); } diff --git a/net/spdy/spdy_stream_spdy3_unittest.cc b/net/spdy/spdy_stream_spdy3_unittest.cc index 98e154f..38f9787 100644 --- a/net/spdy/spdy_stream_spdy3_unittest.cc +++ b/net/spdy/spdy_stream_spdy3_unittest.cc @@ -5,6 +5,7 @@ #include "base/memory/ref_counted.h" #include "net/base/completion_callback.h" #include "net/base/net_log_unittest.h" +#include "net/spdy/buffered_spdy_framer.h" #include "net/spdy/spdy_stream.h" #include "net/spdy/spdy_http_utils.h" #include "net/spdy/spdy_session.h" @@ -92,7 +93,7 @@ class TestSpdyStreamDelegate : public SpdyStream::Delegate { }; spdy::SpdyFrame* ConstructSpdyBodyFrame(const char* data, int length) { - spdy::SpdyFramer framer; + spdy::BufferedSpdyFramer framer(3); return framer.CreateDataFrame(1, data, length, spdy::DATA_FLAG_NONE); } diff --git a/net/spdy/spdy_test_util_spdy2.cc b/net/spdy/spdy_test_util_spdy2.cc index 19f6c5e..aadd177 100644 --- a/net/spdy/spdy_test_util_spdy2.cc +++ b/net/spdy/spdy_test_util_spdy2.cc @@ -13,7 +13,7 @@ #include "net/http/http_network_session.h" #include "net/http/http_network_transaction.h" #include "net/http/http_server_properties_impl.h" -#include "net/spdy/spdy_framer.h" +#include "net/spdy/buffered_spdy_framer.h" #include "net/spdy/spdy_http_utils.h" namespace net { @@ -154,7 +154,7 @@ spdy::SpdyFrame* ConstructSpdyPacket(const SpdyHeaderInfo& header_info, int extra_header_count, const char* const tail[], int tail_header_count) { - spdy::SpdyFramer framer; + spdy::BufferedSpdyFramer framer(2); spdy::SpdyHeaderBlock headers; // Copy in the extra headers to our map. AppendHeadersToSpdyFrame(extra_headers, extra_header_count, &headers); @@ -194,7 +194,7 @@ spdy::SpdyFrame* ConstructSpdyPacket(const SpdyHeaderInfo& header_info, // Returns the constructed frame. The caller takes ownership of the frame. spdy::SpdyFrame* ConstructSpdySettings( const spdy::SpdySettings& settings) { - spdy::SpdyFramer framer; + spdy::BufferedSpdyFramer framer(2); return framer.CreateSettings(settings); } @@ -203,21 +203,21 @@ spdy::SpdyFrame* ConstructSpdySettings( // Returns the constructed frame. The caller takes ownership of the frame. spdy::SpdyFrame* ConstructSpdyCredential( const spdy::SpdyCredential& credential) { - spdy::SpdyFramer framer; + spdy::BufferedSpdyFramer framer(2); return framer.CreateCredentialFrame(credential); } // Construct a SPDY PING frame. // Returns the constructed frame. The caller takes ownership of the frame. spdy::SpdyFrame* ConstructSpdyPing() { - spdy::SpdyFramer framer; + spdy::BufferedSpdyFramer framer(2); return framer.CreatePingFrame(1); } // Construct a SPDY GOAWAY frame. // Returns the constructed frame. The caller takes ownership of the frame. spdy::SpdyFrame* ConstructSpdyGoAway() { - spdy::SpdyFramer framer; + spdy::BufferedSpdyFramer framer(2); return framer.CreateGoAway(0); } @@ -225,7 +225,7 @@ spdy::SpdyFrame* ConstructSpdyGoAway() { // Returns the constructed frame. The caller takes ownership of the frame. spdy::SpdyFrame* ConstructSpdyWindowUpdate( const spdy::SpdyStreamId stream_id, uint32 delta_window_size) { - spdy::SpdyFramer framer; + spdy::BufferedSpdyFramer framer(2); return framer.CreateWindowUpdate(stream_id, delta_window_size); } @@ -233,7 +233,7 @@ spdy::SpdyFrame* ConstructSpdyWindowUpdate( // Returns the constructed frame. The caller takes ownership of the frame. spdy::SpdyFrame* ConstructSpdyRstStream(spdy::SpdyStreamId stream_id, spdy::SpdyStatusCodes status) { - spdy::SpdyFramer framer; + spdy::BufferedSpdyFramer framer(2); return framer.CreateRstStream(stream_id, status); } @@ -750,7 +750,7 @@ spdy::SpdyFrame* ConstructSpdyPostSynReply(const char* const extra_headers[], // Constructs a single SPDY data frame with the default contents. spdy::SpdyFrame* ConstructSpdyBodyFrame(int stream_id, bool fin) { - spdy::SpdyFramer framer; + spdy::BufferedSpdyFramer framer(2); return framer.CreateDataFrame( stream_id, kUploadData, kUploadDataSize, fin ? spdy::DATA_FLAG_FIN : spdy::DATA_FLAG_NONE); @@ -759,7 +759,7 @@ spdy::SpdyFrame* ConstructSpdyBodyFrame(int stream_id, bool fin) { // Constructs a single SPDY data frame with the given content. spdy::SpdyFrame* ConstructSpdyBodyFrame(int stream_id, const char* data, uint32 len, bool fin) { - spdy::SpdyFramer framer; + spdy::BufferedSpdyFramer framer(2); return framer.CreateDataFrame( stream_id, data, len, fin ? spdy::DATA_FLAG_FIN : spdy::DATA_FLAG_NONE); } diff --git a/net/spdy/spdy_test_util_spdy2.h b/net/spdy/spdy_test_util_spdy2.h index 4d4f85c..f6b329f 100644 --- a/net/spdy/spdy_test_util_spdy2.h +++ b/net/spdy/spdy_test_util_spdy2.h @@ -21,7 +21,6 @@ #include "net/http/http_transaction_factory.h" #include "net/proxy/proxy_service.h" #include "net/socket/socket_test_util.h" -#include "net/spdy/spdy_framer.h" #include "net/url_request/url_request_context.h" #include "net/url_request/url_request_context_storage.h" diff --git a/net/spdy/spdy_test_util_spdy3.cc b/net/spdy/spdy_test_util_spdy3.cc index 6ef747e..25094c8 100644 --- a/net/spdy/spdy_test_util_spdy3.cc +++ b/net/spdy/spdy_test_util_spdy3.cc @@ -13,7 +13,7 @@ #include "net/http/http_network_session.h" #include "net/http/http_network_transaction.h" #include "net/http/http_server_properties_impl.h" -#include "net/spdy/spdy_framer.h" +#include "net/spdy/buffered_spdy_framer.h" #include "net/spdy/spdy_http_utils.h" namespace net { @@ -155,7 +155,7 @@ spdy::SpdyFrame* ConstructSpdyPacket(const SpdyHeaderInfo& header_info, int extra_header_count, const char* const tail[], int tail_header_count) { - spdy::SpdyFramer framer; + spdy::BufferedSpdyFramer framer(3); spdy::SpdyHeaderBlock headers; // Copy in the extra headers to our map. AppendHeadersToSpdyFrame(extra_headers, extra_header_count, &headers); @@ -195,7 +195,7 @@ spdy::SpdyFrame* ConstructSpdyPacket(const SpdyHeaderInfo& header_info, // Returns the constructed frame. The caller takes ownership of the frame. spdy::SpdyFrame* ConstructSpdySettings( const spdy::SpdySettings& settings) { - spdy::SpdyFramer framer; + spdy::BufferedSpdyFramer framer(3); return framer.CreateSettings(settings); } @@ -204,21 +204,21 @@ spdy::SpdyFrame* ConstructSpdySettings( // Returns the constructed frame. The caller takes ownership of the frame. spdy::SpdyFrame* ConstructSpdyCredential( const spdy::SpdyCredential& credential) { - spdy::SpdyFramer framer; + spdy::BufferedSpdyFramer framer(3); return framer.CreateCredentialFrame(credential); } // Construct a SPDY PING frame. // Returns the constructed frame. The caller takes ownership of the frame. spdy::SpdyFrame* ConstructSpdyPing() { - spdy::SpdyFramer framer; + spdy::BufferedSpdyFramer framer(3); return framer.CreatePingFrame(1); } // Construct a SPDY GOAWAY frame. // Returns the constructed frame. The caller takes ownership of the frame. spdy::SpdyFrame* ConstructSpdyGoAway() { - spdy::SpdyFramer framer; + spdy::BufferedSpdyFramer framer(3); return framer.CreateGoAway(0); } @@ -226,7 +226,7 @@ spdy::SpdyFrame* ConstructSpdyGoAway() { // Returns the constructed frame. The caller takes ownership of the frame. spdy::SpdyFrame* ConstructSpdyWindowUpdate( const spdy::SpdyStreamId stream_id, uint32 delta_window_size) { - spdy::SpdyFramer framer; + spdy::BufferedSpdyFramer framer(3); return framer.CreateWindowUpdate(stream_id, delta_window_size); } @@ -234,7 +234,7 @@ spdy::SpdyFrame* ConstructSpdyWindowUpdate( // Returns the constructed frame. The caller takes ownership of the frame. spdy::SpdyFrame* ConstructSpdyRstStream(spdy::SpdyStreamId stream_id, spdy::SpdyStatusCodes status) { - spdy::SpdyFramer framer; + spdy::BufferedSpdyFramer framer(3); return framer.CreateRstStream(stream_id, status); } @@ -751,7 +751,7 @@ spdy::SpdyFrame* ConstructSpdyPostSynReply(const char* const extra_headers[], // Constructs a single SPDY data frame with the default contents. spdy::SpdyFrame* ConstructSpdyBodyFrame(int stream_id, bool fin) { - spdy::SpdyFramer framer; + spdy::BufferedSpdyFramer framer(3); return framer.CreateDataFrame( stream_id, kUploadData, kUploadDataSize, fin ? spdy::DATA_FLAG_FIN : spdy::DATA_FLAG_NONE); @@ -760,7 +760,7 @@ spdy::SpdyFrame* ConstructSpdyBodyFrame(int stream_id, bool fin) { // Constructs a single SPDY data frame with the given content. spdy::SpdyFrame* ConstructSpdyBodyFrame(int stream_id, const char* data, uint32 len, bool fin) { - spdy::SpdyFramer framer; + spdy::BufferedSpdyFramer framer(3); return framer.CreateDataFrame( stream_id, data, len, fin ? spdy::DATA_FLAG_FIN : spdy::DATA_FLAG_NONE); } diff --git a/net/spdy/spdy_test_util_spdy3.h b/net/spdy/spdy_test_util_spdy3.h index 6cfebae..f0abdfa 100644 --- a/net/spdy/spdy_test_util_spdy3.h +++ b/net/spdy/spdy_test_util_spdy3.h @@ -21,7 +21,6 @@ #include "net/http/http_transaction_factory.h" #include "net/proxy/proxy_service.h" #include "net/socket/socket_test_util.h" -#include "net/spdy/spdy_framer.h" #include "net/url_request/url_request_context.h" #include "net/url_request/url_request_context_storage.h" diff --git a/net/spdy/spdy_websocket_test_util_spdy2.cc b/net/spdy/spdy_websocket_test_util_spdy2.cc index 2c31460..7deda4e 100644 --- a/net/spdy/spdy_websocket_test_util_spdy2.cc +++ b/net/spdy/spdy_websocket_test_util_spdy2.cc @@ -4,7 +4,7 @@ #include "net/spdy/spdy_websocket_test_util_spdy2.h" -#include "net/spdy/spdy_framer.h" +#include "net/spdy/buffered_spdy_framer.h" #include "net/spdy/spdy_http_utils.h" #include "net/spdy/spdy_test_util_spdy2.h" @@ -84,7 +84,7 @@ spdy::SpdyFrame* ConstructSpdyWebSocketDataFrame( bool fin) { // Construct SPDY data frame. - spdy::SpdyFramer framer; + spdy::BufferedSpdyFramer framer(2); return framer.CreateDataFrame( stream_id, data, diff --git a/net/spdy/spdy_websocket_test_util_spdy3.cc b/net/spdy/spdy_websocket_test_util_spdy3.cc index 3c3e570..555eece 100644 --- a/net/spdy/spdy_websocket_test_util_spdy3.cc +++ b/net/spdy/spdy_websocket_test_util_spdy3.cc @@ -4,7 +4,7 @@ #include "net/spdy/spdy_websocket_test_util_spdy3.h" -#include "net/spdy/spdy_framer.h" +#include "net/spdy/buffered_spdy_framer.h" #include "net/spdy/spdy_http_utils.h" #include "net/spdy/spdy_test_util_spdy3.h" @@ -84,7 +84,7 @@ spdy::SpdyFrame* ConstructSpdyWebSocketDataFrame( bool fin) { // Construct SPDY data frame. - spdy::SpdyFramer framer; + spdy::BufferedSpdyFramer framer(3); return framer.CreateDataFrame( stream_id, data, diff --git a/net/tools/flip_server/spdy_interface.cc b/net/tools/flip_server/spdy_interface.cc index ed62ff9..3ccc672 100644 --- a/net/tools/flip_server/spdy_interface.cc +++ b/net/tools/flip_server/spdy_interface.cc @@ -66,7 +66,7 @@ SpdySM::SpdySM(SMConnection* connection, MemoryCache* memory_cache, FlipAcceptor* acceptor) : seq_num_(0), - buffered_spdy_framer_(new BufferedSpdyFramer), + buffered_spdy_framer_(new BufferedSpdyFramer(2)), valid_spdy_session_(false), connection_(connection), client_output_list_(connection->output_list()), @@ -309,7 +309,7 @@ void SpdySM::ResetForNewInterface(int32 server_idx) { void SpdySM::ResetForNewConnection() { // seq_num is not cleared, intentionally. delete buffered_spdy_framer_; - buffered_spdy_framer_ = new BufferedSpdyFramer; + buffered_spdy_framer_ = new BufferedSpdyFramer(2); buffered_spdy_framer_->set_visitor(this); valid_spdy_session_ = false; client_output_ordering_.Reset(); -- cgit v1.1