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

Side by Side Diff: net/quic/quic_headers_stream.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 unified diff | Download patch
« no previous file with comments | « net/quic/quic_headers_stream.h ('k') | net/quic/quic_headers_stream_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/quic/quic_headers_stream.h" 5 #include "net/quic/quic_headers_stream.h"
6 6
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "net/quic/quic_session.h" 8 #include "net/quic/quic_spdy_session.h"
9 9
10 using base::StringPiece; 10 using base::StringPiece;
11 using std::string; 11 using std::string;
12 12
13 namespace net { 13 namespace net {
14 14
15 namespace { 15 namespace {
16 16
17 const QuicStreamId kInvalidStreamId = 0; 17 const QuicStreamId kInvalidStreamId = 0;
18 18
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 } 162 }
163 } 163 }
164 164
165 private: 165 private:
166 SpdyMajorVersion spdy_version_; 166 SpdyMajorVersion spdy_version_;
167 QuicHeadersStream* stream_; 167 QuicHeadersStream* stream_;
168 168
169 DISALLOW_COPY_AND_ASSIGN(SpdyFramerVisitor); 169 DISALLOW_COPY_AND_ASSIGN(SpdyFramerVisitor);
170 }; 170 };
171 171
172 QuicHeadersStream::QuicHeadersStream(QuicSession* session) 172 QuicHeadersStream::QuicHeadersStream(QuicSpdySession* session)
173 : ReliableQuicStream(kHeadersStreamId, session), 173 : ReliableQuicStream(kHeadersStreamId, session),
174 spdy_session_(session),
174 stream_id_(kInvalidStreamId), 175 stream_id_(kInvalidStreamId),
175 fin_(false), 176 fin_(false),
176 frame_len_(0), 177 frame_len_(0),
177 spdy_framer_(SPDY4), 178 spdy_framer_(SPDY4),
178 spdy_framer_visitor_(new SpdyFramerVisitor(SPDY4, this)) { 179 spdy_framer_visitor_(new SpdyFramerVisitor(SPDY4, this)) {
179 spdy_framer_.set_visitor(spdy_framer_visitor_.get()); 180 spdy_framer_.set_visitor(spdy_framer_visitor_.get());
180 spdy_framer_.set_debug_visitor(spdy_framer_visitor_.get()); 181 spdy_framer_.set_debug_visitor(spdy_framer_visitor_.get());
181 // The headers stream is exempt from connection level flow control. 182 // The headers stream is exempt from connection level flow control.
182 DisableConnectionFlowControlForThisStream(); 183 DisableConnectionFlowControlForThisStream();
183 } 184 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 bool fin) { 217 bool fin) {
217 if (session()->perspective() == Perspective::IS_CLIENT) { 218 if (session()->perspective() == Perspective::IS_CLIENT) {
218 CloseConnectionWithDetails( 219 CloseConnectionWithDetails(
219 QUIC_INVALID_HEADERS_STREAM_DATA, 220 QUIC_INVALID_HEADERS_STREAM_DATA,
220 "SPDY SYN_STREAM frame received at the client"); 221 "SPDY SYN_STREAM frame received at the client");
221 return; 222 return;
222 } 223 }
223 DCHECK_EQ(kInvalidStreamId, stream_id_); 224 DCHECK_EQ(kInvalidStreamId, stream_id_);
224 stream_id_ = stream_id; 225 stream_id_ = stream_id;
225 fin_ = fin; 226 fin_ = fin;
226 session()->OnStreamHeadersPriority(stream_id, priority); 227 spdy_session_->OnStreamHeadersPriority(stream_id, priority);
227 } 228 }
228 229
229 void QuicHeadersStream::OnSynReply(SpdyStreamId stream_id, bool fin) { 230 void QuicHeadersStream::OnSynReply(SpdyStreamId stream_id, bool fin) {
230 if (session()->perspective() == Perspective::IS_SERVER) { 231 if (session()->perspective() == Perspective::IS_SERVER) {
231 CloseConnectionWithDetails( 232 CloseConnectionWithDetails(
232 QUIC_INVALID_HEADERS_STREAM_DATA, 233 QUIC_INVALID_HEADERS_STREAM_DATA,
233 "SPDY SYN_REPLY frame received at the server"); 234 "SPDY SYN_REPLY frame received at the server");
234 return; 235 return;
235 } 236 }
236 DCHECK_EQ(kInvalidStreamId, stream_id_); 237 DCHECK_EQ(kInvalidStreamId, stream_id_);
237 stream_id_ = stream_id; 238 stream_id_ = stream_id;
238 fin_ = fin; 239 fin_ = fin;
239 } 240 }
240 241
241 void QuicHeadersStream::OnControlFrameHeaderData(SpdyStreamId stream_id, 242 void QuicHeadersStream::OnControlFrameHeaderData(SpdyStreamId stream_id,
242 const char* header_data, 243 const char* header_data,
243 size_t len) { 244 size_t len) {
244 DCHECK_EQ(stream_id_, stream_id); 245 DCHECK_EQ(stream_id_, stream_id);
245 if (len == 0) { 246 if (len == 0) {
246 DCHECK_NE(0u, stream_id_); 247 DCHECK_NE(0u, stream_id_);
247 DCHECK_NE(0u, frame_len_); 248 DCHECK_NE(0u, frame_len_);
248 session()->OnStreamHeadersComplete(stream_id_, fin_, frame_len_); 249 spdy_session_->OnStreamHeadersComplete(stream_id_, fin_, frame_len_);
249 // Reset state for the next frame. 250 // Reset state for the next frame.
250 stream_id_ = kInvalidStreamId; 251 stream_id_ = kInvalidStreamId;
251 fin_ = false; 252 fin_ = false;
252 frame_len_ = 0; 253 frame_len_ = 0;
253 } else { 254 } else {
254 session()->OnStreamHeaders(stream_id_, StringPiece(header_data, len)); 255 spdy_session_->OnStreamHeaders(stream_id_, StringPiece(header_data, len));
255 } 256 }
256 } 257 }
257 258
258 void QuicHeadersStream::OnCompressedFrameSize(size_t frame_len) { 259 void QuicHeadersStream::OnCompressedFrameSize(size_t frame_len) {
259 frame_len_ += frame_len; 260 frame_len_ += frame_len;
260 } 261 }
261 262
262 bool QuicHeadersStream::IsConnected() { 263 bool QuicHeadersStream::IsConnected() {
263 return session()->connection()->connected(); 264 return session()->connection()->connected();
264 } 265 }
265 266
266 } // namespace net 267 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_headers_stream.h ('k') | net/quic/quic_headers_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698