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

Side by Side Diff: net/spdy/spdy_http_stream.cc

Issue 10834178: net: Return size of upload as well as position from HttpTransaction::GetUploadProgress() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make UploadProgress a class instead of a struct Created 8 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 | Annotate | Revision Log
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 #include "net/spdy/spdy_http_stream.h" 5 #include "net/spdy/spdy_http_stream.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <list> 8 #include <list>
9 #include <string> 9 #include <string>
10 10
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 92
93 return spdy_session_->CreateStream(request_info_->url, 93 return spdy_session_->CreateStream(request_info_->url,
94 request_info_->priority, &stream_, 94 request_info_->priority, &stream_,
95 stream_net_log, callback); 95 stream_net_log, callback);
96 } 96 }
97 97
98 const HttpResponseInfo* SpdyHttpStream::GetResponseInfo() const { 98 const HttpResponseInfo* SpdyHttpStream::GetResponseInfo() const {
99 return response_info_; 99 return response_info_;
100 } 100 }
101 101
102 uint64 SpdyHttpStream::GetUploadProgress() const { 102 UploadProgress SpdyHttpStream::GetUploadProgress() const {
103 if (!request_body_stream_.get()) 103 if (!request_body_stream_.get())
104 return 0; 104 return UploadProgress();
105 105
106 return request_body_stream_->position(); 106 return UploadProgress(request_body_stream_->position(),
107 request_body_stream_->size());
107 } 108 }
108 109
109 int SpdyHttpStream::ReadResponseHeaders(const CompletionCallback& callback) { 110 int SpdyHttpStream::ReadResponseHeaders(const CompletionCallback& callback) {
110 CHECK(!callback.is_null()); 111 CHECK(!callback.is_null());
111 CHECK(!stream_->cancelled()); 112 CHECK(!stream_->cancelled());
112 113
113 if (stream_->closed()) 114 if (stream_->closed())
114 return stream_->response_status(); 115 return stream_->response_status();
115 116
116 // Check if we already have the response headers. If so, return synchronously. 117 // Check if we already have the response headers. If so, return synchronously.
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 bool SpdyHttpStream::IsSpdyHttpStream() const { 558 bool SpdyHttpStream::IsSpdyHttpStream() const {
558 return true; 559 return true;
559 } 560 }
560 561
561 void SpdyHttpStream::Drain(HttpNetworkSession* session) { 562 void SpdyHttpStream::Drain(HttpNetworkSession* session) {
562 Close(false); 563 Close(false);
563 delete this; 564 delete this;
564 } 565 }
565 566
566 } // namespace net 567 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698