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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 81 virtual void OnClose(int status) = 0; | 81 virtual void OnClose(int status) = 0; |
| 82 | 82 |
| 83 protected: | 83 protected: |
| 84 friend class base::RefCounted<Delegate>; | 84 friend class base::RefCounted<Delegate>; |
| 85 virtual ~Delegate() {} | 85 virtual ~Delegate() {} |
| 86 | 86 |
| 87 private: | 87 private: |
| 88 DISALLOW_COPY_AND_ASSIGN(Delegate); | 88 DISALLOW_COPY_AND_ASSIGN(Delegate); |
| 89 }; | 89 }; |
| 90 | 90 |
| 91 typedef std::pair<SpdyHeaderBlock*, SpdyDataFrame*> PendingFrame; | |
|
Ryan Hamilton
2012/07/31 15:46:24
Instead of storing a pair of pointers, how about s
Takashi Toyoshima
2012/08/01 13:40:00
Thanks.
That's nice. I can remove complicated DCHE
| |
| 92 | |
| 91 // SpdyStream constructor | 93 // SpdyStream constructor |
| 92 SpdyStream(SpdySession* session, | 94 SpdyStream(SpdySession* session, |
| 93 bool pushed, | 95 bool pushed, |
| 94 const BoundNetLog& net_log); | 96 const BoundNetLog& net_log); |
| 95 | 97 |
| 96 // Set new |delegate|. |delegate| must not be NULL. | 98 // Set new |delegate|. |delegate| must not be NULL. |
| 97 // If it already received SYN_REPLY or data, OnResponseReceived() or | 99 // If it already received SYN_REPLY or data, OnResponseReceived() or |
| 98 // OnDataReceived() will be called. | 100 // OnDataReceived() will be called. |
| 99 void SetDelegate(Delegate* delegate); | 101 void SetDelegate(Delegate* delegate); |
| 100 Delegate* GetDelegate() { return delegate_; } | 102 Delegate* GetDelegate() { return delegate_; } |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 215 // TODO(satorux): This is only for testing. We should be able to remove | 217 // TODO(satorux): This is only for testing. We should be able to remove |
| 216 // this once crbug.com/113107 is addressed. | 218 // this once crbug.com/113107 is addressed. |
| 217 bool body_sent() const { return io_state_ > STATE_SEND_BODY_COMPLETE; } | 219 bool body_sent() const { return io_state_ > STATE_SEND_BODY_COMPLETE; } |
| 218 | 220 |
| 219 // Interface for Spdy[Http|WebSocket]Stream to use. | 221 // Interface for Spdy[Http|WebSocket]Stream to use. |
| 220 | 222 |
| 221 // Sends the request. | 223 // Sends the request. |
| 222 // For non push stream, it will send SYN_STREAM frame. | 224 // For non push stream, it will send SYN_STREAM frame. |
| 223 int SendRequest(bool has_upload_data); | 225 int SendRequest(bool has_upload_data); |
| 224 | 226 |
| 227 // Sends a HEADERS frame. SpdyStream owns |headers| and will release it after | |
| 228 // the HEADERS frame is actually sent. | |
| 229 int WriteHeaders(SpdyHeaderBlock* headers); | |
| 230 | |
| 225 // Sends DATA frame. | 231 // Sends DATA frame. |
| 226 int WriteStreamData(IOBuffer* data, int length, | 232 int WriteStreamData(IOBuffer* data, int length, |
| 227 SpdyDataFlags flags); | 233 SpdyDataFlags flags); |
| 228 | 234 |
| 229 // Fills SSL info in |ssl_info| and returns true when SSL is in use. | 235 // Fills SSL info in |ssl_info| and returns true when SSL is in use. |
| 230 bool GetSSLInfo(SSLInfo* ssl_info, | 236 bool GetSSLInfo(SSLInfo* ssl_info, |
| 231 bool* was_npn_negotiated, | 237 bool* was_npn_negotiated, |
| 232 NextProto* protocol_negotiated); | 238 NextProto* protocol_negotiated); |
| 233 | 239 |
| 234 // Fills SSL Certificate Request info |cert_request_info| and returns | 240 // Fills SSL Certificate Request info |cert_request_info| and returns |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 338 // The request to send. | 344 // The request to send. |
| 339 scoped_ptr<SpdyHeaderBlock> request_; | 345 scoped_ptr<SpdyHeaderBlock> request_; |
| 340 | 346 |
| 341 // The time at which the request was made that resulted in this response. | 347 // The time at which the request was made that resulted in this response. |
| 342 // For cached responses, this time could be "far" in the past. | 348 // For cached responses, this time could be "far" in the past. |
| 343 base::Time request_time_; | 349 base::Time request_time_; |
| 344 | 350 |
| 345 scoped_ptr<SpdyHeaderBlock> response_; | 351 scoped_ptr<SpdyHeaderBlock> response_; |
| 346 base::Time response_time_; | 352 base::Time response_time_; |
| 347 | 353 |
| 348 std::list<SpdyFrame*> pending_data_frames_; | 354 std::list<PendingFrame> pending_data_frames_; |
| 349 | 355 |
| 350 State io_state_; | 356 State io_state_; |
| 351 | 357 |
| 352 // Since we buffer the response, we also buffer the response status. | 358 // Since we buffer the response, we also buffer the response status. |
| 353 // Not valid until the stream is closed. | 359 // Not valid until the stream is closed. |
| 354 int response_status_; | 360 int response_status_; |
| 355 | 361 |
| 356 bool cancelled_; | 362 bool cancelled_; |
| 357 bool has_upload_data_; | 363 bool has_upload_data_; |
| 358 | 364 |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 370 std::string domain_bound_private_key_; | 376 std::string domain_bound_private_key_; |
| 371 std::string domain_bound_cert_; | 377 std::string domain_bound_cert_; |
| 372 ServerBoundCertService::RequestHandle domain_bound_cert_request_handle_; | 378 ServerBoundCertService::RequestHandle domain_bound_cert_request_handle_; |
| 373 | 379 |
| 374 DISALLOW_COPY_AND_ASSIGN(SpdyStream); | 380 DISALLOW_COPY_AND_ASSIGN(SpdyStream); |
| 375 }; | 381 }; |
| 376 | 382 |
| 377 } // namespace net | 383 } // namespace net |
| 378 | 384 |
| 379 #endif // NET_SPDY_SPDY_STREAM_H_ | 385 #endif // NET_SPDY_SPDY_STREAM_H_ |
| OLD | NEW |