Chromium Code Reviews| 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 <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/timer/timer.h" | |
| 12 #include "content/browser/download/download_job_impl.h" | 13 #include "content/browser/download/download_job_impl.h" |
| 13 #include "content/browser/download/download_worker.h" | 14 #include "content/browser/download/download_worker.h" |
| 14 #include "content/common/content_export.h" | 15 #include "content/common/content_export.h" |
| 15 | 16 |
| 16 namespace content { | 17 namespace content { |
| 17 | 18 |
| 18 // DownloadJob that can create concurrent range requests to fetch different | 19 // DownloadJob that can create concurrent range requests to fetch different |
| 19 // parts of the file. | 20 // parts of the file. |
| 20 // The original request is hold in base class DownloadUrlJob. | 21 // The original request is hold in base class DownloadUrlJob. |
| 21 class CONTENT_EXPORT ParallelDownloadJob : public DownloadJobImpl { | 22 class CONTENT_EXPORT ParallelDownloadJob : public DownloadJobImpl { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 53 // Create one range request, virtual for testing. | 54 // Create one range request, virtual for testing. |
| 54 virtual void CreateRequest(int64_t offset, int64_t length); | 55 virtual void CreateRequest(int64_t offset, int64_t length); |
| 55 | 56 |
| 56 // Information about the initial request when download is started. | 57 // Information about the initial request when download is started. |
| 57 int64_t initial_request_offset_; | 58 int64_t initial_request_offset_; |
| 58 int64_t initial_request_length_; | 59 int64_t initial_request_length_; |
| 59 | 60 |
| 60 // Subsequent tasks to send range requests. | 61 // Subsequent tasks to send range requests. |
| 61 WorkerList workers_; | 62 WorkerList workers_; |
| 62 | 63 |
| 64 // Used to send parallel requests after a delay based on Finch config. | |
| 65 std::unique_ptr<base::OneShotTimer> timer_; | |
|
qinmin
2017/03/15 05:49:18
You don't need the unique_ptr, just use base::OneS
xingliu
2017/03/15 17:48:52
Done, make sense.
| |
| 66 | |
| 63 DISALLOW_COPY_AND_ASSIGN(ParallelDownloadJob); | 67 DISALLOW_COPY_AND_ASSIGN(ParallelDownloadJob); |
| 64 }; | 68 }; |
| 65 | 69 |
| 66 } // namespace content | 70 } // namespace content |
| 67 | 71 |
| 68 #endif // CONTENT_BROWSER_DOWNLOAD_PARALLEL_DOWNLOAD_JOB_H_ | 72 #endif // CONTENT_BROWSER_DOWNLOAD_PARALLEL_DOWNLOAD_JOB_H_ |
| OLD | NEW |