| 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 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 // The SpdyHttpStream is a HTTP-specific type of stream known to a SpdySession. | 30 // The SpdyHttpStream is a HTTP-specific type of stream known to a SpdySession. |
| 31 class NET_EXPORT_PRIVATE SpdyHttpStream : public SpdyStream::Delegate, | 31 class NET_EXPORT_PRIVATE SpdyHttpStream : public SpdyStream::Delegate, |
| 32 public MultiplexedHttpStream { | 32 public MultiplexedHttpStream { |
| 33 public: | 33 public: |
| 34 static const size_t kRequestBodyBufferSize; | 34 static const size_t kRequestBodyBufferSize; |
| 35 // |spdy_session| must not be NULL. | 35 // |spdy_session| must not be NULL. |
| 36 SpdyHttpStream(const base::WeakPtr<SpdySession>& spdy_session, bool direct); | 36 SpdyHttpStream(const base::WeakPtr<SpdySession>& spdy_session, bool direct); |
| 37 ~SpdyHttpStream() override; | 37 ~SpdyHttpStream() override; |
| 38 | 38 |
| 39 SpdyStream* stream() { return stream_.get(); } | 39 SpdyStream* stream() { return stream_; } |
| 40 | 40 |
| 41 // Cancels any callbacks from being invoked and deletes the stream. | 41 // Cancels any callbacks from being invoked and deletes the stream. |
| 42 void Cancel(); | 42 void Cancel(); |
| 43 | 43 |
| 44 // HttpStream implementation. | 44 // HttpStream implementation. |
| 45 | 45 |
| 46 int InitializeStream(const HttpRequestInfo* request_info, | 46 int InitializeStream(const HttpRequestInfo* request_info, |
| 47 RequestPriority priority, | 47 RequestPriority priority, |
| 48 const NetLogWithSource& net_log, | 48 const NetLogWithSource& net_log, |
| 49 const CompletionCallback& callback) override; | 49 const CompletionCallback& callback) override; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 // Call the user callback associated with reading the response. | 121 // Call the user callback associated with reading the response. |
| 122 void DoResponseCallback(int rv); | 122 void DoResponseCallback(int rv); |
| 123 | 123 |
| 124 void ScheduleBufferedReadCallback(); | 124 void ScheduleBufferedReadCallback(); |
| 125 void DoBufferedReadCallback(); | 125 void DoBufferedReadCallback(); |
| 126 bool ShouldWaitForMoreBufferedData() const; | 126 bool ShouldWaitForMoreBufferedData() const; |
| 127 | 127 |
| 128 const base::WeakPtr<SpdySession> spdy_session_; | 128 const base::WeakPtr<SpdySession> spdy_session_; |
| 129 bool is_reused_; | 129 bool is_reused_; |
| 130 SpdyStreamRequest stream_request_; | 130 SpdyStreamRequest stream_request_; |
| 131 base::WeakPtr<SpdyStream> stream_; | |
| 132 | 131 |
| 132 // |stream_| is owned by SpdySession. |
| 133 // Before InitializeStream() is called, stream_ == nullptr. |
| 134 // After InitializeStream() is called but before OnClose() is called, |
| 135 // |*stream_| is guaranteed to be valid. |
| 136 // After OnClose() is called, stream_ == nullptr. |
| 137 SpdyStream* stream_; |
| 138 |
| 139 // False before OnClose() is called, true after. |
| 133 bool stream_closed_; | 140 bool stream_closed_; |
| 134 | 141 |
| 135 // Set only when |stream_closed_| is true. | 142 // Set only when |stream_closed_| is true. |
| 136 int closed_stream_status_; | 143 int closed_stream_status_; |
| 137 SpdyStreamId closed_stream_id_; | 144 SpdyStreamId closed_stream_id_; |
| 138 bool closed_stream_has_load_timing_info_; | 145 bool closed_stream_has_load_timing_info_; |
| 139 LoadTimingInfo closed_stream_load_timing_info_; | 146 LoadTimingInfo closed_stream_load_timing_info_; |
| 140 // After |stream_| has been closed, this keeps track of the total number of | 147 // After |stream_| has been closed, this keeps track of the total number of |
| 141 // bytes received over the network for |stream_| while it was open. | 148 // bytes received over the network for |stream_| while it was open. |
| 142 int64_t closed_stream_received_bytes_; | 149 int64_t closed_stream_received_bytes_; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 bool was_alpn_negotiated_; | 192 bool was_alpn_negotiated_; |
| 186 | 193 |
| 187 base::WeakPtrFactory<SpdyHttpStream> weak_factory_; | 194 base::WeakPtrFactory<SpdyHttpStream> weak_factory_; |
| 188 | 195 |
| 189 DISALLOW_COPY_AND_ASSIGN(SpdyHttpStream); | 196 DISALLOW_COPY_AND_ASSIGN(SpdyHttpStream); |
| 190 }; | 197 }; |
| 191 | 198 |
| 192 } // namespace net | 199 } // namespace net |
| 193 | 200 |
| 194 #endif // NET_SPDY_SPDY_HTTP_STREAM_H_ | 201 #endif // NET_SPDY_SPDY_HTTP_STREAM_H_ |
| OLD | NEW |