Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_BATCH_MANAGER_H_ | |
| 6 #define CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_BATCH_MANAGER_H_ | |
| 7 | |
| 8 #include <unordered_map> | |
| 9 | |
| 10 #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.
| |
| 11 #include "content/common/content_export.h" | |
| 12 | |
| 13 namespace content { | |
| 14 | |
| 15 class BrowserContext; | |
| 16 class StoragePartition; | |
| 17 | |
| 18 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.
| |
| 19 public: | |
| 20 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.
| |
| 21 StoragePartition* storage_partition); | |
| 22 ~BackgroundFetchBatchManager(); | |
| 23 | |
| 24 // Start processing on a batch of requests. Some of these may already be in | |
| 25 // progress or completed from a previous chromium instance. | |
| 26 void ProcessBatch(const std::string& batch_uid, | |
| 27 const std::vector<FetchRequest>& requests); | |
| 28 | |
| 29 private: | |
| 30 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.
| |
| 31 const FetchRequest& request); | |
| 32 | |
| 33 // Pointer to the browser context. The BackgroundFetchBatchManager is owned by | |
| 34 // the BrowserContext via the StoragePartition. | |
| 35 BrowserContext* browser_context_; | |
| 36 | |
| 37 // Pointer to the storage partition. This object is owned by the partition | |
| 38 // (through a sequence of other classes). | |
| 39 StoragePartition* storage_partition_; | |
| 40 | |
| 41 // The fetch_map holds any requests which have been sent to the | |
| 42 // DownloadManager indexed by the batch_uid. | |
| 43 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
| |
| 44 }; | |
|
Peter Beverloo
2017/02/23 12:14:56
DISALLOW_COPY_AND_ASSIGN()
harkness
2017/02/23 17:08:41
Done.
| |
| 45 | |
| 46 } // namespace content | |
| 47 | |
| 48 #endif // CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_BATCH_MANAGER_H_ | |
| OLD | NEW |