Chromium Code Reviews| Index: content/browser/background_fetch/background_fetch_batch_manager.h |
| diff --git a/content/browser/background_fetch/background_fetch_batch_manager.h b/content/browser/background_fetch/background_fetch_batch_manager.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..7b02922e05252a88633a37c20958ce8924008ca7 |
| --- /dev/null |
| +++ b/content/browser/background_fetch/background_fetch_batch_manager.h |
| @@ -0,0 +1,48 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_BATCH_MANAGER_H_ |
| +#define CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_BATCH_MANAGER_H_ |
| + |
| +#include <unordered_map> |
| + |
| +#include "content/browser/background_fetch/fetch_request.h" |
|
Peter Beverloo
2017/02/23 12:14:55
...but you depend on them, so `git add` and re-upl
harkness
2017/02/23 17:08:41
Done.
|
| +#include "content/common/content_export.h" |
| + |
| +namespace content { |
| + |
| +class BrowserContext; |
| +class StoragePartition; |
| + |
| +class CONTENT_EXPORT BackgroundFetchBatchManager { |
|
Peter Beverloo
2017/02/23 12:14:56
nit: Please add a class-level comment. It'll be a
harkness
2017/02/23 17:08:41
Done.
|
| + public: |
| + BackgroundFetchBatchManager(BrowserContext* browser_context_, |
|
Peter Beverloo
2017/02/23 12:14:55
nit: s/browser_context_/browser_context/ (undersco
harkness
2017/02/23 17:08:41
Done.
|
| + StoragePartition* storage_partition); |
| + ~BackgroundFetchBatchManager(); |
| + |
| + // Start processing on a batch of requests. Some of these may already be in |
| + // progress or completed from a previous chromium instance. |
| + void ProcessBatch(const std::string& batch_uid, |
| + const std::vector<FetchRequest>& requests); |
| + |
| + private: |
| + void ProcessRequest(const std::string& batch_uid, |
|
Peter Beverloo
2017/02/23 12:14:55
nit: `uid` is singular
harkness
2017/02/23 17:08:41
Done.
|
| + const FetchRequest& request); |
| + |
| + // Pointer to the browser context. The BackgroundFetchBatchManager is owned by |
| + // the BrowserContext via the StoragePartition. |
| + BrowserContext* browser_context_; |
| + |
| + // Pointer to the storage partition. This object is owned by the partition |
| + // (through a sequence of other classes). |
| + StoragePartition* storage_partition_; |
| + |
| + // The fetch_map holds any requests which have been sent to the |
| + // DownloadManager indexed by the batch_uid. |
| + std::unordered_map<std::string, FetchRequest> fetch_map; |
|
Peter Beverloo
2017/02/23 12:14:55
nit: s/fetch_map/fetch_map_/ (members have undersc
Peter Beverloo
2017/02/23 12:14:55
This can end up making a lot of copies. Should Fet
harkness
2017/02/23 17:08:41
I'm using std::move now. Would you prefer unique_p
harkness
2017/02/23 17:08:41
Done.
Peter Beverloo
2017/02/24 02:05:15
FetchRequest has no move constructor, so it will b
|
| +}; |
|
Peter Beverloo
2017/02/23 12:14:56
DISALLOW_COPY_AND_ASSIGN()
harkness
2017/02/23 17:08:41
Done.
|
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_BATCH_MANAGER_H_ |