| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // An implementation of SyncNotifier that wraps InvalidationNotifier | 5 // An implementation of SyncNotifier that wraps InvalidationNotifier |
| 6 // on its own thread. | 6 // on its own thread. |
| 7 | 7 |
| 8 #ifndef SYNC_NOTIFIER_NON_BLOCKING_INVALIDATION_NOTIFIER_H_ | 8 #ifndef SYNC_NOTIFIER_NON_BLOCKING_INVALIDATION_NOTIFIER_H_ |
| 9 #define SYNC_NOTIFIER_NON_BLOCKING_INVALIDATION_NOTIFIER_H_ | 9 #define SYNC_NOTIFIER_NON_BLOCKING_INVALIDATION_NOTIFIER_H_ |
| 10 #pragma once | 10 #pragma once |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 virtual void SetUniqueId(const std::string& unique_id) OVERRIDE; | 50 virtual void SetUniqueId(const std::string& unique_id) OVERRIDE; |
| 51 virtual void SetStateDeprecated(const std::string& state) OVERRIDE; | 51 virtual void SetStateDeprecated(const std::string& state) OVERRIDE; |
| 52 virtual void UpdateCredentials( | 52 virtual void UpdateCredentials( |
| 53 const std::string& email, const std::string& token) OVERRIDE; | 53 const std::string& email, const std::string& token) OVERRIDE; |
| 54 virtual void UpdateEnabledTypes( | 54 virtual void UpdateEnabledTypes( |
| 55 syncable::ModelTypeSet enabled_types) OVERRIDE; | 55 syncable::ModelTypeSet enabled_types) OVERRIDE; |
| 56 virtual void SendNotification( | 56 virtual void SendNotification( |
| 57 syncable::ModelTypeSet changed_types) OVERRIDE; | 57 syncable::ModelTypeSet changed_types) OVERRIDE; |
| 58 | 58 |
| 59 // SyncNotifierObserver implementation. | 59 // SyncNotifierObserver implementation. |
| 60 virtual void OnNotificationsEnabled() OVERRIDE; |
| 61 virtual void OnNotificationsDisabled( |
| 62 NotificationsDisabledReason reason) OVERRIDE; |
| 60 virtual void OnIncomingNotification( | 63 virtual void OnIncomingNotification( |
| 61 const syncable::ModelTypePayloadMap& type_payloads, | 64 const syncable::ModelTypePayloadMap& type_payloads, |
| 62 IncomingNotificationSource source) OVERRIDE; | 65 IncomingNotificationSource source) OVERRIDE; |
| 63 virtual void OnNotificationStateChange(bool notifications_enabled) OVERRIDE; | |
| 64 | 66 |
| 65 private: | 67 private: |
| 66 class Core; | 68 class Core; |
| 67 | 69 |
| 68 base::WeakPtrFactory<NonBlockingInvalidationNotifier> weak_ptr_factory_; | 70 base::WeakPtrFactory<NonBlockingInvalidationNotifier> weak_ptr_factory_; |
| 69 | 71 |
| 70 // Our observers (which must live on the parent thread). | 72 // Our observers (which must live on the parent thread). |
| 71 ObserverList<SyncNotifierObserver> observers_; | 73 ObserverList<SyncNotifierObserver> observers_; |
| 72 | 74 |
| 73 // The real guts of NonBlockingInvalidationNotifier, which allows | 75 // The real guts of NonBlockingInvalidationNotifier, which allows |
| 74 // this class to live completely on the parent thread. | 76 // this class to live completely on the parent thread. |
| 75 scoped_refptr<Core> core_; | 77 scoped_refptr<Core> core_; |
| 76 scoped_refptr<base::SingleThreadTaskRunner> parent_task_runner_; | 78 scoped_refptr<base::SingleThreadTaskRunner> parent_task_runner_; |
| 77 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; | 79 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; |
| 78 | 80 |
| 79 DISALLOW_COPY_AND_ASSIGN(NonBlockingInvalidationNotifier); | 81 DISALLOW_COPY_AND_ASSIGN(NonBlockingInvalidationNotifier); |
| 80 }; | 82 }; |
| 81 | 83 |
| 82 } // namespace sync_notifier | 84 } // namespace sync_notifier |
| 83 | 85 |
| 84 #endif // SYNC_NOTIFIER_NON_BLOCKING_INVALIDATION_NOTIFIER_H_ | 86 #endif // SYNC_NOTIFIER_NON_BLOCKING_INVALIDATION_NOTIFIER_H_ |
| OLD | NEW |