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

Side by Side Diff: content/browser/background_fetch/background_fetch_data_manager.h

Issue 2678273003: Initial framework setup and skeleton for BackgroundFetchContext (Closed)
Patch Set: Remove observations for service worker context wrapper 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_DATA_MANAGER_H_
6 #define CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_DATA_MANAGER_H_
7
8 #include <map>
9 #include <string>
10
11 #include "base/macros.h"
12 #include "content/browser/background_fetch/fetch_request.h"
13 #include "content/common/content_export.h"
14 #include "url/origin.h"
15
16 namespace content {
17
18 class BackgroundFetchContext;
19
20 // The BackgroundFetchDataManager keeps track of all of the outstanding requests
21 // which are in process in the DownloadManager. When Chromium restarts, it is
22 // responsibile for reconnecting all the in progress downloads with an observer
23 // which will keep the metadata up to date.
24 class CONTENT_EXPORT BackgroundFetchDataManager {
25 public:
26 explicit BackgroundFetchDataManager(
27 BackgroundFetchContext* background_fetch_context);
28 ~BackgroundFetchDataManager();
29
30 // Called by BackgroundFetchContext when a new request is started, this will
31 // store all of the necessary metadata to track the request.
32 void CreateRequest(const FetchRequest& fetch_request);
33
34 private:
35 // BackgroundFetchContext contains a BackgroundFetchDataManager, so the
Peter Beverloo 2017/02/14 15:05:52 contains a -> owns this
harkness 2017/02/15 13:48:44 Done.
36 // DataManager is guaranteed to be destructed before the Context.
37 BackgroundFetchContext* background_fetch_context_;
38
39 // Map from <sw_registration_id, tag> to the FetchRequest for that tag.
40 using FetchIdentifier = std::pair<int64_t, std::string>;
41 std::map<FetchIdentifier, FetchRequest> fetch_map_;
42
43 DISALLOW_COPY_AND_ASSIGN(BackgroundFetchDataManager);
44 };
45
46 } // namespace content
47
48 #endif // CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_DATA_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698