Index: content/browser/background_fetch/background_fetch_context.h |
diff --git a/content/browser/background_fetch/background_fetch_context.h b/content/browser/background_fetch/background_fetch_context.h |
index 8626bec6963bc7e60e11a171f9d89b8390ad97df..b2c0579ab1f47799ec929d59130a1912f5b2cdd9 100644 |
--- a/content/browser/background_fetch/background_fetch_context.h |
+++ b/content/browser/background_fetch/background_fetch_context.h |
@@ -5,11 +5,14 @@ |
#ifndef CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_CONTEXT_H_ |
#define CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_CONTEXT_H_ |
+#include <unordered_map> |
+ |
#include "base/macros.h" |
#include "base/memory/ref_counted.h" |
#include "content/browser/background_fetch/background_fetch_data_manager.h" |
#include "content/browser/background_fetch/background_fetch_job_controller.h" |
#include "content/common/content_export.h" |
+#include "content/public/browser/browser_thread.h" |
namespace content { |
@@ -23,7 +26,8 @@ class ServiceWorkerContextWrapper; |
// Background Fetch requests function similar to normal fetches except that |
// they are persistent across Chromium or service worker shutdown. |
class CONTENT_EXPORT BackgroundFetchContext |
- : public base::RefCountedThreadSafe<BackgroundFetchContext> { |
+ : public base::RefCountedThreadSafe<BackgroundFetchContext, |
+ BrowserThread::DeleteOnUIThread> { |
public: |
// The BackgroundFetchContext will watch the ServiceWorkerContextWrapper so |
// that it can respond to service worker events such as unregister. |
@@ -44,16 +48,28 @@ class CONTENT_EXPORT BackgroundFetchContext |
} |
private: |
+ friend class base::DeleteHelper<BackgroundFetchContext>; |
+ friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; |
+ friend class base::RefCountedThreadSafe<BackgroundFetchContext, |
+ BrowserThread::DeleteOnUIThread>; |
+ |
+ virtual ~BackgroundFetchContext(); |
+ |
void CreateRequest(const BackgroundFetchJobInfo& job_info, |
std::vector<BackgroundFetchRequestInfo>& request_infos); |
- friend class base::RefCountedThreadSafe<BackgroundFetchContext>; |
- ~BackgroundFetchContext(); |
+ void ShutdownOnIO(); |
+ |
+ // |this| is owned by the BrowserContext via the StoragePartition. |
+ BrowserContext* browser_context_; |
+ StoragePartition* storage_partition_; |
scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_; |
- BackgroundFetchJobController background_fetch_job_controller_; |
BackgroundFetchDataManager background_fetch_data_manager_; |
+ std::unordered_map<std::string, std::unique_ptr<BackgroundFetchJobController>> |
+ job_map_; |
+ |
DISALLOW_COPY_AND_ASSIGN(BackgroundFetchContext); |
}; |