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_INVALIDATOR_H_ | 8 #ifndef SYNC_NOTIFIER_NON_BLOCKING_INVALIDATOR_H_ |
9 #define SYNC_NOTIFIER_NON_BLOCKING_INVALIDATOR_H_ | 9 #define SYNC_NOTIFIER_NON_BLOCKING_INVALIDATOR_H_ |
10 | 10 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 invalidation_state_tracker, | 43 invalidation_state_tracker, |
44 const std::string& client_info); | 44 const std::string& client_info); |
45 | 45 |
46 virtual ~NonBlockingInvalidator(); | 46 virtual ~NonBlockingInvalidator(); |
47 | 47 |
48 // Invalidator implementation. | 48 // Invalidator implementation. |
49 virtual void RegisterHandler(InvalidationHandler* handler) OVERRIDE; | 49 virtual void RegisterHandler(InvalidationHandler* handler) OVERRIDE; |
50 virtual void UpdateRegisteredIds(InvalidationHandler* handler, | 50 virtual void UpdateRegisteredIds(InvalidationHandler* handler, |
51 const ObjectIdSet& ids) OVERRIDE; | 51 const ObjectIdSet& ids) OVERRIDE; |
52 virtual void UnregisterHandler(InvalidationHandler* handler) OVERRIDE; | 52 virtual void UnregisterHandler(InvalidationHandler* handler) OVERRIDE; |
| 53 virtual InvalidatorState GetInvalidatorState() const OVERRIDE; |
53 virtual void SetUniqueId(const std::string& unique_id) OVERRIDE; | 54 virtual void SetUniqueId(const std::string& unique_id) OVERRIDE; |
54 virtual void SetStateDeprecated(const std::string& state) OVERRIDE; | 55 virtual void SetStateDeprecated(const std::string& state) OVERRIDE; |
55 virtual void UpdateCredentials( | 56 virtual void UpdateCredentials( |
56 const std::string& email, const std::string& token) OVERRIDE; | 57 const std::string& email, const std::string& token) OVERRIDE; |
57 virtual void SendNotification(const ObjectIdStateMap& id_state_map) OVERRIDE; | 58 virtual void SendInvalidation(const ObjectIdStateMap& id_state_map) OVERRIDE; |
58 | 59 |
59 // InvalidationHandler implementation. | 60 // InvalidationHandler implementation. |
60 virtual void OnNotificationsEnabled() OVERRIDE; | 61 virtual void OnInvalidatorStateChange(InvalidatorState state) OVERRIDE; |
61 virtual void OnNotificationsDisabled( | 62 virtual void OnIncomingInvalidation( |
62 NotificationsDisabledReason reason) OVERRIDE; | |
63 virtual void OnIncomingNotification( | |
64 const ObjectIdStateMap& id_state_map, | 63 const ObjectIdStateMap& id_state_map, |
65 IncomingNotificationSource source) OVERRIDE; | 64 IncomingInvalidationSource source) OVERRIDE; |
66 | 65 |
67 private: | 66 private: |
68 class Core; | 67 class Core; |
69 | 68 |
70 base::WeakPtrFactory<NonBlockingInvalidator> weak_ptr_factory_; | 69 base::WeakPtrFactory<NonBlockingInvalidator> weak_ptr_factory_; |
71 | 70 |
72 InvalidatorRegistrar registrar_; | 71 InvalidatorRegistrar registrar_; |
73 | 72 |
74 // The real guts of NonBlockingInvalidator, which allows this class to live | 73 // The real guts of NonBlockingInvalidator, which allows this class to live |
75 // completely on the parent thread. | 74 // completely on the parent thread. |
76 scoped_refptr<Core> core_; | 75 scoped_refptr<Core> core_; |
77 scoped_refptr<base::SingleThreadTaskRunner> parent_task_runner_; | 76 scoped_refptr<base::SingleThreadTaskRunner> parent_task_runner_; |
78 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; | 77 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; |
79 | 78 |
80 DISALLOW_COPY_AND_ASSIGN(NonBlockingInvalidator); | 79 DISALLOW_COPY_AND_ASSIGN(NonBlockingInvalidator); |
81 }; | 80 }; |
82 | 81 |
83 } // namespace syncer | 82 } // namespace syncer |
84 | 83 |
85 #endif // SYNC_NOTIFIER_NON_BLOCKING_INVALIDATOR_H_ | 84 #endif // SYNC_NOTIFIER_NON_BLOCKING_INVALIDATOR_H_ |
OLD | NEW |