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

Side by Side 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 unified diff | Download patch
OLDNEW
(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 #include <vector>
Peter Beverloo 2017/02/24 02:05:15 IWYU: <string>
harkness 2017/02/24 11:47:10 Done.
10
11 #include "content/browser/background_fetch/background_fetch_data_manager.h"
12 #include "content/browser/background_fetch/fetch_request.h"
13 #include "content/common/content_export.h"
14
15 namespace content {
16
17 class BrowserContext;
18 class StoragePartition;
19
20 // The BatchManager will be responsible for coordinating communication with the
21 // 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
22 // the DownloadManager.
23 // TODO(harkness): The BatchManager should also observe downloads.
24 class CONTENT_EXPORT BackgroundFetchBatchManager {
25 public:
26 BackgroundFetchBatchManager(BrowserContext* browser_context,
27 StoragePartition* storage_partition);
28 ~BackgroundFetchBatchManager();
29
30 // Start processing on a batch of requests. Some of these may already be in
31 // progress or completed from a previous chromium instance.
32 void ProcessBatch(const std::string& batch_guid,
33 BackgroundFetchDataManager::BatchData* batch_data);
34
35 private:
36 void ProcessRequest(const std::string& batch_guid,
37 const FetchRequest& request);
38
39 // Pointer to the browser context. The BackgroundFetchBatchManager is owned by
40 // the BrowserContext via the StoragePartition.
41 BrowserContext* browser_context_;
42
43 // Pointer to the storage partition. This object is owned by the partition
44 // (through a sequence of other classes).
45 StoragePartition* storage_partition_;
46
47 // The fetch_map holds any requests which have been sent to the
48 // DownloadManager indexed by the batch_guid.
49 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
50
51 DISALLOW_COPY_AND_ASSIGN(BackgroundFetchBatchManager);
52 };
53
54 } // namespace content
55
56 #endif // CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_BATCH_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698