Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(387)

Side by Side Diff: net/http/http_stream_parser.h

Issue 1314783007: Added and implemented HttpStream::GetTotalSentBytes for basic streams. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased on master Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/http/http_stream_factory_impl_unittest.cc ('k') | net/http/http_stream_parser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_HTTP_HTTP_STREAM_PARSER_H_ 5 #ifndef NET_HTTP_HTTP_STREAM_PARSER_H_
6 #define NET_HTTP_HTTP_STREAM_PARSER_H_ 6 #define NET_HTTP_HTTP_STREAM_PARSER_H_
7 7
8 #include <stdint.h>
9
8 #include <string> 10 #include <string>
9 11
10 #include "base/basictypes.h" 12 #include "base/basictypes.h"
11 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
14 #include "base/strings/string_piece.h" 16 #include "base/strings/string_piece.h"
15 #include "net/base/completion_callback.h" 17 #include "net/base/completion_callback.h"
16 #include "net/base/net_export.h" 18 #include "net/base/net_export.h"
17 #include "net/base/upload_progress.h" 19 #include "net/base/upload_progress.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 // * It's still connected. 80 // * It's still connected.
79 // * The response headers indicate the connection can be kept alive. 81 // * The response headers indicate the connection can be kept alive.
80 // * The end of the response can be found. 82 // * The end of the response can be found.
81 // 83 //
82 // Note that if response headers have yet to be received, this will return 84 // Note that if response headers have yet to be received, this will return
83 // false. 85 // false.
84 bool CanReuseConnection() const; 86 bool CanReuseConnection() const;
85 87
86 int64 received_bytes() const { return received_bytes_; } 88 int64 received_bytes() const { return received_bytes_; }
87 89
90 int64_t sent_bytes() const { return sent_bytes_; }
91
88 void GetSSLInfo(SSLInfo* ssl_info); 92 void GetSSLInfo(SSLInfo* ssl_info);
89 93
90 void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info); 94 void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info);
91 95
92 // Encodes the given |payload| in the chunked format to |output|. 96 // Encodes the given |payload| in the chunked format to |output|.
93 // Returns the number of bytes written to |output|. |output_size| should 97 // Returns the number of bytes written to |output|. |output_size| should
94 // be large enough to store the encoded chunk, which is payload.size() + 98 // be large enough to store the encoded chunk, which is payload.size() +
95 // kChunkHeaderFooterSize. Returns ERR_INVALID_ARGUMENT if |output_size| 99 // kChunkHeaderFooterSize. Returns ERR_INVALID_ARGUMENT if |output_size|
96 // is not large enough. 100 // is not large enough.
97 // 101 //
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 int read_buf_unused_offset_; 206 int read_buf_unused_offset_;
203 207
204 // The amount beyond |read_buf_unused_offset_| where the status line starts; 208 // The amount beyond |read_buf_unused_offset_| where the status line starts;
205 // -1 if not found yet. 209 // -1 if not found yet.
206 int response_header_start_offset_; 210 int response_header_start_offset_;
207 211
208 // The amount of received data. If connection is reused then intermediate 212 // The amount of received data. If connection is reused then intermediate
209 // value may be bigger than final. 213 // value may be bigger than final.
210 int64 received_bytes_; 214 int64 received_bytes_;
211 215
216 // The amount of sent data.
217 int64_t sent_bytes_;
218
212 // The parsed response headers. Owned by the caller of SendRequest. This 219 // The parsed response headers. Owned by the caller of SendRequest. This
213 // cannot be safely accessed after reading the final set of headers, as the 220 // cannot be safely accessed after reading the final set of headers, as the
214 // caller of SendRequest may have been destroyed - this happens in the case an 221 // caller of SendRequest may have been destroyed - this happens in the case an
215 // HttpResponseBodyDrainer is used. 222 // HttpResponseBodyDrainer is used.
216 HttpResponseInfo* response_; 223 HttpResponseInfo* response_;
217 224
218 // Indicates the content length. If this value is less than zero 225 // Indicates the content length. If this value is less than zero
219 // (and chunked_decoder_ is null), then we must read until the server 226 // (and chunked_decoder_ is null), then we must read until the server
220 // closes the connection. 227 // closes the connection.
221 int64 response_body_length_; 228 int64 response_body_length_;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 int upload_error_; 266 int upload_error_;
260 267
261 base::WeakPtrFactory<HttpStreamParser> weak_ptr_factory_; 268 base::WeakPtrFactory<HttpStreamParser> weak_ptr_factory_;
262 269
263 DISALLOW_COPY_AND_ASSIGN(HttpStreamParser); 270 DISALLOW_COPY_AND_ASSIGN(HttpStreamParser);
264 }; 271 };
265 272
266 } // namespace net 273 } // namespace net
267 274
268 #endif // NET_HTTP_HTTP_STREAM_PARSER_H_ 275 #endif // NET_HTTP_HTTP_STREAM_PARSER_H_
OLDNEW
« no previous file with comments | « net/http/http_stream_factory_impl_unittest.cc ('k') | net/http/http_stream_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698