Chromium Code Reviews| OLD | NEW |
|---|---|
| 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_frame_producer.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; | 34 class SpdySession; |
| 33 class SSLCertRequestInfo; | 35 class SSLCertRequestInfo; |
| 34 class SSLInfo; | 36 class SSLInfo; |
| 35 | 37 |
| 36 // The SpdyStream is used by the SpdySession to represent each stream known | 38 // The SpdyStream is used by the SpdySession to represent each stream known |
| 37 // on the SpdySession. This class provides interfaces for SpdySession to use. | 39 // 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 | 40 // 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 | 41 // are initiated by the client, both the SpdySession and client object (such as |
| 40 // a SpdyNetworkTransaction) will maintain a reference to the stream. When | 42 // a SpdyNetworkTransaction) will maintain a reference to the stream. When |
| 41 // initiated by the server, only the SpdySession will maintain any reference, | 43 // 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. | 44 // until such a time as a client object requests a stream for the path. |
| 43 class NET_EXPORT_PRIVATE SpdyStream | 45 class NET_EXPORT_PRIVATE SpdyStream |
|
Ryan Hamilton
2012/06/21 18:14:58
Add a factory method to return a new SpdyFrameProd
Ryan Hamilton
2012/06/21 18:14:58
Add private nested adpater class here. fwd declar
| |
| 44 : public base::RefCounted<SpdyStream>, | 46 : public base::RefCounted<SpdyStream>, |
| 47 public SpdyFrameProducer, | |
| 45 public ChunkCallback { | 48 public ChunkCallback { |
| 46 public: | 49 public: |
| 47 // Delegate handles protocol specific behavior of spdy stream. | 50 // Delegate handles protocol specific behavior of spdy stream. |
| 48 class NET_EXPORT_PRIVATE Delegate { | 51 class NET_EXPORT_PRIVATE Delegate { |
| 49 public: | 52 public: |
| 50 Delegate() {} | 53 Delegate() {} |
| 51 | 54 |
| 52 // Called when SYN frame has been sent. | 55 // Called when SYN frame has been sent. |
| 53 // Returns true if no more data to be sent after SYN frame. | 56 // Returns true if no more data to be sent after SYN frame. |
| 54 virtual bool OnSendHeadersComplete(int status) = 0; | 57 virtual bool OnSendHeadersComplete(int status) = 0; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 88 protected: | 91 protected: |
| 89 friend class base::RefCounted<Delegate>; | 92 friend class base::RefCounted<Delegate>; |
| 90 virtual ~Delegate() {} | 93 virtual ~Delegate() {} |
| 91 | 94 |
| 92 private: | 95 private: |
| 93 DISALLOW_COPY_AND_ASSIGN(Delegate); | 96 DISALLOW_COPY_AND_ASSIGN(Delegate); |
| 94 }; | 97 }; |
| 95 | 98 |
| 96 // SpdyStream constructor | 99 // SpdyStream constructor |
| 97 SpdyStream(SpdySession* session, | 100 SpdyStream(SpdySession* session, |
| 98 SpdyStreamId stream_id, | |
| 99 bool pushed, | 101 bool pushed, |
| 100 const BoundNetLog& net_log); | 102 const BoundNetLog& net_log); |
| 101 | 103 |
| 104 // SpdyFrameProducer | |
| 105 virtual RequestPriority GetPriority() const OVERRIDE; | |
| 106 virtual SpdyFrame* ProduceNextFrame() OVERRIDE; | |
| 107 virtual SpdyStream* GetSpdyStream() const OVERRIDE; | |
| 108 | |
| 102 // Set new |delegate|. |delegate| must not be NULL. | 109 // Set new |delegate|. |delegate| must not be NULL. |
| 103 // If it already received SYN_REPLY or data, OnResponseReceived() or | 110 // If it already received SYN_REPLY or data, OnResponseReceived() or |
| 104 // OnDataReceived() will be called. | 111 // OnDataReceived() will be called. |
| 105 void SetDelegate(Delegate* delegate); | 112 void SetDelegate(Delegate* delegate); |
| 106 Delegate* GetDelegate() { return delegate_; } | 113 Delegate* GetDelegate() { return delegate_; } |
| 107 | 114 |
| 108 // Detach delegate from the stream. It will cancel the stream if it was not | 115 // Detach delegate from the stream. It will cancel the stream if it was not |
| 109 // cancelled yet. It is safe to call multiple times. | 116 // cancelled yet. It is safe to call multiple times. |
| 110 void DetachDelegate(); | 117 void DetachDelegate(); |
| 111 | 118 |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 336 // The request to send. | 343 // The request to send. |
| 337 linked_ptr<SpdyHeaderBlock> request_; | 344 linked_ptr<SpdyHeaderBlock> request_; |
| 338 | 345 |
| 339 // The time at which the request was made that resulted in this response. | 346 // 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. | 347 // For cached responses, this time could be "far" in the past. |
| 341 base::Time request_time_; | 348 base::Time request_time_; |
| 342 | 349 |
| 343 linked_ptr<SpdyHeaderBlock> response_; | 350 linked_ptr<SpdyHeaderBlock> response_; |
| 344 base::Time response_time_; | 351 base::Time response_time_; |
| 345 | 352 |
| 353 std::list<SpdyFrame*> pending_data_frames_; | |
| 354 | |
| 346 State io_state_; | 355 State io_state_; |
| 347 | 356 |
| 348 // Since we buffer the response, we also buffer the response status. | 357 // Since we buffer the response, we also buffer the response status. |
| 349 // Not valid until the stream is closed. | 358 // Not valid until the stream is closed. |
| 350 int response_status_; | 359 int response_status_; |
| 351 | 360 |
| 352 bool cancelled_; | 361 bool cancelled_; |
| 353 bool has_upload_data_; | 362 bool has_upload_data_; |
| 354 | 363 |
| 355 BoundNetLog net_log_; | 364 BoundNetLog net_log_; |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 385 const SpdyStreamId stream_id_; | 394 const SpdyStreamId stream_id_; |
| 386 const int status_; | 395 const int status_; |
| 387 const std::string description_; | 396 const std::string description_; |
| 388 | 397 |
| 389 DISALLOW_COPY_AND_ASSIGN(NetLogSpdyStreamErrorParameter); | 398 DISALLOW_COPY_AND_ASSIGN(NetLogSpdyStreamErrorParameter); |
| 390 }; | 399 }; |
| 391 | 400 |
| 392 } // namespace net | 401 } // namespace net |
| 393 | 402 |
| 394 #endif // NET_SPDY_SPDY_STREAM_H_ | 403 #endif // NET_SPDY_SPDY_STREAM_H_ |
| OLD | NEW |