summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrch@chromium.org <rch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-23 22:59:15 +0000
committerrch@chromium.org <rch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-23 22:59:15 +0000
commit14cfbd6a8c4fdaf0f72bf5c1be3b6529e71292e7 (patch)
tree63544d1e929d21e103a18b096796d8af9cdcfa6c
parent7196a289fdbd636d9824b401580fc7b19c7b1d27 (diff)
downloadchromium_src-14cfbd6a8c4fdaf0f72bf5c1be3b6529e71292e7.zip
chromium_src-14cfbd6a8c4fdaf0f72bf5c1be3b6529e71292e7.tar.gz
chromium_src-14cfbd6a8c4fdaf0f72bf5c1be3b6529e71292e7.tar.bz2
Implement QuicHttpStream::GetTotalReceivedBytes.
Review URL: https://codereview.chromium.org/135013003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@246710 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--net/quic/quic_http_stream.cc10
-rw-r--r--net/quic/quic_http_stream.h3
2 files changed, 11 insertions, 2 deletions
diff --git a/net/quic/quic_http_stream.cc b/net/quic/quic_http_stream.cc
index b8141bb..992f254 100644
--- a/net/quic/quic_http_stream.cc
+++ b/net/quic/quic_http_stream.cc
@@ -37,6 +37,7 @@ QuicHttpStream::QuicHttpStream(const base::WeakPtr<QuicClientSession>& session)
response_status_(OK),
response_headers_received_(false),
read_buf_(new GrowableIOBuffer()),
+ closed_stream_received_bytes_(0),
user_buffer_len_(0),
weak_factory_(this) {
DCHECK(session_);
@@ -206,6 +207,7 @@ int QuicHttpStream::ReadResponseBody(
void QuicHttpStream::Close(bool not_reusable) {
// Note: the not_reusable flag has no meaning for SPDY streams.
if (stream_) {
+ closed_stream_received_bytes_ = stream_->stream_bytes_read();
stream_->SetDelegate(NULL);
stream_->Reset(QUIC_STREAM_CANCELLED);
stream_ = NULL;
@@ -239,8 +241,11 @@ bool QuicHttpStream::IsConnectionReusable() const {
}
int64 QuicHttpStream::GetTotalReceivedBytes() const {
- // TODO(eustas): Implement.
- return 0;
+ if (stream_) {
+ return stream_->stream_bytes_read();
+ }
+
+ return closed_stream_received_bytes_;
}
bool QuicHttpStream::GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const {
@@ -320,6 +325,7 @@ void QuicHttpStream::OnClose(QuicErrorCode error) {
response_status_ = ERR_ABORTED;
}
+ closed_stream_received_bytes_ = stream_->stream_bytes_read();
stream_ = NULL;
if (!callback_.is_null())
DoCallback(response_status_);
diff --git a/net/quic/quic_http_stream.h b/net/quic/quic_http_stream.h
index 7a96ea3..ce78bb3 100644
--- a/net/quic/quic_http_stream.h
+++ b/net/quic/quic_http_stream.h
@@ -145,6 +145,9 @@ class NET_EXPORT_PRIVATE QuicHttpStream :
// TODO(rch): This is infinite buffering, which is bad.
std::list<scoped_refptr<IOBufferWithSize> > response_body_;
+ // Number of bytes received when the stream was closed.
+ int64 closed_stream_received_bytes_;
+
// The caller's callback to be used for asynchronous operations.
CompletionCallback callback_;