| 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 // Indicates pending frame type. |
| 92 enum PendingFrameType { |
| 93 TYPE_HEADER, |
| 94 TYPE_DATA |
| 95 }; |
| 96 |
| 97 // Structure to contains pending frame information. |
| 98 typedef struct { |
| 99 PendingFrameType type; |
| 100 union { |
| 101 SpdyHeaderBlock* header_block; |
| 102 SpdyDataFrame* data_frame; |
| 103 }; |
| 104 } PendingFrame; |
| 105 |
| 91 // SpdyStream constructor | 106 // SpdyStream constructor |
| 92 SpdyStream(SpdySession* session, | 107 SpdyStream(SpdySession* session, |
| 93 bool pushed, | 108 bool pushed, |
| 94 const BoundNetLog& net_log); | 109 const BoundNetLog& net_log); |
| 95 | 110 |
| 96 // Set new |delegate|. |delegate| must not be NULL. | 111 // Set new |delegate|. |delegate| must not be NULL. |
| 97 // If it already received SYN_REPLY or data, OnResponseReceived() or | 112 // If it already received SYN_REPLY or data, OnResponseReceived() or |
| 98 // OnDataReceived() will be called. | 113 // OnDataReceived() will be called. |
| 99 void SetDelegate(Delegate* delegate); | 114 void SetDelegate(Delegate* delegate); |
| 100 Delegate* GetDelegate() { return delegate_; } | 115 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 | 230 // TODO(satorux): This is only for testing. We should be able to remove |
| 216 // this once crbug.com/113107 is addressed. | 231 // this once crbug.com/113107 is addressed. |
| 217 bool body_sent() const { return io_state_ > STATE_SEND_BODY_COMPLETE; } | 232 bool body_sent() const { return io_state_ > STATE_SEND_BODY_COMPLETE; } |
| 218 | 233 |
| 219 // Interface for Spdy[Http|WebSocket]Stream to use. | 234 // Interface for Spdy[Http|WebSocket]Stream to use. |
| 220 | 235 |
| 221 // Sends the request. | 236 // Sends the request. |
| 222 // For non push stream, it will send SYN_STREAM frame. | 237 // For non push stream, it will send SYN_STREAM frame. |
| 223 int SendRequest(bool has_upload_data); | 238 int SendRequest(bool has_upload_data); |
| 224 | 239 |
| 240 // Sends a HEADERS frame. SpdyStream owns |headers| and will release it after |
| 241 // the HEADERS frame is actually sent. |
| 242 int WriteHeaders(SpdyHeaderBlock* headers); |
| 243 |
| 225 // Sends DATA frame. | 244 // Sends DATA frame. |
| 226 int WriteStreamData(IOBuffer* data, int length, | 245 int WriteStreamData(IOBuffer* data, int length, |
| 227 SpdyDataFlags flags); | 246 SpdyDataFlags flags); |
| 228 | 247 |
| 229 // Fills SSL info in |ssl_info| and returns true when SSL is in use. | 248 // Fills SSL info in |ssl_info| and returns true when SSL is in use. |
| 230 bool GetSSLInfo(SSLInfo* ssl_info, | 249 bool GetSSLInfo(SSLInfo* ssl_info, |
| 231 bool* was_npn_negotiated, | 250 bool* was_npn_negotiated, |
| 232 NextProto* protocol_negotiated); | 251 NextProto* protocol_negotiated); |
| 233 | 252 |
| 234 // Fills SSL Certificate Request info |cert_request_info| and returns | 253 // 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. | 357 // The request to send. |
| 339 scoped_ptr<SpdyHeaderBlock> request_; | 358 scoped_ptr<SpdyHeaderBlock> request_; |
| 340 | 359 |
| 341 // The time at which the request was made that resulted in this response. | 360 // 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. | 361 // For cached responses, this time could be "far" in the past. |
| 343 base::Time request_time_; | 362 base::Time request_time_; |
| 344 | 363 |
| 345 scoped_ptr<SpdyHeaderBlock> response_; | 364 scoped_ptr<SpdyHeaderBlock> response_; |
| 346 base::Time response_time_; | 365 base::Time response_time_; |
| 347 | 366 |
| 348 std::list<SpdyFrame*> pending_data_frames_; | 367 std::list<PendingFrame> pending_frames_; |
| 349 | 368 |
| 350 State io_state_; | 369 State io_state_; |
| 351 | 370 |
| 352 // Since we buffer the response, we also buffer the response status. | 371 // Since we buffer the response, we also buffer the response status. |
| 353 // Not valid until the stream is closed. | 372 // Not valid until the stream is closed. |
| 354 int response_status_; | 373 int response_status_; |
| 355 | 374 |
| 356 bool cancelled_; | 375 bool cancelled_; |
| 357 bool has_upload_data_; | 376 bool has_upload_data_; |
| 358 | 377 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 370 std::string domain_bound_private_key_; | 389 std::string domain_bound_private_key_; |
| 371 std::string domain_bound_cert_; | 390 std::string domain_bound_cert_; |
| 372 ServerBoundCertService::RequestHandle domain_bound_cert_request_handle_; | 391 ServerBoundCertService::RequestHandle domain_bound_cert_request_handle_; |
| 373 | 392 |
| 374 DISALLOW_COPY_AND_ASSIGN(SpdyStream); | 393 DISALLOW_COPY_AND_ASSIGN(SpdyStream); |
| 375 }; | 394 }; |
| 376 | 395 |
| 377 } // namespace net | 396 } // namespace net |
| 378 | 397 |
| 379 #endif // NET_SPDY_SPDY_STREAM_H_ | 398 #endif // NET_SPDY_SPDY_STREAM_H_ |
| OLD | NEW |