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_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_ | |
| OLD | NEW |