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 |
new file mode 100644 |
index 0000000000000000000000000000000000000000..13629aaaceb77f6be44573737e21b5e9d87064eb |
--- /dev/null |
+++ b/content/browser/background_fetch/background_fetch_context.h |
@@ -0,0 +1,46 @@ |
+// Copyright 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_CONTEXT_H_ |
+#define CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_CONTEXT_H_ |
+ |
+#include "base/macros.h" |
+#include "base/memory/ref_counted.h" |
+ |
+namespace content { |
+ |
+class BrowserContext; |
+class ServiceWorkerContextWrapper; |
+ |
+// The BackgroundFetchContext is the central moderator of ongoing background |
+// fetch requests from the Mojo service and from other callers. |
+// Background Fetch requests function similar to normal fetches except that |
+// they are persistent across Chromium or service worker shutdown. |
+class BackgroundFetchContext |
+ : public base::RefCountedThreadSafe<BackgroundFetchContext> { |
+ public: |
+ BackgroundFetchContext(BrowserContext* browser_context); |
Peter Beverloo
2017/02/08 12:20:25
nit: explicit
harkness
2017/02/08 16:30:42
Done.
|
+ |
+ // Init and Shutdown are for use on the UI thread when the StoragePartition is |
+ // being setup and torn down. The BackgroundFetchContext will watch the |
+ // ServiceWorkerContextWrapper so that it can respond to service worker events |
+ // such as unregister. |
+ void Init(const scoped_refptr<ServiceWorkerContextWrapper>& context); |
+ |
+ // Shutdown must be called before deleting this. Call on the UI thread. |
+ void Shutdown(); |
+ |
+ protected: |
+ friend class base::RefCountedThreadSafe<BackgroundFetchContext>; |
+ virtual ~BackgroundFetchContext(); |
+ |
+ private: |
+ BrowserContext* browser_context_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(BackgroundFetchContext); |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_CONTEXT_H_ |