OLD | NEW |
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_JOB_DATA_H_ | 5 #ifndef CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_JOB_DATA_H_ |
6 #define CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_JOB_DATA_H_ | 6 #define CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_JOB_DATA_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <unordered_map> | 9 #include <unordered_map> |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 // Called by the JobController to get a BackgroundFetchRequestInfo to | 31 // Called by the JobController to get a BackgroundFetchRequestInfo to |
32 // process. | 32 // process. |
33 const BackgroundFetchRequestInfo& GetNextBackgroundFetchRequestInfo(); | 33 const BackgroundFetchRequestInfo& GetNextBackgroundFetchRequestInfo(); |
34 | 34 |
35 // Indicates whether all requests have been handed to the JobController. | 35 // Indicates whether all requests have been handed to the JobController. |
36 bool HasRequestsRemaining() const; | 36 bool HasRequestsRemaining() const; |
37 | 37 |
38 // Indicates whether all requests have been handed out and completed. | 38 // Indicates whether all requests have been handed out and completed. |
39 bool IsComplete() const; | 39 bool IsComplete() const; |
40 | 40 |
| 41 // Inform the JobData of the GUID the DownloadManager assigned to this |
| 42 // request. |
| 43 void SetRequestDownloadGuid(const std::string& request_guid, |
| 44 const std::string& download_guid); |
| 45 |
41 private: | 46 private: |
42 BackgroundFetchRequestInfos& request_infos_; | 47 BackgroundFetchRequestInfos& request_infos_; |
43 | 48 |
44 // Map from fetch_guid to index in request_infos_. Only currently | 49 // Map from fetch_guid to index in request_infos_. Only currently |
45 // outstanding requests should be in this map. | 50 // outstanding requests should be in this map. |
46 std::unordered_map<std::string, int> request_info_index_; | 51 std::unordered_map<std::string, int> request_info_index_; |
47 size_t next_request_info_ = 0; | 52 size_t next_request_info_ = 0; |
48 | 53 |
49 DISALLOW_COPY_AND_ASSIGN(BackgroundFetchJobData); | 54 DISALLOW_COPY_AND_ASSIGN(BackgroundFetchJobData); |
50 }; | 55 }; |
51 | 56 |
52 } // namespace content | 57 } // namespace content |
53 | 58 |
54 #endif // CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_JOB_DATA_H_ | 59 #endif // CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_JOB_DATA_H_ |
OLD | NEW |