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

Side by Side Diff: content/browser/background_fetch/background_fetch_context.h

Issue 2806713002: Some minor fixes for Background Fetch (Closed)
Patch Set: Created 3 years, 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/background_fetch/background_fetch_context.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 class CONTENT_EXPORT BackgroundFetchContext 44 class CONTENT_EXPORT BackgroundFetchContext
45 : public base::RefCountedThreadSafe<BackgroundFetchContext, 45 : public base::RefCountedThreadSafe<BackgroundFetchContext,
46 BrowserThread::DeleteOnUIThread> { 46 BrowserThread::DeleteOnUIThread> {
47 public: 47 public:
48 // The BackgroundFetchContext will watch the ServiceWorkerContextWrapper so 48 // The BackgroundFetchContext will watch the ServiceWorkerContextWrapper so
49 // that it can respond to service worker events such as unregister. 49 // that it can respond to service worker events such as unregister.
50 BackgroundFetchContext(BrowserContext* browser_context, 50 BackgroundFetchContext(BrowserContext* browser_context,
51 StoragePartitionImpl* storage_partition, 51 StoragePartitionImpl* storage_partition,
52 scoped_refptr<ServiceWorkerContextWrapper> context); 52 scoped_refptr<ServiceWorkerContextWrapper> context);
53 53
54 // Finishes initializing the Background Fetch context on the IO thread by
55 // setting the |request_context_getter|.
56 void InitializeOnIOThread(
57 scoped_refptr<net::URLRequestContextGetter> request_context_getter);
58
54 // Shutdown must be called before deleting this. Call on the UI thread. 59 // Shutdown must be called before deleting this. Call on the UI thread.
55 void Shutdown(); 60 void Shutdown();
56 61
57 // Starts a Background Fetch for the |registration_id|. The |requests| will be 62 // Starts a Background Fetch for the |registration_id|. The |requests| will be
58 // asynchronously fetched. The |callback| will be invoked when the fetch has 63 // asynchronously fetched. The |callback| will be invoked when the fetch has
59 // been registered, or an error occurred that avoids it from doing so. 64 // been registered, or an error occurred that avoids it from doing so.
60 void StartFetch( 65 void StartFetch(
61 const BackgroundFetchRegistrationId& registration_id, 66 const BackgroundFetchRegistrationId& registration_id,
62 const std::vector<ServiceWorkerFetchRequest>& requests, 67 const std::vector<ServiceWorkerFetchRequest>& requests,
63 const BackgroundFetchOptions& options, 68 const BackgroundFetchOptions& options,
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 118
114 // Called when all processing for the |registration_id| has been finished and 119 // Called when all processing for the |registration_id| has been finished and
115 // the job, including its associated data, is ready to be deleted. 120 // the job, including its associated data, is ready to be deleted.
116 void DeleteRegistration( 121 void DeleteRegistration(
117 const BackgroundFetchRegistrationId& registration_id, 122 const BackgroundFetchRegistrationId& registration_id,
118 const std::vector<std::unique_ptr<BlobHandle>>& blob_handles); 123 const std::vector<std::unique_ptr<BlobHandle>>& blob_handles);
119 124
120 // |this| is owned, indirectly, by the BrowserContext. 125 // |this| is owned, indirectly, by the BrowserContext.
121 BrowserContext* browser_context_; 126 BrowserContext* browser_context_;
122 127
123 scoped_refptr<net::URLRequestContextGetter> request_context_; 128 scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
124 129
125 std::unique_ptr<BackgroundFetchDataManager> data_manager_; 130 std::unique_ptr<BackgroundFetchDataManager> data_manager_;
126 std::unique_ptr<BackgroundFetchEventDispatcher> event_dispatcher_; 131 std::unique_ptr<BackgroundFetchEventDispatcher> event_dispatcher_;
127 132
128 // Map of the Background Fetch fetches that are currently in-progress. 133 // Map of the Background Fetch fetches that are currently in-progress.
129 std::map<BackgroundFetchRegistrationId, 134 std::map<BackgroundFetchRegistrationId,
130 std::unique_ptr<BackgroundFetchJobController>> 135 std::unique_ptr<BackgroundFetchJobController>>
131 active_fetches_; 136 active_fetches_;
132 137
133 DISALLOW_COPY_AND_ASSIGN(BackgroundFetchContext); 138 DISALLOW_COPY_AND_ASSIGN(BackgroundFetchContext);
134 }; 139 };
135 140
136 } // namespace content 141 } // namespace content
137 142
138 #endif // CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_CONTEXT_H_ 143 #endif // CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_CONTEXT_H_
OLDNEW
« 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