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

Unified Diff: content/browser/background_fetch/background_fetch_batch_manager.h

Issue 2708943002: Create the BackgroundFetchBatchManager and initiate a download. (Closed)
Patch Set: Created 3 years, 10 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/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_

Powered by Google App Engine
This is Rietveld 408576698