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

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: Addressed mmenke comments 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
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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 bool IsMoreDataBuffered() const; 72 bool IsMoreDataBuffered() const;
71 73
72 bool IsConnectionReused() const; 74 bool IsConnectionReused() const;
73 75
74 void SetConnectionReused(); 76 void SetConnectionReused();
75 77
76 bool IsConnectionReusable() const; 78 bool IsConnectionReusable() const;
77 79
78 int64 received_bytes() const { return received_bytes_; } 80 int64 received_bytes() const { return received_bytes_; }
79 81
82 int64_t sent_bytes() const { return sent_bytes_; }
83
80 void GetSSLInfo(SSLInfo* ssl_info); 84 void GetSSLInfo(SSLInfo* ssl_info);
81 85
82 void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info); 86 void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info);
83 87
84 // Encodes the given |payload| in the chunked format to |output|. 88 // Encodes the given |payload| in the chunked format to |output|.
85 // Returns the number of bytes written to |output|. |output_size| should 89 // Returns the number of bytes written to |output|. |output_size| should
86 // be large enough to store the encoded chunk, which is payload.size() + 90 // be large enough to store the encoded chunk, which is payload.size() +
87 // kChunkHeaderFooterSize. Returns ERR_INVALID_ARGUMENT if |output_size| 91 // kChunkHeaderFooterSize. Returns ERR_INVALID_ARGUMENT if |output_size|
88 // is not large enough. 92 // is not large enough.
89 // 93 //
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 int read_buf_unused_offset_; 198 int read_buf_unused_offset_;
195 199
196 // The amount beyond |read_buf_unused_offset_| where the status line starts; 200 // The amount beyond |read_buf_unused_offset_| where the status line starts;
197 // -1 if not found yet. 201 // -1 if not found yet.
198 int response_header_start_offset_; 202 int response_header_start_offset_;
199 203
200 // The amount of received data. If connection is reused then intermediate 204 // The amount of received data. If connection is reused then intermediate
201 // value may be bigger than final. 205 // value may be bigger than final.
202 int64 received_bytes_; 206 int64 received_bytes_;
203 207
208 // The amount of sent data.
209 int64_t sent_bytes_;
210
204 // The parsed response headers. Owned by the caller of SendRequest. This 211 // The parsed response headers. Owned by the caller of SendRequest. This
205 // cannot be safely accessed after reading the final set of headers, as the 212 // cannot be safely accessed after reading the final set of headers, as the
206 // caller of SendRequest may have been destroyed - this happens in the case an 213 // caller of SendRequest may have been destroyed - this happens in the case an
207 // HttpResponseBodyDrainer is used. 214 // HttpResponseBodyDrainer is used.
208 HttpResponseInfo* response_; 215 HttpResponseInfo* response_;
209 216
210 // Indicates the content length. If this value is less than zero 217 // Indicates the content length. If this value is less than zero
211 // (and chunked_decoder_ is null), then we must read until the server 218 // (and chunked_decoder_ is null), then we must read until the server
212 // closes the connection. 219 // closes the connection.
213 int64 response_body_length_; 220 int64 response_body_length_;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 int upload_error_; 258 int upload_error_;
252 259
253 base::WeakPtrFactory<HttpStreamParser> weak_ptr_factory_; 260 base::WeakPtrFactory<HttpStreamParser> weak_ptr_factory_;
254 261
255 DISALLOW_COPY_AND_ASSIGN(HttpStreamParser); 262 DISALLOW_COPY_AND_ASSIGN(HttpStreamParser);
256 }; 263 };
257 264
258 } // namespace net 265 } // namespace net
259 266
260 #endif // NET_HTTP_HTTP_STREAM_PARSER_H_ 267 #endif // NET_HTTP_HTTP_STREAM_PARSER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698