| Index: content/browser/renderer_host/resource_loader.cc
|
| diff --git a/content/browser/renderer_host/resource_loader.cc b/content/browser/renderer_host/resource_loader.cc
|
| index e928724af95f21d29d388deb26cd3fa196ac4d71..9b9e79d2f61b4ac5aaaf6b60c6ca8b39e616c71b 100644
|
| --- a/content/browser/renderer_host/resource_loader.cc
|
| +++ b/content/browser/renderer_host/resource_loader.cc
|
| @@ -17,6 +17,7 @@
|
| #include "content/public/browser/resource_dispatcher_host_login_delegate.h"
|
| #include "content/public/common/resource_response.h"
|
| #include "net/base/load_flags.h"
|
| +#include "net/base/upload_data_stream.h"
|
| #include "net/http/http_response_headers.h"
|
| #include "webkit/appcache/appcache_interceptor.h"
|
|
|
| @@ -57,6 +58,7 @@ ResourceLoader::ResourceLoader(scoped_ptr<net::URLRequest> request,
|
| request_(request.Pass()),
|
| handler_(handler.Pass()),
|
| delegate_(delegate),
|
| + upload_size_(0),
|
| last_upload_position_(0),
|
| waiting_for_upload_progress_ack_(false),
|
| is_transferring_(false),
|
| @@ -107,8 +109,7 @@ void ResourceLoader::ReportUploadProgress() {
|
| if (waiting_for_upload_progress_ack_)
|
| return; // Send one progress event at a time.
|
|
|
| - uint64 size = info->GetUploadSize();
|
| - if (!size)
|
| + if (!upload_size_)
|
| return; // Nothing to upload.
|
|
|
| uint64 position = request_->GetUploadProgress();
|
| @@ -121,13 +122,14 @@ void ResourceLoader::ReportUploadProgress() {
|
| uint64 amt_since_last = position - last_upload_position_;
|
| TimeDelta time_since_last = TimeTicks::Now() - last_upload_ticks_;
|
|
|
| - bool is_finished = (size == position);
|
| - bool enough_new_progress = (amt_since_last > (size / kHalfPercentIncrements));
|
| + bool is_finished = (upload_size_ == position);
|
| + bool enough_new_progress =
|
| + (amt_since_last > (upload_size_ / kHalfPercentIncrements));
|
| bool too_much_time_passed = time_since_last > kOneSecond;
|
|
|
| if (is_finished || enough_new_progress || too_much_time_passed) {
|
| if (request_->load_flags() & net::LOAD_ENABLE_UPLOAD_PROGRESS) {
|
| - handler_->OnUploadProgress(info->GetRequestID(), position, size);
|
| + handler_->OnUploadProgress(info->GetRequestID(), position, upload_size_);
|
| waiting_for_upload_progress_ack_ = true;
|
| }
|
| last_upload_ticks_ = TimeTicks::Now();
|
| @@ -179,6 +181,11 @@ void ResourceLoader::OnUploadProgressACK() {
|
| waiting_for_upload_progress_ack_ = false;
|
| }
|
|
|
| +void ResourceLoader::OnRequestBodyInitialized(net::URLRequest* request,
|
| + uint64 size) {
|
| + upload_size_ = size;
|
| +}
|
| +
|
| void ResourceLoader::OnReceivedRedirect(net::URLRequest* unused,
|
| const GURL& new_url,
|
| bool* defer) {
|
|
|