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

Unified Diff: net/quic/quic_spdy_session.cc

Issue 1190823003: Remove dependency on headers stream from QuicSession. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Final_0616
Patch Set: deleted an include Created 5 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/quic/quic_spdy_session.h ('k') | net/quic/quic_stream_sequencer_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_spdy_session.cc
diff --git a/net/quic/quic_spdy_session.cc b/net/quic/quic_spdy_session.cc
new file mode 100644
index 0000000000000000000000000000000000000000..0a8dda6929e139c0c6542f580b91c6d254095d39
--- /dev/null
+++ b/net/quic/quic_spdy_session.cc
@@ -0,0 +1,80 @@
+// Copyright (c) 2015 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/quic/quic_spdy_session.h"
+
+#include "net/quic/quic_headers_stream.h"
+
+namespace net {
+
+QuicSpdySession::QuicSpdySession(QuicConnection* connection,
+ const QuicConfig& config)
+ : QuicSession(connection, config) {
+}
+
+QuicSpdySession::~QuicSpdySession() {
+}
+
+void QuicSpdySession::Initialize() {
+ QuicSession::Initialize();
+
+ if (perspective() == Perspective::IS_SERVER) {
+ set_largest_peer_created_stream_id(kHeadersStreamId);
+ } else {
+ QuicStreamId headers_stream_id = GetNextStreamId();
+ DCHECK_EQ(headers_stream_id, kHeadersStreamId);
+ }
+
+ headers_stream_.reset(new QuicHeadersStream(this));
+ DCHECK_EQ(kHeadersStreamId, headers_stream_->id());
+ static_streams()[kHeadersStreamId] = headers_stream_.get();
+}
+
+void QuicSpdySession::OnStreamHeaders(QuicStreamId stream_id,
+ StringPiece headers_data) {
+ QuicDataStream* stream = GetSpdyDataStream(stream_id);
+ if (!stream) {
+ // It's quite possible to receive headers after a stream has been reset.
+ return;
+ }
+ stream->OnStreamHeaders(headers_data);
+}
+
+void QuicSpdySession::OnStreamHeadersPriority(QuicStreamId stream_id,
+ QuicPriority priority) {
+ QuicDataStream* stream = GetSpdyDataStream(stream_id);
+ if (!stream) {
+ // It's quite possible to receive headers after a stream has been reset.
+ return;
+ }
+ stream->OnStreamHeadersPriority(priority);
+}
+
+void QuicSpdySession::OnStreamHeadersComplete(QuicStreamId stream_id,
+ bool fin,
+ size_t frame_len) {
+ QuicDataStream* stream = GetSpdyDataStream(stream_id);
+ if (!stream) {
+ // It's quite possible to receive headers after a stream has been reset.
+ return;
+ }
+ stream->OnStreamHeadersComplete(fin, frame_len);
+}
+
+size_t QuicSpdySession::WriteHeaders(
+ QuicStreamId id,
+ const SpdyHeaderBlock& headers,
+ bool fin,
+ QuicPriority priority,
+ QuicAckNotifier::DelegateInterface* ack_notifier_delegate) {
+ return headers_stream_->WriteHeaders(id, headers, fin, priority,
+ ack_notifier_delegate);
+}
+
+QuicDataStream* QuicSpdySession::GetSpdyDataStream(
+ const QuicStreamId stream_id) {
+ return static_cast<QuicDataStream*>(GetDynamicStream(stream_id));
+}
+
+} // namespace net
« no previous file with comments | « net/quic/quic_spdy_session.h ('k') | net/quic/quic_stream_sequencer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698