Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_CONTEXT_H_ | |
| 6 #define CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_CONTEXT_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "base/memory/ref_counted.h" | |
| 10 | |
| 11 namespace content { | |
| 12 | |
| 13 class BrowserContext; | |
| 14 class ServiceWorkerContextWrapper; | |
| 15 | |
| 16 // The BackgroundFetchContext is the central moderator of ongoing background | |
| 17 // fetch requests from the Mojo service and from other callers. | |
| 18 // Background Fetch requests function similar to normal fetches except that | |
| 19 // they are persistent across Chromium or service worker shutdown. | |
| 20 class BackgroundFetchContext | |
| 21 : public base::RefCountedThreadSafe<BackgroundFetchContext> { | |
| 22 public: | |
| 23 BackgroundFetchContext(BrowserContext* browser_context); | |
|
Peter Beverloo
2017/02/08 12:20:25
nit: explicit
harkness
2017/02/08 16:30:42
Done.
| |
| 24 | |
| 25 // Init and Shutdown are for use on the UI thread when the StoragePartition is | |
| 26 // being setup and torn down. The BackgroundFetchContext will watch the | |
| 27 // ServiceWorkerContextWrapper so that it can respond to service worker events | |
| 28 // such as unregister. | |
| 29 void Init(const scoped_refptr<ServiceWorkerContextWrapper>& context); | |
| 30 | |
| 31 // Shutdown must be called before deleting this. Call on the UI thread. | |
| 32 void Shutdown(); | |
| 33 | |
| 34 protected: | |
| 35 friend class base::RefCountedThreadSafe<BackgroundFetchContext>; | |
| 36 virtual ~BackgroundFetchContext(); | |
| 37 | |
| 38 private: | |
| 39 BrowserContext* browser_context_; | |
| 40 | |
| 41 DISALLOW_COPY_AND_ASSIGN(BackgroundFetchContext); | |
| 42 }; | |
| 43 | |
| 44 } // namespace content | |
| 45 | |
| 46 #endif // CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_CONTEXT_H_ | |
| OLD | NEW |