Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(764)

Unified Diff: content/browser/download/parallel_download_job.h

Issue 2767593003: Handle early pause, cancel for parallel requests. (Closed)
Patch Set: Work on feedback. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/download/parallel_download_job.h
diff --git a/content/browser/download/parallel_download_job.h b/content/browser/download/parallel_download_job.h
index 3beafc979b735250dae963ae2e8680637a15aa65..6f5a7bd98a3b58dad5865330897c430061749115 100644
--- a/content/browser/download/parallel_download_job.h
+++ b/content/browser/download/parallel_download_job.h
@@ -39,18 +39,24 @@ class CONTENT_EXPORT ParallelDownloadJob : public DownloadJobImpl,
// Virtual for testing.
virtual int GetParallelRequestCount() const;
- private:
- friend class ParallelDownloadJobTest;
-
using WorkerMap =
std::unordered_map<int64_t, std::unique_ptr<DownloadWorker>>;
+ // Map from the offset position of the slice to the worker that downloads the
+ // slice.
+ WorkerMap workers_;
+
+ private:
+ friend class ParallelDownloadJobTest;
+
// DownloadWorker::Delegate implementation.
void OnByteStreamReady(
DownloadWorker* worker,
std::unique_ptr<ByteStreamReader> stream_reader) override;
void OnServerResponseError(DownloadWorker* worker,
DownloadInterruptReason reason) override;
+ bool IsPaused() const override;
qinmin 2017/03/22 05:50:29 nit: worker can remember whether pause() is called
xingliu 2017/03/22 23:54:06 We may pause/cancel before the worker is construct
qinmin 2017/03/24 19:52:58 wait, if we pause/cancel before worker is construc
+ bool IsCanceled() const override;
// Build parallel requests after a delay, to effectively measure the single
// stream bandwidth.
@@ -74,10 +80,6 @@ class CONTENT_EXPORT ParallelDownloadJob : public DownloadJobImpl,
// the size of the target file if the request starts from non-zero offset.
int64_t content_length_;
- // Map from the offset position of the slice to the worker that downloads the
- // slice.
- WorkerMap workers_;
-
// Used to send parallel requests after a delay based on Finch config.
base::OneShotTimer timer_;

Powered by Google App Engine
This is Rietveld 408576698