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

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

Issue 2708943002: Create the BackgroundFetchBatchManager and initiate a download. (Closed)
Patch Set: Integrated code review comments and added BackgroundFetchDataManager::BatchData which feeds FetchRe… 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..9a4c790fec122f941625e53598811f074adb2a54
--- /dev/null
+++ b/content/browser/background_fetch/background_fetch_batch_manager.h
@@ -0,0 +1,56 @@
+// 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 <vector>
Peter Beverloo 2017/02/24 02:05:15 IWYU: <string>
harkness 2017/02/24 11:47:10 Done.
+
+#include "content/browser/background_fetch/background_fetch_data_manager.h"
+#include "content/browser/background_fetch/fetch_request.h"
+#include "content/common/content_export.h"
+
+namespace content {
+
+class BrowserContext;
+class StoragePartition;
+
+// The BatchManager will be responsible for coordinating communication with the
+// DownloadManager. It will get requests from the BatchData and dispatch them to
Peter Beverloo 2017/02/24 02:05:15 from the -> as a?
harkness 2017/02/24 11:47:10 It queries the BatchData for the next requests, so
+// the DownloadManager.
+// TODO(harkness): The BatchManager should also observe downloads.
+class CONTENT_EXPORT BackgroundFetchBatchManager {
+ public:
+ BackgroundFetchBatchManager(BrowserContext* browser_context,
+ 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_guid,
+ BackgroundFetchDataManager::BatchData* batch_data);
+
+ private:
+ void ProcessRequest(const std::string& batch_guid,
+ 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_guid.
+ std::unordered_map<std::string, FetchRequest> fetch_map_;
Peter Beverloo 2017/02/24 02:05:15 In the longer term, are we going to have to hold o
harkness 2017/02/24 11:47:10 I think we'll probably want to hold onto it, to ha
+
+ DISALLOW_COPY_AND_ASSIGN(BackgroundFetchBatchManager);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_BATCH_MANAGER_H_

Powered by Google App Engine
This is Rietveld 408576698