| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_SYNC_BACKGROUND_SYNC_MANAGER_H_ | 5 #ifndef CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_MANAGER_H_ |
| 6 #define CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_MANAGER_H_ | 6 #define CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_MANAGER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 // Given a HandleId |handle_id|, return a new handle for the same | 89 // Given a HandleId |handle_id|, return a new handle for the same |
| 90 // registration. | 90 // registration. |
| 91 scoped_ptr<BackgroundSyncRegistrationHandle> DuplicateRegistrationHandle( | 91 scoped_ptr<BackgroundSyncRegistrationHandle> DuplicateRegistrationHandle( |
| 92 BackgroundSyncRegistrationHandle::HandleId handle_id); | 92 BackgroundSyncRegistrationHandle::HandleId handle_id); |
| 93 | 93 |
| 94 // ServiceWorkerContextObserver overrides. | 94 // ServiceWorkerContextObserver overrides. |
| 95 void OnRegistrationDeleted(int64 registration_id, | 95 void OnRegistrationDeleted(int64 registration_id, |
| 96 const GURL& pattern) override; | 96 const GURL& pattern) override; |
| 97 void OnStorageWiped() override; | 97 void OnStorageWiped() override; |
| 98 | 98 |
| 99 BackgroundSyncNetworkObserver* GetNetworkObserverForTesting() { |
| 100 return network_observer_.get(); |
| 101 } |
| 102 |
| 99 protected: | 103 protected: |
| 100 // A registration might be referenced by the client longer than | 104 // A registration might be referenced by the client longer than |
| 101 // the BackgroundSyncManager needs to keep track of it (e.g., the event has | 105 // the BackgroundSyncManager needs to keep track of it (e.g., the event has |
| 102 // finished firing). The BackgroundSyncManager reference counts its | 106 // finished firing). The BackgroundSyncManager reference counts its |
| 103 // registrations internally and every BackgroundSyncRegistrationHandle has a | 107 // registrations internally and every BackgroundSyncRegistrationHandle has a |
| 104 // unique handle id which maps to a locally maintained (in | 108 // unique handle id which maps to a locally maintained (in |
| 105 // client_registration_ids_) scoped_refptr. | 109 // client_registration_ids_) scoped_refptr. |
| 106 class RefCountedRegistration; | 110 class RefCountedRegistration; |
| 107 | 111 |
| 108 explicit BackgroundSyncManager( | 112 explicit BackgroundSyncManager( |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 base::Closure MakeEmptyCompletion(); | 324 base::Closure MakeEmptyCompletion(); |
| 321 base::Closure MakeClosureCompletion(const base::Closure& callback); | 325 base::Closure MakeClosureCompletion(const base::Closure& callback); |
| 322 StatusAndRegistrationCallback MakeStatusAndRegistrationCompletion( | 326 StatusAndRegistrationCallback MakeStatusAndRegistrationCompletion( |
| 323 const StatusAndRegistrationCallback& callback); | 327 const StatusAndRegistrationCallback& callback); |
| 324 StatusAndRegistrationsCallback MakeStatusAndRegistrationsCompletion( | 328 StatusAndRegistrationsCallback MakeStatusAndRegistrationsCompletion( |
| 325 const StatusAndRegistrationsCallback& callback); | 329 const StatusAndRegistrationsCallback& callback); |
| 326 BackgroundSyncManager::StatusCallback MakeStatusCompletion( | 330 BackgroundSyncManager::StatusCallback MakeStatusCompletion( |
| 327 const StatusCallback& callback); | 331 const StatusCallback& callback); |
| 328 | 332 |
| 329 SWIdToRegistrationsMap active_registrations_; | 333 SWIdToRegistrationsMap active_registrations_; |
| 334 |
| 330 CacheStorageScheduler op_scheduler_; | 335 CacheStorageScheduler op_scheduler_; |
| 331 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_; | 336 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_; |
| 332 bool disabled_; | 337 bool disabled_; |
| 333 | 338 |
| 334 scoped_ptr<BackgroundSyncNetworkObserver> network_observer_; | 339 scoped_ptr<BackgroundSyncNetworkObserver> network_observer_; |
| 335 scoped_ptr<BackgroundSyncPowerObserver> power_observer_; | 340 scoped_ptr<BackgroundSyncPowerObserver> power_observer_; |
| 336 | 341 |
| 337 // The registrations that clients have handles to. | 342 // The registrations that clients have handles to. |
| 338 IDMap<scoped_refptr<RefCountedRegistration>, IDMapOwnPointer> | 343 IDMap<scoped_refptr<RefCountedRegistration>, IDMapOwnPointer> |
| 339 registration_handle_ids_; | 344 registration_handle_ids_; |
| 340 | 345 |
| 341 base::WeakPtrFactory<BackgroundSyncManager> weak_ptr_factory_; | 346 base::WeakPtrFactory<BackgroundSyncManager> weak_ptr_factory_; |
| 342 | 347 |
| 343 DISALLOW_COPY_AND_ASSIGN(BackgroundSyncManager); | 348 DISALLOW_COPY_AND_ASSIGN(BackgroundSyncManager); |
| 344 }; | 349 }; |
| 345 | 350 |
| 346 } // namespace content | 351 } // namespace content |
| 347 | 352 |
| 348 #endif // CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_MANAGER_H_ | 353 #endif // CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_MANAGER_H_ |
| OLD | NEW |