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 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 64 // Called when the SYN_STREAM, SYN_REPLY, or HEADERS frames are received. | 64 // Called when the SYN_STREAM, SYN_REPLY, or HEADERS frames are received. |
| 65 // Normal streams will receive a SYN_REPLY and optional HEADERS frames. | 65 // Normal streams will receive a SYN_REPLY and optional HEADERS frames. |
| 66 // Pushed streams will receive a SYN_STREAM and optional HEADERS frames. | 66 // Pushed streams will receive a SYN_STREAM and optional HEADERS frames. |
| 67 // Because a stream may have a SYN_* frame and multiple HEADERS frames, | 67 // Because a stream may have a SYN_* frame and multiple HEADERS frames, |
| 68 // this callback may be called multiple times. | 68 // this callback may be called multiple times. |
| 69 // |status| indicates network error. Returns network error code. | 69 // |status| indicates network error. Returns network error code. |
| 70 virtual int OnResponseReceived(const SpdyHeaderBlock& response, | 70 virtual int OnResponseReceived(const SpdyHeaderBlock& response, |
| 71 base::Time response_time, | 71 base::Time response_time, |
| 72 int status) = 0; | 72 int status) = 0; |
| 73 | 73 |
| 74 // Called when a HEADERS frame is sent. | |
| 75 virtual void OnHeadersSent() = 0; | |
| 76 | |
| 74 // Called when data is received. | 77 // Called when data is received. |
| 75 virtual void OnDataReceived(const char* data, int length) = 0; | 78 virtual void OnDataReceived(const char* data, int length) = 0; |
| 76 | 79 |
| 77 // Called when data is sent. | 80 // Called when data is sent. |
| 78 virtual void OnDataSent(int length) = 0; | 81 virtual void OnDataSent(int length) = 0; |
| 79 | 82 |
| 80 // Called when SpdyStream is closed. | 83 // Called when SpdyStream is closed. |
| 81 virtual void OnClose(int status) = 0; | 84 virtual void OnClose(int status) = 0; |
| 82 | 85 |
| 83 protected: | 86 protected: |
| 84 friend class base::RefCounted<Delegate>; | 87 friend class base::RefCounted<Delegate>; |
| 85 virtual ~Delegate() {} | 88 virtual ~Delegate() {} |
| 86 | 89 |
| 87 private: | 90 private: |
| 88 DISALLOW_COPY_AND_ASSIGN(Delegate); | 91 DISALLOW_COPY_AND_ASSIGN(Delegate); |
| 89 }; | 92 }; |
| 90 | 93 |
| 91 // Indicates pending frame type. | 94 // Indicates pending frame type. |
| 92 enum PendingFrameType { | 95 enum FrameType { |
| 93 TYPE_HEADER, | 96 TYPE_HEADERS, |
| 94 TYPE_DATA | 97 TYPE_DATA |
| 95 }; | 98 }; |
| 96 | 99 |
| 97 // Structure to contains pending frame information. | 100 // Structure to contains pending frame information. |
| 98 typedef struct { | 101 typedef struct { |
| 99 PendingFrameType type; | 102 FrameType type; |
| 100 union { | 103 union { |
| 101 SpdyHeaderBlock* header_block; | 104 SpdyHeaderBlock* header_block; |
| 102 SpdyDataFrame* data_frame; | 105 SpdyDataFrame* data_frame; |
| 103 }; | 106 }; |
| 104 } PendingFrame; | 107 } PendingFrame; |
| 105 | 108 |
| 106 // SpdyStream constructor | 109 // SpdyStream constructor |
| 107 SpdyStream(SpdySession* session, | 110 SpdyStream(SpdySession* session, |
| 108 bool pushed, | 111 bool pushed, |
| 109 const BoundNetLog& net_log); | 112 const BoundNetLog& net_log); |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 359 | 362 |
| 360 // The time at which the request was made that resulted in this response. | 363 // The time at which the request was made that resulted in this response. |
| 361 // For cached responses, this time could be "far" in the past. | 364 // For cached responses, this time could be "far" in the past. |
| 362 base::Time request_time_; | 365 base::Time request_time_; |
| 363 | 366 |
| 364 scoped_ptr<SpdyHeaderBlock> response_; | 367 scoped_ptr<SpdyHeaderBlock> response_; |
| 365 base::Time response_time_; | 368 base::Time response_time_; |
| 366 | 369 |
| 367 std::list<PendingFrame> pending_frames_; | 370 std::list<PendingFrame> pending_frames_; |
| 368 | 371 |
| 372 std::list<FrameType> waiting_completions_; | |
|
Ryan Hamilton
2012/08/13 17:10:02
nit: Please add a comment that describes the diffe
Takashi Toyoshima
2012/08/14 09:14:02
Done.
| |
| 373 | |
| 369 State io_state_; | 374 State io_state_; |
| 370 | 375 |
| 371 // Since we buffer the response, we also buffer the response status. | 376 // Since we buffer the response, we also buffer the response status. |
| 372 // Not valid until the stream is closed. | 377 // Not valid until the stream is closed. |
| 373 int response_status_; | 378 int response_status_; |
| 374 | 379 |
| 375 bool cancelled_; | 380 bool cancelled_; |
| 376 bool has_upload_data_; | 381 bool has_upload_data_; |
| 377 | 382 |
| 378 BoundNetLog net_log_; | 383 BoundNetLog net_log_; |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 389 std::string domain_bound_private_key_; | 394 std::string domain_bound_private_key_; |
| 390 std::string domain_bound_cert_; | 395 std::string domain_bound_cert_; |
| 391 ServerBoundCertService::RequestHandle domain_bound_cert_request_handle_; | 396 ServerBoundCertService::RequestHandle domain_bound_cert_request_handle_; |
| 392 | 397 |
| 393 DISALLOW_COPY_AND_ASSIGN(SpdyStream); | 398 DISALLOW_COPY_AND_ASSIGN(SpdyStream); |
| 394 }; | 399 }; |
| 395 | 400 |
| 396 } // namespace net | 401 } // namespace net |
| 397 | 402 |
| 398 #endif // NET_SPDY_SPDY_STREAM_H_ | 403 #endif // NET_SPDY_SPDY_STREAM_H_ |
| OLD | NEW |