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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 // Given a HandleId |handle_id|, return a new handle for the same | 92 // Given a HandleId |handle_id|, return a new handle for the same |
93 // registration. | 93 // registration. |
94 scoped_ptr<BackgroundSyncRegistrationHandle> DuplicateRegistrationHandle( | 94 scoped_ptr<BackgroundSyncRegistrationHandle> DuplicateRegistrationHandle( |
95 BackgroundSyncRegistrationHandle::HandleId handle_id); | 95 BackgroundSyncRegistrationHandle::HandleId handle_id); |
96 | 96 |
97 // ServiceWorkerContextObserver overrides. | 97 // ServiceWorkerContextObserver overrides. |
98 void OnRegistrationDeleted(int64 registration_id, | 98 void OnRegistrationDeleted(int64 registration_id, |
99 const GURL& pattern) override; | 99 const GURL& pattern) override; |
100 void OnStorageWiped() override; | 100 void OnStorageWiped() override; |
101 | 101 |
102 BackgroundSyncNetworkObserver* GetNetworkObserverForTesting() { | |
103 return network_observer_.get(); | |
104 } | |
105 | |
106 protected: | 102 protected: |
107 // A registration might be referenced by the client longer than | 103 // A registration might be referenced by the client longer than |
108 // the BackgroundSyncManager needs to keep track of it (e.g., the event has | 104 // the BackgroundSyncManager needs to keep track of it (e.g., the event has |
109 // finished firing). The BackgroundSyncManager reference counts its | 105 // finished firing). The BackgroundSyncManager reference counts its |
110 // registrations internally and every BackgroundSyncRegistrationHandle has a | 106 // registrations internally and every BackgroundSyncRegistrationHandle has a |
111 // unique handle id which maps to a locally maintained (in | 107 // unique handle id which maps to a locally maintained (in |
112 // client_registration_ids_) scoped_refptr. | 108 // client_registration_ids_) scoped_refptr. |
113 class RefCountedRegistration; | 109 class RefCountedRegistration; |
114 | 110 |
115 explicit BackgroundSyncManager( | 111 explicit BackgroundSyncManager( |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 registration_handle_ids_; | 356 registration_handle_ids_; |
361 | 357 |
362 base::WeakPtrFactory<BackgroundSyncManager> weak_ptr_factory_; | 358 base::WeakPtrFactory<BackgroundSyncManager> weak_ptr_factory_; |
363 | 359 |
364 DISALLOW_COPY_AND_ASSIGN(BackgroundSyncManager); | 360 DISALLOW_COPY_AND_ASSIGN(BackgroundSyncManager); |
365 }; | 361 }; |
366 | 362 |
367 } // namespace content | 363 } // namespace content |
368 | 364 |
369 #endif // CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_MANAGER_H_ | 365 #endif // CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_MANAGER_H_ |
OLD | NEW |