| 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_HTTP_STREAM_H_ | 5 #ifndef NET_SPDY_SPDY_HTTP_STREAM_H_ |
| 6 #define NET_SPDY_SPDY_HTTP_STREAM_H_ | 6 #define NET_SPDY_SPDY_HTTP_STREAM_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 // HttpStream implementation. | 45 // HttpStream implementation. |
| 46 | 46 |
| 47 int InitializeStream(const HttpRequestInfo* request_info, | 47 int InitializeStream(const HttpRequestInfo* request_info, |
| 48 RequestPriority priority, | 48 RequestPriority priority, |
| 49 const BoundNetLog& net_log, | 49 const BoundNetLog& net_log, |
| 50 const CompletionCallback& callback) override; | 50 const CompletionCallback& callback) override; |
| 51 | 51 |
| 52 int SendRequest(const HttpRequestHeaders& headers, | 52 int SendRequest(const HttpRequestHeaders& headers, |
| 53 HttpResponseInfo* response, | 53 HttpResponseInfo* response, |
| 54 const CompletionCallback& callback) override; | 54 const CompletionCallback& callback) override; |
| 55 UploadProgress GetUploadProgress() const override; | |
| 56 int ReadResponseHeaders(const CompletionCallback& callback) override; | 55 int ReadResponseHeaders(const CompletionCallback& callback) override; |
| 57 int ReadResponseBody(IOBuffer* buf, | 56 int ReadResponseBody(IOBuffer* buf, |
| 58 int buf_len, | 57 int buf_len, |
| 59 const CompletionCallback& callback) override; | 58 const CompletionCallback& callback) override; |
| 60 void Close(bool not_reusable) override; | 59 void Close(bool not_reusable) override; |
| 61 HttpStream* RenewStreamForAuth() override; | 60 HttpStream* RenewStreamForAuth() override; |
| 62 bool IsResponseBodyComplete() const override; | 61 bool IsResponseBodyComplete() const override; |
| 63 | 62 |
| 64 // Must not be called if a NULL SpdySession was pssed into the | 63 // Must not be called if a NULL SpdySession was pssed into the |
| 65 // constructor. | 64 // constructor. |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 // which does not support that. | 128 // which does not support that. |
| 130 void MaybePostRequestCallback(int rv); | 129 void MaybePostRequestCallback(int rv); |
| 131 | 130 |
| 132 // Call the user callback associated with reading the response. | 131 // Call the user callback associated with reading the response. |
| 133 void DoResponseCallback(int rv); | 132 void DoResponseCallback(int rv); |
| 134 | 133 |
| 135 void ScheduleBufferedReadCallback(); | 134 void ScheduleBufferedReadCallback(); |
| 136 void DoBufferedReadCallback(); | 135 void DoBufferedReadCallback(); |
| 137 bool ShouldWaitForMoreBufferedData() const; | 136 bool ShouldWaitForMoreBufferedData() const; |
| 138 | 137 |
| 138 void ResetRequestInfo(); |
| 139 |
| 139 const base::WeakPtr<SpdySession> spdy_session_; | 140 const base::WeakPtr<SpdySession> spdy_session_; |
| 140 bool is_reused_; | 141 bool is_reused_; |
| 141 SpdyStreamRequest stream_request_; | 142 SpdyStreamRequest stream_request_; |
| 142 base::WeakPtr<SpdyStream> stream_; | 143 base::WeakPtr<SpdyStream> stream_; |
| 143 | 144 |
| 144 bool stream_closed_; | 145 bool stream_closed_; |
| 145 | 146 |
| 146 // Set only when |stream_closed_| is true. | 147 // Set only when |stream_closed_| is true. |
| 147 int closed_stream_status_; | 148 int closed_stream_status_; |
| 148 SpdyStreamId closed_stream_id_; | 149 SpdyStreamId closed_stream_id_; |
| 149 bool closed_stream_has_load_timing_info_; | 150 bool closed_stream_has_load_timing_info_; |
| 150 LoadTimingInfo closed_stream_load_timing_info_; | 151 LoadTimingInfo closed_stream_load_timing_info_; |
| 151 // After |stream_| has been closed, this keeps track of the total number of | 152 // After |stream_| has been closed, this keeps track of the total number of |
| 152 // bytes received over the network for |stream_| while it was open. | 153 // bytes received over the network for |stream_| while it was open. |
| 153 int64_t closed_stream_received_bytes_; | 154 int64_t closed_stream_received_bytes_; |
| 154 // After |stream_| has been closed, this keeps track of the total number of | 155 // After |stream_| has been closed, this keeps track of the total number of |
| 155 // bytes sent over the network for |stream_| while it was open. | 156 // bytes sent over the network for |stream_| while it was open. |
| 156 int64_t closed_stream_sent_bytes_; | 157 int64_t closed_stream_sent_bytes_; |
| 157 | 158 |
| 158 // The request to send. | 159 // The request to send. |
| 160 // Set to null when response body is starting to be read. This is to allow |
| 161 // the stream to be shared for reading and to possibly outlive request_info_'s |
| 162 // owner. |
| 159 const HttpRequestInfo* request_info_; | 163 const HttpRequestInfo* request_info_; |
| 160 | 164 |
| 161 // |response_info_| is the HTTP response data object which is filled in | 165 // |response_info_| is the HTTP response data object which is filled in |
| 162 // when a response HEADERS comes in for the stream. | 166 // when a response HEADERS comes in for the stream. |
| 163 // It is not owned by this stream object, or point to |push_response_info_|. | 167 // It is not owned by this stream object, or point to |push_response_info_|. |
| 164 HttpResponseInfo* response_info_; | 168 HttpResponseInfo* response_info_; |
| 165 | 169 |
| 166 std::unique_ptr<HttpResponseInfo> push_response_info_; | 170 std::unique_ptr<HttpResponseInfo> push_response_info_; |
| 167 | 171 |
| 168 // We don't use SpdyStream's |response_header_status_| as we | 172 // We don't use SpdyStream's |response_header_status_| as we |
| (...skipping 28 matching lines...) Expand all Loading... |
| 197 NextProto negotiated_protocol_; | 201 NextProto negotiated_protocol_; |
| 198 | 202 |
| 199 base::WeakPtrFactory<SpdyHttpStream> weak_factory_; | 203 base::WeakPtrFactory<SpdyHttpStream> weak_factory_; |
| 200 | 204 |
| 201 DISALLOW_COPY_AND_ASSIGN(SpdyHttpStream); | 205 DISALLOW_COPY_AND_ASSIGN(SpdyHttpStream); |
| 202 }; | 206 }; |
| 203 | 207 |
| 204 } // namespace net | 208 } // namespace net |
| 205 | 209 |
| 206 #endif // NET_SPDY_SPDY_HTTP_STREAM_H_ | 210 #endif // NET_SPDY_SPDY_HTTP_STREAM_H_ |
| OLD | NEW |