| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 #ifndef CONTENT_BROWSER_DOWNLOAD_PARALLEL_DOWNLOAD_JOB_H_ | 5 #ifndef CONTENT_BROWSER_DOWNLOAD_PARALLEL_DOWNLOAD_JOB_H_ |
| 6 #define CONTENT_BROWSER_DOWNLOAD_PARALLEL_DOWNLOAD_JOB_H_ | 6 #define CONTENT_BROWSER_DOWNLOAD_PARALLEL_DOWNLOAD_JOB_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <unordered_map> | 9 #include <unordered_map> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 void Start() override; | 33 void Start() override; |
| 34 void Cancel(bool user_cancel) override; | 34 void Cancel(bool user_cancel) override; |
| 35 void Pause() override; | 35 void Pause() override; |
| 36 void Resume(bool resume_request) override; | 36 void Resume(bool resume_request) override; |
| 37 bool UsesParallelRequests() const override; | 37 bool UsesParallelRequests() const override; |
| 38 | 38 |
| 39 protected: | 39 protected: |
| 40 // Virtual for testing. | 40 // Virtual for testing. |
| 41 virtual int GetParallelRequestCount() const; | 41 virtual int GetParallelRequestCount() const; |
| 42 virtual int64_t GetMinSliceSize() const; | 42 virtual int64_t GetMinSliceSize() const; |
| 43 virtual int GetMinRemainingTimeInSeconds() const; |
| 43 | 44 |
| 44 using WorkerMap = | 45 using WorkerMap = |
| 45 std::unordered_map<int64_t, std::unique_ptr<DownloadWorker>>; | 46 std::unordered_map<int64_t, std::unique_ptr<DownloadWorker>>; |
| 46 | 47 |
| 47 // Map from the offset position of the slice to the worker that downloads the | 48 // Map from the offset position of the slice to the worker that downloads the |
| 48 // slice. | 49 // slice. |
| 49 WorkerMap workers_; | 50 WorkerMap workers_; |
| 50 | 51 |
| 51 private: | 52 private: |
| 52 friend class ParallelDownloadJobTest; | 53 friend class ParallelDownloadJobTest; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 | 91 |
| 91 // If the download progress is canceled. | 92 // If the download progress is canceled. |
| 92 bool is_canceled_; | 93 bool is_canceled_; |
| 93 | 94 |
| 94 DISALLOW_COPY_AND_ASSIGN(ParallelDownloadJob); | 95 DISALLOW_COPY_AND_ASSIGN(ParallelDownloadJob); |
| 95 }; | 96 }; |
| 96 | 97 |
| 97 } // namespace content | 98 } // namespace content |
| 98 | 99 |
| 99 #endif // CONTENT_BROWSER_DOWNLOAD_PARALLEL_DOWNLOAD_JOB_H_ | 100 #endif // CONTENT_BROWSER_DOWNLOAD_PARALLEL_DOWNLOAD_JOB_H_ |
| OLD | NEW |