Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(721)

Unified Diff: net/spdy/spdy_session.cc

Issue 357513003: Stop using SpdySynStreamIR for SPDY 4. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: WebSocket test fix. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/spdy/spdy_proxy_client_socket_unittest.cc ('k') | net/spdy/spdy_test_util_common.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/spdy_session.cc
diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc
index 7561145917e92b16a88dc23e8ab24fb0d03f10d8..9d837211f452b9f38ffdc33a7d948fda8e6b9e14 100644
--- a/net/spdy/spdy_session.cc
+++ b/net/spdy/spdy_session.cc
@@ -981,7 +981,7 @@ scoped_ptr<SpdyFrame> SpdySession::CreateSynStream(
SpdyStreamId stream_id,
RequestPriority priority,
SpdyControlFlags flags,
- const SpdyHeaderBlock& headers) {
+ const SpdyHeaderBlock& block) {
ActiveStreamMap::const_iterator it = active_streams_.find(stream_id);
CHECK(it != active_streams_.end());
CHECK_EQ(it->second.stream->stream_id(), stream_id);
@@ -991,22 +991,38 @@ scoped_ptr<SpdyFrame> SpdySession::CreateSynStream(
DCHECK(buffered_spdy_framer_.get());
SpdyPriority spdy_priority =
ConvertRequestPriorityToSpdyPriority(priority, GetProtocolVersion());
- scoped_ptr<SpdyFrame> syn_frame(
- buffered_spdy_framer_->CreateSynStream(stream_id, 0, spdy_priority, flags,
- &headers));
+
+ scoped_ptr<SpdyFrame> syn_frame;
+ // TODO(hkhalil): Avoid copy of |block|.
+ if (GetProtocolVersion() <= SPDY3) {
+ SpdySynStreamIR syn_stream(stream_id);
+ syn_stream.set_associated_to_stream_id(0);
+ syn_stream.set_priority(spdy_priority);
+ syn_stream.set_fin((flags & CONTROL_FLAG_FIN) != 0);
+ syn_stream.set_unidirectional((flags & CONTROL_FLAG_UNIDIRECTIONAL) != 0);
+ syn_stream.set_name_value_block(block);
+ syn_frame.reset(buffered_spdy_framer_->SerializeFrame(syn_stream));
+ } else {
+ SpdyHeadersIR headers(stream_id);
+ headers.set_priority(spdy_priority);
+ headers.set_has_priority(true);
+ headers.set_fin((flags & CONTROL_FLAG_FIN) != 0);
+ headers.set_name_value_block(block);
+ syn_frame.reset(buffered_spdy_framer_->SerializeFrame(headers));
+ }
base::StatsCounter spdy_requests("spdy.requests");
spdy_requests.Increment();
streams_initiated_count_++;
if (net_log().IsLogging()) {
- net_log().AddEvent(
- NetLog::TYPE_SPDY_SESSION_SYN_STREAM,
- base::Bind(&NetLogSpdySynStreamSentCallback, &headers,
- (flags & CONTROL_FLAG_FIN) != 0,
- (flags & CONTROL_FLAG_UNIDIRECTIONAL) != 0,
- spdy_priority,
- stream_id));
+ net_log().AddEvent(NetLog::TYPE_SPDY_SESSION_SYN_STREAM,
+ base::Bind(&NetLogSpdySynStreamSentCallback,
+ &block,
+ (flags & CONTROL_FLAG_FIN) != 0,
+ (flags & CONTROL_FLAG_UNIDIRECTIONAL) != 0,
+ spdy_priority,
+ stream_id));
}
return syn_frame.Pass();
« no previous file with comments | « net/spdy/spdy_proxy_client_socket_unittest.cc ('k') | net/spdy/spdy_test_util_common.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698