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

Unified Diff: content/browser/background_fetch/background_fetch_context.h

Issue 2724783002: Make the BackgroundFetchJobController a per-job object (Closed)
Patch Set: ACTUALLY fix the compile error 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/background_fetch/background_fetch_context.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
};
« no previous file with comments | « no previous file | content/browser/background_fetch/background_fetch_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698