| OLD | NEW |
| 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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 void UpdateRegistration(const GURL& pattern); | 220 void UpdateRegistration(const GURL& pattern); |
| 221 void SetForceUpdateOnPageLoad(bool force_update_on_page_load); | 221 void SetForceUpdateOnPageLoad(bool force_update_on_page_load); |
| 222 void AddObserver(ServiceWorkerContextObserver* observer); | 222 void AddObserver(ServiceWorkerContextObserver* observer); |
| 223 void RemoveObserver(ServiceWorkerContextObserver* observer); | 223 void RemoveObserver(ServiceWorkerContextObserver* observer); |
| 224 | 224 |
| 225 bool is_incognito() const { return is_incognito_; } | 225 bool is_incognito() const { return is_incognito_; } |
| 226 | 226 |
| 227 // Must be called from the IO thread. | 227 // Must be called from the IO thread. |
| 228 bool OriginHasForeignFetchRegistrations(const GURL& origin); | 228 bool OriginHasForeignFetchRegistrations(const GURL& origin); |
| 229 | 229 |
| 230 // Must be called from the UI thread. | |
| 231 bool IsRunningNavigationHintTask(int render_process_id) const; | |
| 232 | |
| 233 private: | 230 private: |
| 234 friend class BackgroundSyncManagerTest; | 231 friend class BackgroundSyncManagerTest; |
| 235 friend class base::RefCountedThreadSafe<ServiceWorkerContextWrapper>; | 232 friend class base::RefCountedThreadSafe<ServiceWorkerContextWrapper>; |
| 236 friend class EmbeddedWorkerTestHelper; | 233 friend class EmbeddedWorkerTestHelper; |
| 237 friend class EmbeddedWorkerBrowserTest; | 234 friend class EmbeddedWorkerBrowserTest; |
| 238 friend class ForeignFetchRequestHandler; | 235 friend class ForeignFetchRequestHandler; |
| 239 friend class ServiceWorkerDispatcherHost; | 236 friend class ServiceWorkerDispatcherHost; |
| 240 friend class ServiceWorkerInternalsUI; | 237 friend class ServiceWorkerInternalsUI; |
| 241 friend class ServiceWorkerNavigationHandleCore; | 238 friend class ServiceWorkerNavigationHandleCore; |
| 242 friend class ServiceWorkerProcessManager; | 239 friend class ServiceWorkerProcessManager; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 blink::WebNavigationHintType type, | 282 blink::WebNavigationHintType type, |
| 286 int render_process_id, | 283 int render_process_id, |
| 287 const ResultCallback& callback, | 284 const ResultCallback& callback, |
| 288 ServiceWorkerStatusCode status, | 285 ServiceWorkerStatusCode status, |
| 289 scoped_refptr<ServiceWorkerRegistration> registration); | 286 scoped_refptr<ServiceWorkerRegistration> registration); |
| 290 | 287 |
| 291 void DidStartServiceWorkerForNavigationHint(const GURL& pattern, | 288 void DidStartServiceWorkerForNavigationHint(const GURL& pattern, |
| 292 int render_process_id, | 289 int render_process_id, |
| 293 const ResultCallback& callback, | 290 const ResultCallback& callback, |
| 294 ServiceWorkerStatusCode code); | 291 ServiceWorkerStatusCode code); |
| 295 void DidFinishNavigationHintTaskOnUI(int render_process_id, | |
| 296 const ResultCallback& callback, | |
| 297 bool result); | |
| 298 | 292 |
| 299 // The core context is only for use on the IO thread. | 293 // The core context is only for use on the IO thread. |
| 300 // Can be null before/during init, during/after shutdown, and after | 294 // Can be null before/during init, during/after shutdown, and after |
| 301 // DeleteAndStartOver fails. | 295 // DeleteAndStartOver fails. |
| 302 ServiceWorkerContextCore* context(); | 296 ServiceWorkerContextCore* context(); |
| 303 | 297 |
| 304 const scoped_refptr<base::ObserverListThreadSafe< | 298 const scoped_refptr<base::ObserverListThreadSafe< |
| 305 ServiceWorkerContextObserver>> observer_list_; | 299 ServiceWorkerContextObserver>> observer_list_; |
| 306 const std::unique_ptr<ServiceWorkerProcessManager> process_manager_; | 300 const std::unique_ptr<ServiceWorkerProcessManager> process_manager_; |
| 307 // Cleared in ShutdownOnIO(): | 301 // Cleared in ShutdownOnIO(): |
| 308 std::unique_ptr<ServiceWorkerContextCore> context_core_; | 302 std::unique_ptr<ServiceWorkerContextCore> context_core_; |
| 309 | 303 |
| 310 // Initialized in Init(); true if the user data directory is empty. | 304 // Initialized in Init(); true if the user data directory is empty. |
| 311 bool is_incognito_; | 305 bool is_incognito_; |
| 312 | 306 |
| 313 // Raw pointer to the StoragePartitionImpl owning |this|. | 307 // Raw pointer to the StoragePartitionImpl owning |this|. |
| 314 StoragePartitionImpl* storage_partition_; | 308 StoragePartitionImpl* storage_partition_; |
| 315 | 309 |
| 316 // The ResourceContext associated with this context. | 310 // The ResourceContext associated with this context. |
| 317 ResourceContext* resource_context_; | 311 ResourceContext* resource_context_; |
| 318 | 312 |
| 319 // Must be touched on the UI thread. | |
| 320 std::map<int, int> navigation_hint_task_count_per_process_; | |
| 321 | |
| 322 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextWrapper); | 313 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextWrapper); |
| 323 }; | 314 }; |
| 324 | 315 |
| 325 } // namespace content | 316 } // namespace content |
| 326 | 317 |
| 327 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ | 318 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ |
| OLD | NEW |