| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // Simple system resources class that uses the current message loop | 5 // Simple system resources class that uses the current message loop |
| 6 // for scheduling. Assumes the current message loop is already | 6 // for scheduling. Assumes the current message loop is already |
| 7 // running. | 7 // running. |
| 8 | 8 |
| 9 #ifndef COMPONENTS_INVALIDATION_IMPL_SYNC_SYSTEM_RESOURCES_H_ | 9 #ifndef COMPONENTS_INVALIDATION_IMPL_SYNC_SYSTEM_RESOURCES_H_ |
| 10 #define COMPONENTS_INVALIDATION_IMPL_SYNC_SYSTEM_RESOURCES_H_ | 10 #define COMPONENTS_INVALIDATION_IMPL_SYNC_SYSTEM_RESOURCES_H_ |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 | 78 |
| 79 base::WeakPtrFactory<SyncInvalidationScheduler> weak_factory_; | 79 base::WeakPtrFactory<SyncInvalidationScheduler> weak_factory_; |
| 80 }; | 80 }; |
| 81 | 81 |
| 82 // SyncNetworkChannel implements common tasks needed to interact with | 82 // SyncNetworkChannel implements common tasks needed to interact with |
| 83 // invalidation library: | 83 // invalidation library: |
| 84 // - registering message and network status callbacks | 84 // - registering message and network status callbacks |
| 85 // - notifying observers about network channel state change | 85 // - notifying observers about network channel state change |
| 86 // Implementation of particular network protocol should implement | 86 // Implementation of particular network protocol should implement |
| 87 // SendMessage and call NotifyStateChange and DeliverIncomingMessage. | 87 // SendMessage and call NotifyStateChange and DeliverIncomingMessage. |
| 88 class INVALIDATION_EXPORT_PRIVATE SyncNetworkChannel | 88 class INVALIDATION_EXPORT SyncNetworkChannel |
| 89 : public NON_EXPORTED_BASE(invalidation::NetworkChannel) { | 89 : public NON_EXPORTED_BASE(invalidation::NetworkChannel) { |
| 90 public: | 90 public: |
| 91 class Observer { | 91 class Observer { |
| 92 public: | 92 public: |
| 93 // Called when network channel state changes. Possible states are: | 93 // Called when network channel state changes. Possible states are: |
| 94 // - INVALIDATIONS_ENABLED : connection is established and working | 94 // - INVALIDATIONS_ENABLED : connection is established and working |
| 95 // - TRANSIENT_INVALIDATION_ERROR : no network, connection lost, etc. | 95 // - TRANSIENT_INVALIDATION_ERROR : no network, connection lost, etc. |
| 96 // - INVALIDATION_CREDENTIALS_REJECTED : Issues with auth token | 96 // - INVALIDATION_CREDENTIALS_REJECTED : Issues with auth token |
| 97 virtual void OnNetworkChannelStateChanged( | 97 virtual void OnNetworkChannelStateChanged( |
| 98 InvalidatorState invalidator_state) = 0; | 98 InvalidatorState invalidator_state) = 0; |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 | 206 |
| 207 // Runs the given callback with the given value and deletes it. | 207 // Runs the given callback with the given value and deletes it. |
| 208 void RunAndDeleteReadKeyCallback( | 208 void RunAndDeleteReadKeyCallback( |
| 209 invalidation::ReadKeyCallback* callback, const std::string& value); | 209 invalidation::ReadKeyCallback* callback, const std::string& value); |
| 210 | 210 |
| 211 StateWriter* state_writer_; | 211 StateWriter* state_writer_; |
| 212 invalidation::Scheduler* scheduler_; | 212 invalidation::Scheduler* scheduler_; |
| 213 std::string cached_state_; | 213 std::string cached_state_; |
| 214 }; | 214 }; |
| 215 | 215 |
| 216 class INVALIDATION_EXPORT_PRIVATE SyncSystemResources | 216 class INVALIDATION_EXPORT SyncSystemResources |
| 217 : public NON_EXPORTED_BASE(invalidation::SystemResources) { | 217 : public NON_EXPORTED_BASE(invalidation::SystemResources) { |
| 218 public: | 218 public: |
| 219 SyncSystemResources(SyncNetworkChannel* sync_network_channel, | 219 SyncSystemResources(SyncNetworkChannel* sync_network_channel, |
| 220 StateWriter* state_writer); | 220 StateWriter* state_writer); |
| 221 | 221 |
| 222 ~SyncSystemResources() override; | 222 ~SyncSystemResources() override; |
| 223 | 223 |
| 224 // invalidation::SystemResources implementation. | 224 // invalidation::SystemResources implementation. |
| 225 void Start() override; | 225 void Start() override; |
| 226 void Stop() override; | 226 void Stop() override; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 240 scoped_ptr<SyncInvalidationScheduler> internal_scheduler_; | 240 scoped_ptr<SyncInvalidationScheduler> internal_scheduler_; |
| 241 scoped_ptr<SyncInvalidationScheduler> listener_scheduler_; | 241 scoped_ptr<SyncInvalidationScheduler> listener_scheduler_; |
| 242 scoped_ptr<SyncStorage> storage_; | 242 scoped_ptr<SyncStorage> storage_; |
| 243 // sync_network_channel_ is owned by SyncInvalidationListener. | 243 // sync_network_channel_ is owned by SyncInvalidationListener. |
| 244 SyncNetworkChannel* sync_network_channel_; | 244 SyncNetworkChannel* sync_network_channel_; |
| 245 }; | 245 }; |
| 246 | 246 |
| 247 } // namespace syncer | 247 } // namespace syncer |
| 248 | 248 |
| 249 #endif // COMPONENTS_INVALIDATION_IMPL_SYNC_SYSTEM_RESOURCES_H_ | 249 #endif // COMPONENTS_INVALIDATION_IMPL_SYNC_SYSTEM_RESOURCES_H_ |
| OLD | NEW |