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

Side by Side Diff: net/spdy/spdy_stream.h

Issue 10448083: Fix out of order SYN_STEAM frames. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add copy constructor to fix win build Created 8 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « net/spdy/spdy_session_spdy3_unittest.cc ('k') | net/spdy/spdy_stream.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef NET_SPDY_SPDY_STREAM_H_ 5 #ifndef NET_SPDY_SPDY_STREAM_H_
6 #define NET_SPDY_SPDY_STREAM_H_ 6 #define NET_SPDY_SPDY_STREAM_H_
7 #pragma once 7 #pragma once
8 8
9 #include <list>
9 #include <string> 10 #include <string>
10 #include <vector> 11 #include <vector>
11 12
12 #include "base/basictypes.h" 13 #include "base/basictypes.h"
13 #include "base/memory/linked_ptr.h" 14 #include "base/memory/linked_ptr.h"
14 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
15 #include "googleurl/src/gurl.h" 16 #include "googleurl/src/gurl.h"
16 #include "net/base/bandwidth_metrics.h" 17 #include "net/base/bandwidth_metrics.h"
17 #include "net/base/io_buffer.h" 18 #include "net/base/io_buffer.h"
18 #include "net/base/net_export.h" 19 #include "net/base/net_export.h"
19 #include "net/base/net_log.h" 20 #include "net/base/net_log.h"
20 #include "net/base/request_priority.h" 21 #include "net/base/request_priority.h"
21 #include "net/base/server_bound_cert_service.h" 22 #include "net/base/server_bound_cert_service.h"
22 #include "net/base/ssl_client_cert_type.h" 23 #include "net/base/ssl_client_cert_type.h"
23 #include "net/base/upload_data.h" 24 #include "net/base/upload_data.h"
24 #include "net/socket/ssl_client_socket.h" 25 #include "net/socket/ssl_client_socket.h"
25 #include "net/spdy/spdy_framer.h" 26 #include "net/spdy/spdy_framer.h"
26 #include "net/spdy/spdy_protocol.h" 27 #include "net/spdy/spdy_protocol.h"
28 #include "net/spdy/spdy_session.h"
27 29
28 namespace net { 30 namespace net {
29 31
30 class AddressList; 32 class AddressList;
31 class IPEndPoint; 33 class IPEndPoint;
32 class SpdySession;
33 class SSLCertRequestInfo; 34 class SSLCertRequestInfo;
34 class SSLInfo; 35 class SSLInfo;
35 36
36 // The SpdyStream is used by the SpdySession to represent each stream known 37 // The SpdyStream is used by the SpdySession to represent each stream known
37 // on the SpdySession. This class provides interfaces for SpdySession to use. 38 // on the SpdySession. This class provides interfaces for SpdySession to use.
38 // Streams can be created either by the client or by the server. When they 39 // Streams can be created either by the client or by the server. When they
39 // are initiated by the client, both the SpdySession and client object (such as 40 // are initiated by the client, both the SpdySession and client object (such as
40 // a SpdyNetworkTransaction) will maintain a reference to the stream. When 41 // a SpdyNetworkTransaction) will maintain a reference to the stream. When
41 // initiated by the server, only the SpdySession will maintain any reference, 42 // initiated by the server, only the SpdySession will maintain any reference,
42 // until such a time as a client object requests a stream for the path. 43 // until such a time as a client object requests a stream for the path.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 protected: 89 protected:
89 friend class base::RefCounted<Delegate>; 90 friend class base::RefCounted<Delegate>;
90 virtual ~Delegate() {} 91 virtual ~Delegate() {}
91 92
92 private: 93 private:
93 DISALLOW_COPY_AND_ASSIGN(Delegate); 94 DISALLOW_COPY_AND_ASSIGN(Delegate);
94 }; 95 };
95 96
96 // SpdyStream constructor 97 // SpdyStream constructor
97 SpdyStream(SpdySession* session, 98 SpdyStream(SpdySession* session,
98 SpdyStreamId stream_id,
99 bool pushed, 99 bool pushed,
100 const BoundNetLog& net_log); 100 const BoundNetLog& net_log);
101 101
102 // Set new |delegate|. |delegate| must not be NULL. 102 // Set new |delegate|. |delegate| must not be NULL.
103 // If it already received SYN_REPLY or data, OnResponseReceived() or 103 // If it already received SYN_REPLY or data, OnResponseReceived() or
104 // OnDataReceived() will be called. 104 // OnDataReceived() will be called.
105 void SetDelegate(Delegate* delegate); 105 void SetDelegate(Delegate* delegate);
106 Delegate* GetDelegate() { return delegate_; } 106 Delegate* GetDelegate() { return delegate_; }
107 107
108 // Detach delegate from the stream. It will cancel the stream if it was not 108 // Detach delegate from the stream. It will cancel the stream if it was not
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 // Get the URL associated with this stream. Only valid when has_url() is 253 // Get the URL associated with this stream. Only valid when has_url() is
254 // true. 254 // true.
255 GURL GetUrl() const; 255 GURL GetUrl() const;
256 256
257 // ChunkCallback methods. 257 // ChunkCallback methods.
258 virtual void OnChunkAvailable() OVERRIDE; 258 virtual void OnChunkAvailable() OVERRIDE;
259 259
260 int GetProtocolVersion() const; 260 int GetProtocolVersion() const;
261 261
262 private: 262 private:
263 class SpdyStreamIOBufferProducer;
264
263 enum State { 265 enum State {
264 STATE_NONE, 266 STATE_NONE,
265 STATE_GET_DOMAIN_BOUND_CERT, 267 STATE_GET_DOMAIN_BOUND_CERT,
266 STATE_GET_DOMAIN_BOUND_CERT_COMPLETE, 268 STATE_GET_DOMAIN_BOUND_CERT_COMPLETE,
267 STATE_SEND_DOMAIN_BOUND_CERT, 269 STATE_SEND_DOMAIN_BOUND_CERT,
268 STATE_SEND_DOMAIN_BOUND_CERT_COMPLETE, 270 STATE_SEND_DOMAIN_BOUND_CERT_COMPLETE,
269 STATE_SEND_HEADERS, 271 STATE_SEND_HEADERS,
270 STATE_SEND_HEADERS_COMPLETE, 272 STATE_SEND_HEADERS_COMPLETE,
271 STATE_SEND_BODY, 273 STATE_SEND_BODY,
272 STATE_SEND_BODY_COMPLETE, 274 STATE_SEND_BODY_COMPLETE,
(...skipping 28 matching lines...) Expand all
301 int DoOpen(int result); 303 int DoOpen(int result);
302 304
303 // Update the histograms. Can safely be called repeatedly, but should only 305 // Update the histograms. Can safely be called repeatedly, but should only
304 // be called after the stream has completed. 306 // be called after the stream has completed.
305 void UpdateHistograms(); 307 void UpdateHistograms();
306 308
307 // When a server pushed stream is first created, this function is posted on 309 // When a server pushed stream is first created, this function is posted on
308 // the MessageLoop to replay all the data that the server has already sent. 310 // the MessageLoop to replay all the data that the server has already sent.
309 void PushedStreamReplayData(); 311 void PushedStreamReplayData();
310 312
313 // Informs the SpdySession that this stream has a write available.
314 void SetHasWriteAvailable();
315
316 // Returns a newly created SPDY frame owned by the called that contains
317 // the next frame to be sent by this frame. May return NULL if this
318 // stream has become stalled on flow control.
319 SpdyFrame* ProduceNextFrame();
320
311 // There is a small period of time between when a server pushed stream is 321 // There is a small period of time between when a server pushed stream is
312 // first created, and the pushed data is replayed. Any data received during 322 // first created, and the pushed data is replayed. Any data received during
313 // this time should continue to be buffered. 323 // this time should continue to be buffered.
314 bool continue_buffering_data_; 324 bool continue_buffering_data_;
315 325
316 SpdyStreamId stream_id_; 326 SpdyStreamId stream_id_;
317 std::string path_; 327 std::string path_;
318 RequestPriority priority_; 328 RequestPriority priority_;
319 size_t slot_; 329 size_t slot_;
320 330
(...skipping 15 matching lines...) Expand all
336 // The request to send. 346 // The request to send.
337 linked_ptr<SpdyHeaderBlock> request_; 347 linked_ptr<SpdyHeaderBlock> request_;
338 348
339 // The time at which the request was made that resulted in this response. 349 // The time at which the request was made that resulted in this response.
340 // For cached responses, this time could be "far" in the past. 350 // For cached responses, this time could be "far" in the past.
341 base::Time request_time_; 351 base::Time request_time_;
342 352
343 linked_ptr<SpdyHeaderBlock> response_; 353 linked_ptr<SpdyHeaderBlock> response_;
344 base::Time response_time_; 354 base::Time response_time_;
345 355
356 std::list<SpdyFrame*> pending_data_frames_;
357
346 State io_state_; 358 State io_state_;
347 359
348 // Since we buffer the response, we also buffer the response status. 360 // Since we buffer the response, we also buffer the response status.
349 // Not valid until the stream is closed. 361 // Not valid until the stream is closed.
350 int response_status_; 362 int response_status_;
351 363
352 bool cancelled_; 364 bool cancelled_;
353 bool has_upload_data_; 365 bool has_upload_data_;
354 366
355 BoundNetLog net_log_; 367 BoundNetLog net_log_;
(...skipping 10 matching lines...) Expand all
366 std::string domain_bound_private_key_; 378 std::string domain_bound_private_key_;
367 std::string domain_bound_cert_; 379 std::string domain_bound_cert_;
368 ServerBoundCertService::RequestHandle domain_bound_cert_request_handle_; 380 ServerBoundCertService::RequestHandle domain_bound_cert_request_handle_;
369 381
370 DISALLOW_COPY_AND_ASSIGN(SpdyStream); 382 DISALLOW_COPY_AND_ASSIGN(SpdyStream);
371 }; 383 };
372 384
373 } // namespace net 385 } // namespace net
374 386
375 #endif // NET_SPDY_SPDY_STREAM_H_ 387 #endif // NET_SPDY_SPDY_STREAM_H_
OLDNEW
« no previous file with comments | « net/spdy/spdy_session_spdy3_unittest.cc ('k') | net/spdy/spdy_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698