Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_BROWSER_LOADER_UPLOAD_PROGRESS_TRACKER_H_ | |
| 6 #define CONTENT_BROWSER_LOADER_UPLOAD_PROGRESS_TRACKER_H_ | |
| 7 | |
| 8 #include <stdint.h> | |
| 9 | |
| 10 #include "base/callback.h" | |
| 11 #include "base/macros.h" | |
| 12 #include "base/time/time.h" | |
| 13 #include "base/timer/timer.h" | |
| 14 | |
| 15 namespace tracked_objects { | |
| 16 class Location; | |
| 17 } | |
| 18 | |
| 19 namespace net { | |
| 20 class URLRequest; | |
| 21 } | |
| 22 | |
| 23 namespace content { | |
| 24 | |
| 25 class UploadProgressTracker final { | |
|
yhirano
2016/12/02 09:17:52
Plase write some comments.
tzik
2016/12/05 08:00:06
Done.
| |
| 26 public: | |
| 27 using UploadProgressReportCallback = | |
| 28 base::RepeatingCallback<void(int64_t, int64_t)>; | |
| 29 | |
| 30 UploadProgressTracker(const tracked_objects::Location& location, | |
| 31 UploadProgressReportCallback report_progress, | |
| 32 net::URLRequest* request); | |
| 33 ~UploadProgressTracker(); | |
| 34 | |
| 35 void OnAckReceived(); | |
| 36 void ForceReportUploadProgress(); | |
| 37 | |
| 38 private: | |
| 39 void ReportUploadProgressIfNeeded(); | |
| 40 | |
| 41 net::URLRequest* request_; // Not owned. | |
| 42 | |
| 43 uint64_t last_upload_position_ = 0; | |
| 44 bool waiting_for_upload_progress_ack_ = false; | |
|
yhirano
2016/12/02 09:17:52
This is not used.
tzik
2016/12/05 08:00:06
Oops. Fixed. Now, it's used.
| |
| 45 base::TimeTicks last_upload_ticks_; | |
| 46 base::RepeatingTimer progress_timer_; | |
| 47 | |
| 48 UploadProgressReportCallback report_progress_; | |
| 49 | |
| 50 DISALLOW_COPY_AND_ASSIGN(UploadProgressTracker); | |
| 51 }; | |
| 52 | |
| 53 } // namespace content | |
| 54 | |
| 55 #endif // CONTENT_BROWSER_LOADER_UPLOAD_PROGRESS_TRACKER_H_ | |
| OLD | NEW |