Chromium Code Reviews| 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 d233da6adbf53d7b87b69114c6393c265d70dc40..d98e000055ecf524132d0fe4f23c3833f3c8f6aa 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(); |
|
darin (slow to review)
2012/08/29 22:36:16
nit: no need for 'const' here
hashimoto
2012/08/29 22:48:55
Done.
|
| + 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; |
| } |
| } |