Chromium Code Reviews| 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_CONTEXT_H_ | 5 #ifndef CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_CONTEXT_H_ |
| 6 #define CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_CONTEXT_H_ | 6 #define CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_CONTEXT_H_ |
| 7 | 7 |
| 8 #include <unordered_map> | |
| 9 | |
| 8 #include "base/macros.h" | 10 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 10 #include "content/browser/background_fetch/background_fetch_data_manager.h" | 12 #include "content/browser/background_fetch/background_fetch_data_manager.h" |
| 11 #include "content/browser/background_fetch/background_fetch_job_controller.h" | 13 #include "content/browser/background_fetch/background_fetch_job_controller.h" |
| 12 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
| 13 | 15 |
| 14 namespace content { | 16 namespace content { |
| 15 | 17 |
| 16 class BackgroundFetchJobInfo; | 18 class BackgroundFetchJobInfo; |
| 17 class BackgroundFetchRequestInfo; | 19 class BackgroundFetchRequestInfo; |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 40 void Shutdown(); | 42 void Shutdown(); |
| 41 | 43 |
| 42 BackgroundFetchDataManager* GetDataManagerForTesting() { | 44 BackgroundFetchDataManager* GetDataManagerForTesting() { |
| 43 return &background_fetch_data_manager_; | 45 return &background_fetch_data_manager_; |
| 44 } | 46 } |
| 45 | 47 |
| 46 private: | 48 private: |
| 47 void CreateRequest(const BackgroundFetchJobInfo& job_info, | 49 void CreateRequest(const BackgroundFetchJobInfo& job_info, |
| 48 std::vector<BackgroundFetchRequestInfo>& request_infos); | 50 std::vector<BackgroundFetchRequestInfo>& request_infos); |
| 49 | 51 |
| 52 void ShutdownOnIO(); | |
| 53 | |
| 50 friend class base::RefCountedThreadSafe<BackgroundFetchContext>; | 54 friend class base::RefCountedThreadSafe<BackgroundFetchContext>; |
| 51 ~BackgroundFetchContext(); | 55 ~BackgroundFetchContext(); |
| 52 | 56 |
| 57 // The Context is owned by the BrowserContext via the StoragePartition. | |
|
Peter Beverloo
2017/03/08 14:27:04
Maybe s/The Context/|this|/ to remove ambiguity be
harkness
2017/03/09 13:33:25
Good point! Done.
| |
| 58 BrowserContext* browser_context_; | |
| 59 StoragePartition* storage_partition_; | |
| 60 | |
| 53 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_; | 61 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_; |
| 54 BackgroundFetchJobController background_fetch_job_controller_; | |
| 55 BackgroundFetchDataManager background_fetch_data_manager_; | 62 BackgroundFetchDataManager background_fetch_data_manager_; |
| 56 | 63 |
| 64 std::unordered_map<std::string, std::unique_ptr<BackgroundFetchJobController>> | |
| 65 job_map_; | |
| 66 | |
| 57 DISALLOW_COPY_AND_ASSIGN(BackgroundFetchContext); | 67 DISALLOW_COPY_AND_ASSIGN(BackgroundFetchContext); |
| 58 }; | 68 }; |
| 59 | 69 |
| 60 } // namespace content | 70 } // namespace content |
| 61 | 71 |
| 62 #endif // CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_CONTEXT_H_ | 72 #endif // CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_CONTEXT_H_ |
| OLD | NEW |