OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_HTTP_BIDIRECTIONAL_STREAM_H_ | 5 #ifndef NET_HTTP_BIDIRECTIONAL_STREAM_H_ |
6 #define NET_HTTP_BIDIRECTIONAL_STREAM_H_ | 6 #define NET_HTTP_BIDIRECTIONAL_STREAM_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 | 11 |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
| 17 #include "net/base/load_timing_info.h" |
17 #include "net/http/bidirectional_stream_impl.h" | 18 #include "net/http/bidirectional_stream_impl.h" |
18 #include "net/http/http_stream_factory.h" | 19 #include "net/http/http_stream_factory.h" |
19 #include "net/log/net_log.h" | 20 #include "net/log/net_log.h" |
20 | 21 |
21 class GURL; | 22 class GURL; |
22 | 23 |
23 namespace net { | 24 namespace net { |
24 | 25 |
25 class HttpAuthController; | 26 class HttpAuthController; |
26 class HttpNetworkSession; | 27 class HttpNetworkSession; |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 // frame headers, after SSL decryption and not including proxy overhead. | 165 // frame headers, after SSL decryption and not including proxy overhead. |
165 // If stream has not been established, return 0. | 166 // If stream has not been established, return 0. |
166 int64_t GetTotalReceivedBytes() const; | 167 int64_t GetTotalReceivedBytes() const; |
167 | 168 |
168 // Total number of bytes sent over the network of SPDY frames associated with | 169 // Total number of bytes sent over the network of SPDY frames associated with |
169 // this stream, including the size of frame headers, before SSL encryption and | 170 // this stream, including the size of frame headers, before SSL encryption and |
170 // not including proxy overhead. Note that some SPDY frames such as pings are | 171 // not including proxy overhead. Note that some SPDY frames such as pings are |
171 // not associated with any stream, and are not included in this value. | 172 // not associated with any stream, and are not included in this value. |
172 int64_t GetTotalSentBytes() const; | 173 int64_t GetTotalSentBytes() const; |
173 | 174 |
174 // TODO(xunjieli): Implement a method to do flow control and a method to ping | 175 // Get LoadTimingInfo of this stream. |
175 // remote end point. | 176 void GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const; |
176 | 177 |
177 private: | 178 private: |
178 // BidirectionalStreamImpl::Delegate implementation: | 179 // BidirectionalStreamImpl::Delegate implementation: |
179 void OnStreamReady(bool request_headers_sent) override; | 180 void OnStreamReady(bool request_headers_sent) override; |
180 void OnHeadersReceived(const SpdyHeaderBlock& response_headers) override; | 181 void OnHeadersReceived(const SpdyHeaderBlock& response_headers) override; |
181 void OnDataRead(int bytes_read) override; | 182 void OnDataRead(int bytes_read) override; |
182 void OnDataSent() override; | 183 void OnDataSent() override; |
183 void OnTrailersReceived(const SpdyHeaderBlock& trailers) override; | 184 void OnTrailersReceived(const SpdyHeaderBlock& trailers) override; |
184 void OnFailed(int error) override; | 185 void OnFailed(int error) override; |
185 | 186 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 // non-NULL, if the |stream_request_| successfully finishes. | 240 // non-NULL, if the |stream_request_| successfully finishes. |
240 std::unique_ptr<BidirectionalStreamImpl> stream_impl_; | 241 std::unique_ptr<BidirectionalStreamImpl> stream_impl_; |
241 | 242 |
242 // Buffer used for reading. | 243 // Buffer used for reading. |
243 scoped_refptr<IOBuffer> read_buffer_; | 244 scoped_refptr<IOBuffer> read_buffer_; |
244 // List of buffers used for writing. | 245 // List of buffers used for writing. |
245 std::vector<scoped_refptr<IOBuffer>> write_buffer_list_; | 246 std::vector<scoped_refptr<IOBuffer>> write_buffer_list_; |
246 // List of buffer length. | 247 // List of buffer length. |
247 std::vector<int> write_buffer_len_list_; | 248 std::vector<int> write_buffer_len_list_; |
248 | 249 |
249 base::TimeTicks start_time_; | 250 // TODO(xunjieli): Remove this once LoadTimingInfo has response end. |
250 base::TimeTicks read_start_time_; | |
251 base::TimeTicks read_end_time_; | 251 base::TimeTicks read_end_time_; |
252 base::TimeTicks send_start_time_; | 252 |
253 base::TimeTicks send_end_time_; | 253 // Load timing info of this stream. |connect_timing| is obtained when headers |
| 254 // are received. Other fields are populated at different stages of the request |
| 255 LoadTimingInfo load_timing_info_; |
254 | 256 |
255 base::WeakPtrFactory<BidirectionalStream> weak_factory_; | 257 base::WeakPtrFactory<BidirectionalStream> weak_factory_; |
256 | 258 |
257 DISALLOW_COPY_AND_ASSIGN(BidirectionalStream); | 259 DISALLOW_COPY_AND_ASSIGN(BidirectionalStream); |
258 }; | 260 }; |
259 | 261 |
260 } // namespace net | 262 } // namespace net |
261 | 263 |
262 #endif // NET_HTTP_BIDIRECTIONAL_STREAM_H_ | 264 #endif // NET_HTTP_BIDIRECTIONAL_STREAM_H_ |
OLD | NEW |