| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "content/browser/loader/upload_progress_tracker.h" | 5 #include "content/browser/loader/upload_progress_tracker.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 #include "base/logging.h" | 9 #include "base/logging.h" |
| 8 #include "net/base/upload_progress.h" | 10 #include "net/base/upload_progress.h" |
| 9 #include "net/url_request/url_request.h" | 11 #include "net/url_request/url_request.h" |
| 10 | 12 |
| 11 namespace content { | 13 namespace content { |
| 12 namespace { | 14 namespace { |
| 13 // The interval for calls to ReportUploadProgress. | 15 // The interval for calls to ReportUploadProgress. |
| 14 constexpr base::TimeDelta kUploadProgressInterval = | 16 constexpr base::TimeDelta kUploadProgressInterval = |
| 15 base::TimeDelta::FromMilliseconds(100); | 17 base::TimeDelta::FromMilliseconds(100); |
| 16 } // namespace | 18 } // namespace |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 | 65 |
| 64 if (is_finished || enough_new_progress || too_much_time_passed) { | 66 if (is_finished || enough_new_progress || too_much_time_passed) { |
| 65 report_progress_.Run(progress.position(), progress.size()); | 67 report_progress_.Run(progress.position(), progress.size()); |
| 66 waiting_for_upload_progress_ack_ = true; | 68 waiting_for_upload_progress_ack_ = true; |
| 67 last_upload_ticks_ = base::TimeTicks::Now(); | 69 last_upload_ticks_ = base::TimeTicks::Now(); |
| 68 last_upload_position_ = progress.position(); | 70 last_upload_position_ = progress.position(); |
| 69 } | 71 } |
| 70 } | 72 } |
| 71 | 73 |
| 72 } // namespace content | 74 } // namespace content |
| OLD | NEW |