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

Side by Side Diff: content/browser/service_worker/service_worker_context_wrapper.h

Issue 2166523003: Add ref count to service workers for extension API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: send increment/decrement request from renderer/ process Created 4 years, 3 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 const GURL& url, 105 const GURL& url,
106 const GURL& other_url, 106 const GURL& other_url,
107 const CheckHasServiceWorkerCallback& callback) override; 107 const CheckHasServiceWorkerCallback& callback) override;
108 void StopAllServiceWorkersForOrigin(const GURL& origin) override; 108 void StopAllServiceWorkersForOrigin(const GURL& origin) override;
109 void ClearAllServiceWorkersForTest(const base::Closure& callback) override; 109 void ClearAllServiceWorkersForTest(const base::Closure& callback) override;
110 void StartServiceWorkerForNavigationHint( 110 void StartServiceWorkerForNavigationHint(
111 const GURL& document_url, 111 const GURL& document_url,
112 blink::WebNavigationHintType type, 112 blink::WebNavigationHintType type,
113 int render_process_id, 113 int render_process_id,
114 const ResultCallback& callback) override; 114 const ResultCallback& callback) override;
115 bool IncrementPendingActivity(int64_t service_worker_version_id) override;
116 bool DecrementPendingActivity(int64_t service_worker_version_id) override;
115 117
116 // These methods must only be called from the IO thread. 118 // These methods must only be called from the IO thread.
117 ServiceWorkerRegistration* GetLiveRegistration(int64_t registration_id); 119 ServiceWorkerRegistration* GetLiveRegistration(int64_t registration_id);
118 ServiceWorkerVersion* GetLiveVersion(int64_t version_id); 120 ServiceWorkerVersion* GetLiveVersion(int64_t version_id);
119 std::vector<ServiceWorkerRegistrationInfo> GetAllLiveRegistrationInfo(); 121 std::vector<ServiceWorkerRegistrationInfo> GetAllLiveRegistrationInfo();
120 std::vector<ServiceWorkerVersionInfo> GetAllLiveVersionInfo(); 122 std::vector<ServiceWorkerVersionInfo> GetAllLiveVersionInfo();
121 123
122 // Must be called from the IO thread. 124 // Must be called from the IO thread.
123 void HasMainFrameProviderHost(const GURL& origin, 125 void HasMainFrameProviderHost(const GURL& origin,
124 const BoolCallback& callback) const; 126 const BoolCallback& callback) const;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 bool OriginHasForeignFetchRegistrations(const GURL& origin); 191 bool OriginHasForeignFetchRegistrations(const GURL& origin);
190 192
191 // Must be called from the UI thread. 193 // Must be called from the UI thread.
192 bool IsRunningNavigationHintTask(int render_process_id) const; 194 bool IsRunningNavigationHintTask(int render_process_id) const;
193 195
194 private: 196 private:
195 friend class BackgroundSyncManagerTest; 197 friend class BackgroundSyncManagerTest;
196 friend class base::RefCountedThreadSafe<ServiceWorkerContextWrapper>; 198 friend class base::RefCountedThreadSafe<ServiceWorkerContextWrapper>;
197 friend class EmbeddedWorkerTestHelper; 199 friend class EmbeddedWorkerTestHelper;
198 friend class EmbeddedWorkerBrowserTest; 200 friend class EmbeddedWorkerBrowserTest;
201 friend class ServiceWorkerContext;
199 friend class ServiceWorkerDispatcherHost; 202 friend class ServiceWorkerDispatcherHost;
200 friend class ServiceWorkerInternalsUI; 203 friend class ServiceWorkerInternalsUI;
201 friend class ServiceWorkerNavigationHandleCore; 204 friend class ServiceWorkerNavigationHandleCore;
202 friend class ServiceWorkerProcessManager; 205 friend class ServiceWorkerProcessManager;
203 friend class ServiceWorkerRequestHandler; 206 friend class ServiceWorkerRequestHandler;
204 friend class ServiceWorkerVersionBrowserTest; 207 friend class ServiceWorkerVersionBrowserTest;
205 friend class MockServiceWorkerContextWrapper; 208 friend class MockServiceWorkerContextWrapper;
206 209
207 ~ServiceWorkerContextWrapper() override; 210 ~ServiceWorkerContextWrapper() override;
208 211
212 bool IncrementPendingActivityOnIO(int64_t service_worker_version_id);
213 bool DecrementPendingActivityOnIO(int64_t service_worker_version_id);
214
209 void InitInternal( 215 void InitInternal(
210 const base::FilePath& user_data_directory, 216 const base::FilePath& user_data_directory,
211 std::unique_ptr<ServiceWorkerDatabaseTaskManager> database_task_manager, 217 std::unique_ptr<ServiceWorkerDatabaseTaskManager> database_task_manager,
212 const scoped_refptr<base::SingleThreadTaskRunner>& disk_cache_thread, 218 const scoped_refptr<base::SingleThreadTaskRunner>& disk_cache_thread,
213 storage::QuotaManagerProxy* quota_manager_proxy, 219 storage::QuotaManagerProxy* quota_manager_proxy,
214 storage::SpecialStoragePolicy* special_storage_policy); 220 storage::SpecialStoragePolicy* special_storage_policy);
215 void ShutdownOnIO(); 221 void ShutdownOnIO();
216 222
217 void DidFindRegistrationForFindReady( 223 void DidFindRegistrationForFindReady(
218 const FindRegistrationCallback& callback, 224 const FindRegistrationCallback& callback,
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 278
273 // Raw pointer to the StoragePartitionImpl owning |this|. 279 // Raw pointer to the StoragePartitionImpl owning |this|.
274 StoragePartitionImpl* storage_partition_; 280 StoragePartitionImpl* storage_partition_;
275 281
276 // The ResourceContext associated with this context. 282 // The ResourceContext associated with this context.
277 ResourceContext* resource_context_; 283 ResourceContext* resource_context_;
278 284
279 // Must be touched on the UI thread. 285 // Must be touched on the UI thread.
280 std::map<int, int> navigation_hint_task_count_per_process_; 286 std::map<int, int> navigation_hint_task_count_per_process_;
281 287
288 // Maps service worker version id -> set of pending request ids.
289 // IO thread.
290 std::map<int64_t, std::set<int>> pending_external_requests_;
291
282 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextWrapper); 292 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextWrapper);
283 }; 293 };
284 294
285 } // namespace content 295 } // namespace content
286 296
287 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ 297 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698