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

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

Issue 2774263003: Added ServiceWorkerResponses to GetJobResponse callback (Closed)
Patch Set: Rebase to pull in BackgroundFetchRegistrationId patch Created 3 years, 9 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
1 // Copyright 2017 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_DATA_MANAGER_H_ 5 #ifndef CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_DATA_MANAGER_H_
6 #define CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_DATA_MANAGER_H_ 6 #define CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_DATA_MANAGER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 #include <unordered_map> 11 #include <unordered_map>
12 12
13 #include "base/callback_forward.h" 13 #include "base/callback_forward.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "content/browser/background_fetch/background_fetch_job_info.h" 15 #include "content/browser/background_fetch/background_fetch_job_info.h"
16 #include "content/browser/background_fetch/background_fetch_job_response_data.h" 16 #include "content/browser/background_fetch/background_fetch_job_response_data.h"
17 #include "content/browser/background_fetch/background_fetch_registration_id.h" 17 #include "content/browser/background_fetch/background_fetch_registration_id.h"
18 #include "content/browser/background_fetch/background_fetch_request_info.h" 18 #include "content/browser/background_fetch/background_fetch_request_info.h"
19 #include "content/common/content_export.h" 19 #include "content/common/content_export.h"
20 #include "url/origin.h" 20 #include "url/origin.h"
21 21
22 namespace content { 22 namespace content {
23 23
24 class BrowserContext; 24 class BrowserContext;
25 class BlobHandle; 25 class ChromeBlobStorageContext;
26 26
27 // The BackgroundFetchDataManager keeps track of all of the outstanding requests 27 // The BackgroundFetchDataManager keeps track of all of the outstanding requests
28 // which are in process in the DownloadManager. When Chromium restarts, it is 28 // which are in process in the DownloadManager. When Chromium restarts, it is
29 // responsibile for reconnecting all the in progress downloads with an observer 29 // responsibile for reconnecting all the in progress downloads with an observer
30 // which will keep the metadata up to date. 30 // which will keep the metadata up to date.
31 class CONTENT_EXPORT BackgroundFetchDataManager { 31 class CONTENT_EXPORT BackgroundFetchDataManager {
32 public: 32 public:
33 explicit BackgroundFetchDataManager(BrowserContext* browser_context); 33 explicit BackgroundFetchDataManager(BrowserContext* browser_context);
34 ~BackgroundFetchDataManager(); 34 ~BackgroundFetchDataManager();
35 35
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 private: 72 private:
73 // Storage interface. 73 // Storage interface.
74 void WriteJobToStorage(std::unique_ptr<BackgroundFetchJobInfo> job_info, 74 void WriteJobToStorage(std::unique_ptr<BackgroundFetchJobInfo> job_info,
75 BackgroundFetchRequestInfos request_infos); 75 BackgroundFetchRequestInfos request_infos);
76 void WriteRequestToStorage(const std::string& job_guid, 76 void WriteRequestToStorage(const std::string& job_guid,
77 BackgroundFetchRequestInfo* request_info); 77 BackgroundFetchRequestInfo* request_info);
78 std::unique_ptr<BackgroundFetchRequestInfo> GetRequestInfo( 78 std::unique_ptr<BackgroundFetchRequestInfo> GetRequestInfo(
79 const std::string& job_guid, 79 const std::string& job_guid,
80 size_t request_index); 80 size_t request_index);
81 81
82 void DidGetRequestResponse(const std::string& job_guid, 82 void DidGetBlobStorageContext(
83 int request_sequence_number, 83 const std::string& job_guid,
84 std::unique_ptr<BlobHandle> blob_handle); 84 const BackgroundFetchResponseCompleteCallback& callback,
85 ChromeBlobStorageContext* blob_context);
85 86
86 // Indirectly, this is owned by the BrowserContext. 87 // Indirectly, this is owned by the BrowserContext.
87 BrowserContext* browser_context_; 88 BrowserContext* browser_context_;
88 89
89 // Set of known background fetch registration ids. 90 // Set of known background fetch registration ids.
90 std::set<BackgroundFetchRegistrationId> known_registrations_; 91 std::set<BackgroundFetchRegistrationId> known_registrations_;
91 92
92 // Map from job_guid to JobInfo. 93 // Map from job_guid to JobInfo.
93 std::unordered_map<std::string, std::unique_ptr<BackgroundFetchJobInfo>> 94 std::unordered_map<std::string, std::unique_ptr<BackgroundFetchJobInfo>>
94 job_map_; 95 job_map_;
95 96
96 // Temporary map to hold data which will be written to storage. 97 // Temporary map to hold data which will be written to storage.
97 // Map from job_guid to RequestInfos. 98 // Map from job_guid to RequestInfos.
98 std::unordered_map<std::string, std::vector<BackgroundFetchRequestInfo>> 99 std::unordered_map<std::string, std::vector<BackgroundFetchRequestInfo>>
99 request_map_; 100 request_map_;
100 101
101 base::WeakPtrFactory<BackgroundFetchDataManager> weak_ptr_factory_; 102 base::WeakPtrFactory<BackgroundFetchDataManager> weak_ptr_factory_;
102 103
103 DISALLOW_COPY_AND_ASSIGN(BackgroundFetchDataManager); 104 DISALLOW_COPY_AND_ASSIGN(BackgroundFetchDataManager);
104 }; 105 };
105 106
106 } // namespace content 107 } // namespace content
107 108
108 #endif // CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_DATA_MANAGER_H_ 109 #endif // CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_DATA_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698