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

Unified Diff: webkit/tools/test_shell/simple_resource_loader_bridge.cc

Issue 10830182: net: Return size of upload as well as position from URLRequest::GetUploadProgress() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: _ Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/url_request/url_request_job.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/tools/test_shell/simple_resource_loader_bridge.cc
diff --git a/webkit/tools/test_shell/simple_resource_loader_bridge.cc b/webkit/tools/test_shell/simple_resource_loader_bridge.cc
index 106defad66030fd9701d0ed1164bcd3fe0550dc3..e8ed7f1c58b6422faff6feeda534ce886f5f234b 100644
--- a/webkit/tools/test_shell/simple_resource_loader_bridge.cc
+++ b/webkit/tools/test_shell/simple_resource_loader_bridge.cc
@@ -618,32 +618,29 @@ class RequestProxy
return;
}
- // GetContentLengthSync() may perform file IO, but it's ok here, as file
- // IO is not prohibited in IOThread defined in the file.
- uint64 size = request_->get_upload_mutable()->GetContentLengthSync();
- uint64 position = request_->GetUploadProgress();
- if (position == last_upload_position_)
+ const net::UploadProgress progress = request_->GetUploadProgress();
+ if (progress.position == last_upload_position_)
return; // no progress made since last time
const uint64 kHalfPercentIncrements = 200;
const base::TimeDelta kOneSecond = base::TimeDelta::FromMilliseconds(1000);
- uint64 amt_since_last = position - last_upload_position_;
+ uint64 amt_since_last = progress.position - last_upload_position_;
base::TimeDelta time_since_last = base::TimeTicks::Now() -
last_upload_ticks_;
- bool is_finished = (size == position);
- bool enough_new_progress = (amt_since_last > (size /
+ bool is_finished = (progress.size == progress.position);
+ bool enough_new_progress = (amt_since_last > (progress.size /
kHalfPercentIncrements));
bool too_much_time_passed = time_since_last > kOneSecond;
if (is_finished || enough_new_progress || too_much_time_passed) {
owner_loop_->PostTask(
FROM_HERE,
- base::Bind(&RequestProxy::NotifyUploadProgress, this, position,
- size));
+ base::Bind(&RequestProxy::NotifyUploadProgress, this,
+ progress.position, progress.size));
last_upload_ticks_ = base::TimeTicks::Now();
- last_upload_position_ = position;
+ last_upload_position_ = progress.position;
}
}
« no previous file with comments | « net/url_request/url_request_job.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698