[email protected] | 6990e4e0 | 2012-01-26 00:44:53 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | 0a80fed | 2011-03-24 22:31:48 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
[email protected] | b7fe4b5 | 2012-04-19 14:21:09 | [diff] [blame] | 5 | #include "sync/notifier/non_blocking_invalidation_notifier.h" |
[email protected] | 0a80fed | 2011-03-24 22:31:48 | [diff] [blame] | 6 | |
[email protected] | 4969b012 | 2012-06-16 01:58:28 | [diff] [blame] | 7 | #include "base/location.h" |
[email protected] | 0a80fed | 2011-03-24 22:31:48 | [diff] [blame] | 8 | #include "base/logging.h" |
[email protected] | 942e202 | 2011-04-07 22:27:43 | [diff] [blame] | 9 | #include "base/memory/scoped_ptr.h" |
[email protected] | 4969b012 | 2012-06-16 01:58:28 | [diff] [blame] | 10 | #include "base/single_thread_task_runner.h" |
| 11 | #include "base/thread_task_runner_handle.h" |
[email protected] | 942e202 | 2011-04-07 22:27:43 | [diff] [blame] | 12 | #include "base/threading/thread.h" |
[email protected] | 1f7eba7 | 2012-05-30 09:10:17 | [diff] [blame] | 13 | #include "jingle/notifier/listener/push_client.h" |
[email protected] | b7fe4b5 | 2012-04-19 14:21:09 | [diff] [blame] | 14 | #include "sync/notifier/invalidation_notifier.h" |
[email protected] | 0a80fed | 2011-03-24 22:31:48 | [diff] [blame] | 15 | |
[email protected] | 65f17355 | 2012-06-28 22:43:58 | [diff] [blame] | 16 | namespace syncer { |
[email protected] | 0a80fed | 2011-03-24 22:31:48 | [diff] [blame] | 17 | |
[email protected] | 942e202 | 2011-04-07 22:27:43 | [diff] [blame] | 18 | class NonBlockingInvalidationNotifier::Core |
| 19 | : public base::RefCountedThreadSafe<NonBlockingInvalidationNotifier::Core>, |
[email protected] | 7800d79 | 2012-05-30 02:34:48 | [diff] [blame] | 20 | // SyncNotifierObserver to observe the InvalidationNotifier we create. |
[email protected] | 942e202 | 2011-04-07 22:27:43 | [diff] [blame] | 21 | public SyncNotifierObserver { |
| 22 | public: |
[email protected] | b9908a24 | 2011-11-19 09:31:32 | [diff] [blame] | 23 | // Called on parent thread. |delegate_observer| should be |
| 24 | // initialized. |
| 25 | explicit Core( |
[email protected] | d45f0d9 | 2012-07-20 17:25:41 | [diff] [blame] | 26 | const WeakHandle<SyncNotifierObserver>& delegate_observer); |
[email protected] | 942e202 | 2011-04-07 22:27:43 | [diff] [blame] | 27 | |
| 28 | // Helpers called on I/O thread. |
[email protected] | e3b0ee5 | 2011-10-12 03:04:13 | [diff] [blame] | 29 | void Initialize( |
| 30 | const notifier::NotifierOptions& notifier_options, |
| 31 | const InvalidationVersionMap& initial_max_invalidation_versions, |
[email protected] | 0857ae0b | 2012-05-31 00:39:26 | [diff] [blame] | 32 | const std::string& initial_invalidation_state, |
[email protected] | d45f0d9 | 2012-07-20 17:25:41 | [diff] [blame] | 33 | const WeakHandle<InvalidationStateTracker>& invalidation_state_tracker, |
[email protected] | e3b0ee5 | 2011-10-12 03:04:13 | [diff] [blame] | 34 | const std::string& client_info); |
[email protected] | 942e202 | 2011-04-07 22:27:43 | [diff] [blame] | 35 | void Teardown(); |
[email protected] | d914f02 | 2012-07-27 02:02:00 | [diff] [blame^] | 36 | void UpdateRegisteredIds(const ObjectIdSet& ids); |
[email protected] | 0a561205 | 2011-06-29 03:29:18 | [diff] [blame] | 37 | void SetUniqueId(const std::string& unique_id); |
[email protected] | 0857ae0b | 2012-05-31 00:39:26 | [diff] [blame] | 38 | void SetStateDeprecated(const std::string& state); |
[email protected] | 942e202 | 2011-04-07 22:27:43 | [diff] [blame] | 39 | void UpdateCredentials(const std::string& email, const std::string& token); |
[email protected] | 942e202 | 2011-04-07 22:27:43 | [diff] [blame] | 40 | |
[email protected] | 7800d79 | 2012-05-30 02:34:48 | [diff] [blame] | 41 | // SyncNotifierObserver implementation (all called on I/O thread by |
| 42 | // InvalidationNotifier). |
[email protected] | 2d3d1d1 | 2012-06-18 20:50:28 | [diff] [blame] | 43 | virtual void OnNotificationsEnabled() OVERRIDE; |
| 44 | virtual void OnNotificationsDisabled( |
| 45 | NotificationsDisabledReason reason) OVERRIDE; |
[email protected] | 942e202 | 2011-04-07 22:27:43 | [diff] [blame] | 46 | virtual void OnIncomingNotification( |
[email protected] | d914f02 | 2012-07-27 02:02:00 | [diff] [blame^] | 47 | const ObjectIdPayloadMap& id_payloads, |
[email protected] | 2d3d1d1 | 2012-06-18 20:50:28 | [diff] [blame] | 48 | IncomingNotificationSource source) OVERRIDE; |
[email protected] | 942e202 | 2011-04-07 22:27:43 | [diff] [blame] | 49 | |
| 50 | private: |
| 51 | friend class |
| 52 | base::RefCountedThreadSafe<NonBlockingInvalidationNotifier::Core>; |
| 53 | // Called on parent or I/O thread. |
| 54 | ~Core(); |
| 55 | |
[email protected] | b9908a24 | 2011-11-19 09:31:32 | [diff] [blame] | 56 | // The variables below should be used only on the I/O thread. |
[email protected] | d45f0d9 | 2012-07-20 17:25:41 | [diff] [blame] | 57 | const WeakHandle<SyncNotifierObserver> delegate_observer_; |
[email protected] | 942e202 | 2011-04-07 22:27:43 | [diff] [blame] | 58 | scoped_ptr<InvalidationNotifier> invalidation_notifier_; |
[email protected] | 4969b012 | 2012-06-16 01:58:28 | [diff] [blame] | 59 | scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; |
[email protected] | b9908a24 | 2011-11-19 09:31:32 | [diff] [blame] | 60 | |
[email protected] | 942e202 | 2011-04-07 22:27:43 | [diff] [blame] | 61 | DISALLOW_COPY_AND_ASSIGN(Core); |
| 62 | }; |
| 63 | |
[email protected] | b9908a24 | 2011-11-19 09:31:32 | [diff] [blame] | 64 | NonBlockingInvalidationNotifier::Core::Core( |
[email protected] | d45f0d9 | 2012-07-20 17:25:41 | [diff] [blame] | 65 | const WeakHandle<SyncNotifierObserver>& delegate_observer) |
[email protected] | b9908a24 | 2011-11-19 09:31:32 | [diff] [blame] | 66 | : delegate_observer_(delegate_observer) { |
| 67 | DCHECK(delegate_observer_.IsInitialized()); |
[email protected] | 942e202 | 2011-04-07 22:27:43 | [diff] [blame] | 68 | } |
| 69 | |
| 70 | NonBlockingInvalidationNotifier::Core::~Core() { |
| 71 | } |
| 72 | |
| 73 | void NonBlockingInvalidationNotifier::Core::Initialize( |
| 74 | const notifier::NotifierOptions& notifier_options, |
[email protected] | e3b0ee5 | 2011-10-12 03:04:13 | [diff] [blame] | 75 | const InvalidationVersionMap& initial_max_invalidation_versions, |
[email protected] | 0857ae0b | 2012-05-31 00:39:26 | [diff] [blame] | 76 | const std::string& initial_invalidation_state, |
[email protected] | d45f0d9 | 2012-07-20 17:25:41 | [diff] [blame] | 77 | const WeakHandle<InvalidationStateTracker>& invalidation_state_tracker, |
[email protected] | 942e202 | 2011-04-07 22:27:43 | [diff] [blame] | 78 | const std::string& client_info) { |
| 79 | DCHECK(notifier_options.request_context_getter); |
| 80 | DCHECK_EQ(notifier::NOTIFICATION_SERVER, |
| 81 | notifier_options.notification_method); |
[email protected] | 4969b012 | 2012-06-16 01:58:28 | [diff] [blame] | 82 | network_task_runner_ = notifier_options.request_context_getter-> |
| 83 | GetNetworkTaskRunner(); |
| 84 | DCHECK(network_task_runner_->BelongsToCurrentThread()); |
[email protected] | 942e202 | 2011-04-07 22:27:43 | [diff] [blame] | 85 | invalidation_notifier_.reset( |
[email protected] | e3b0ee5 | 2011-10-12 03:04:13 | [diff] [blame] | 86 | new InvalidationNotifier( |
[email protected] | 1f7eba7 | 2012-05-30 09:10:17 | [diff] [blame] | 87 | notifier::PushClient::CreateDefaultOnIOThread(notifier_options), |
[email protected] | e3b0ee5 | 2011-10-12 03:04:13 | [diff] [blame] | 88 | initial_max_invalidation_versions, |
[email protected] | 0857ae0b | 2012-05-31 00:39:26 | [diff] [blame] | 89 | initial_invalidation_state, |
[email protected] | 46e43ee | 2012-05-18 19:24:41 | [diff] [blame] | 90 | invalidation_state_tracker, |
[email protected] | e3b0ee5 | 2011-10-12 03:04:13 | [diff] [blame] | 91 | client_info)); |
[email protected] | 942e202 | 2011-04-07 22:27:43 | [diff] [blame] | 92 | } |
| 93 | |
| 94 | |
| 95 | void NonBlockingInvalidationNotifier::Core::Teardown() { |
[email protected] | 4969b012 | 2012-06-16 01:58:28 | [diff] [blame] | 96 | DCHECK(network_task_runner_->BelongsToCurrentThread()); |
[email protected] | d914f02 | 2012-07-27 02:02:00 | [diff] [blame^] | 97 | invalidation_notifier_->UpdateRegisteredIds(this, ObjectIdSet()); |
[email protected] | 942e202 | 2011-04-07 22:27:43 | [diff] [blame] | 98 | invalidation_notifier_.reset(); |
[email protected] | 4969b012 | 2012-06-16 01:58:28 | [diff] [blame] | 99 | network_task_runner_ = NULL; |
[email protected] | 942e202 | 2011-04-07 22:27:43 | [diff] [blame] | 100 | } |
| 101 | |
[email protected] | d914f02 | 2012-07-27 02:02:00 | [diff] [blame^] | 102 | void NonBlockingInvalidationNotifier::Core::UpdateRegisteredIds( |
| 103 | const ObjectIdSet& ids) { |
| 104 | DCHECK(network_task_runner_->BelongsToCurrentThread()); |
| 105 | invalidation_notifier_->UpdateRegisteredIds(this, ids); |
| 106 | } |
| 107 | |
[email protected] | 0a561205 | 2011-06-29 03:29:18 | [diff] [blame] | 108 | void NonBlockingInvalidationNotifier::Core::SetUniqueId( |
| 109 | const std::string& unique_id) { |
[email protected] | 4969b012 | 2012-06-16 01:58:28 | [diff] [blame] | 110 | DCHECK(network_task_runner_->BelongsToCurrentThread()); |
[email protected] | 0a561205 | 2011-06-29 03:29:18 | [diff] [blame] | 111 | invalidation_notifier_->SetUniqueId(unique_id); |
| 112 | } |
| 113 | |
[email protected] | 0857ae0b | 2012-05-31 00:39:26 | [diff] [blame] | 114 | void NonBlockingInvalidationNotifier::Core::SetStateDeprecated( |
[email protected] | 942e202 | 2011-04-07 22:27:43 | [diff] [blame] | 115 | const std::string& state) { |
[email protected] | 4969b012 | 2012-06-16 01:58:28 | [diff] [blame] | 116 | DCHECK(network_task_runner_->BelongsToCurrentThread()); |
[email protected] | 0857ae0b | 2012-05-31 00:39:26 | [diff] [blame] | 117 | invalidation_notifier_->SetStateDeprecated(state); |
[email protected] | 942e202 | 2011-04-07 22:27:43 | [diff] [blame] | 118 | } |
| 119 | |
| 120 | void NonBlockingInvalidationNotifier::Core::UpdateCredentials( |
| 121 | const std::string& email, const std::string& token) { |
[email protected] | 4969b012 | 2012-06-16 01:58:28 | [diff] [blame] | 122 | DCHECK(network_task_runner_->BelongsToCurrentThread()); |
[email protected] | 942e202 | 2011-04-07 22:27:43 | [diff] [blame] | 123 | invalidation_notifier_->UpdateCredentials(email, token); |
| 124 | } |
| 125 | |
[email protected] | 2d3d1d1 | 2012-06-18 20:50:28 | [diff] [blame] | 126 | void NonBlockingInvalidationNotifier::Core::OnNotificationsEnabled() { |
| 127 | DCHECK(network_task_runner_->BelongsToCurrentThread()); |
| 128 | delegate_observer_.Call(FROM_HERE, |
| 129 | &SyncNotifierObserver::OnNotificationsEnabled); |
| 130 | } |
| 131 | |
| 132 | void NonBlockingInvalidationNotifier::Core::OnNotificationsDisabled( |
| 133 | NotificationsDisabledReason reason) { |
| 134 | DCHECK(network_task_runner_->BelongsToCurrentThread()); |
| 135 | delegate_observer_.Call( |
| 136 | FROM_HERE, &SyncNotifierObserver::OnNotificationsDisabled, reason); |
| 137 | } |
| 138 | |
[email protected] | 942e202 | 2011-04-07 22:27:43 | [diff] [blame] | 139 | void NonBlockingInvalidationNotifier::Core::OnIncomingNotification( |
[email protected] | d914f02 | 2012-07-27 02:02:00 | [diff] [blame^] | 140 | const ObjectIdPayloadMap& id_payloads, IncomingNotificationSource source) { |
[email protected] | 4969b012 | 2012-06-16 01:58:28 | [diff] [blame] | 141 | DCHECK(network_task_runner_->BelongsToCurrentThread()); |
[email protected] | b9908a24 | 2011-11-19 09:31:32 | [diff] [blame] | 142 | delegate_observer_.Call(FROM_HERE, |
| 143 | &SyncNotifierObserver::OnIncomingNotification, |
[email protected] | d914f02 | 2012-07-27 02:02:00 | [diff] [blame^] | 144 | id_payloads, |
[email protected] | 6990e4e0 | 2012-01-26 00:44:53 | [diff] [blame] | 145 | source); |
[email protected] | 942e202 | 2011-04-07 22:27:43 | [diff] [blame] | 146 | } |
| 147 | |
[email protected] | 0a80fed | 2011-03-24 22:31:48 | [diff] [blame] | 148 | NonBlockingInvalidationNotifier::NonBlockingInvalidationNotifier( |
| 149 | const notifier::NotifierOptions& notifier_options, |
[email protected] | e3b0ee5 | 2011-10-12 03:04:13 | [diff] [blame] | 150 | const InvalidationVersionMap& initial_max_invalidation_versions, |
[email protected] | 0857ae0b | 2012-05-31 00:39:26 | [diff] [blame] | 151 | const std::string& initial_invalidation_state, |
[email protected] | d45f0d9 | 2012-07-20 17:25:41 | [diff] [blame] | 152 | const WeakHandle<InvalidationStateTracker>& |
[email protected] | 46e43ee | 2012-05-18 19:24:41 | [diff] [blame] | 153 | invalidation_state_tracker, |
[email protected] | 0a80fed | 2011-03-24 22:31:48 | [diff] [blame] | 154 | const std::string& client_info) |
[email protected] | b9908a24 | 2011-11-19 09:31:32 | [diff] [blame] | 155 | : weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), |
| 156 | core_( |
[email protected] | d45f0d9 | 2012-07-20 17:25:41 | [diff] [blame] | 157 | new Core(MakeWeakHandle(weak_ptr_factory_.GetWeakPtr()))), |
[email protected] | 4969b012 | 2012-06-16 01:58:28 | [diff] [blame] | 158 | parent_task_runner_( |
| 159 | base::ThreadTaskRunnerHandle::Get()), |
| 160 | network_task_runner_(notifier_options.request_context_getter-> |
| 161 | GetNetworkTaskRunner()) { |
| 162 | if (!network_task_runner_->PostTask( |
[email protected] | daf4e10 | 2011-04-26 08:30:28 | [diff] [blame] | 163 | FROM_HERE, |
[email protected] | 09e170f | 2011-10-28 23:22:02 | [diff] [blame] | 164 | base::Bind( |
[email protected] | daf4e10 | 2011-04-26 08:30:28 | [diff] [blame] | 165 | &NonBlockingInvalidationNotifier::Core::Initialize, |
[email protected] | 09e170f | 2011-10-28 23:22:02 | [diff] [blame] | 166 | core_.get(), |
[email protected] | e3b0ee5 | 2011-10-12 03:04:13 | [diff] [blame] | 167 | notifier_options, |
| 168 | initial_max_invalidation_versions, |
[email protected] | 0857ae0b | 2012-05-31 00:39:26 | [diff] [blame] | 169 | initial_invalidation_state, |
[email protected] | 46e43ee | 2012-05-18 19:24:41 | [diff] [blame] | 170 | invalidation_state_tracker, |
[email protected] | e3b0ee5 | 2011-10-12 03:04:13 | [diff] [blame] | 171 | client_info))) { |
[email protected] | daf4e10 | 2011-04-26 08:30:28 | [diff] [blame] | 172 | NOTREACHED(); |
[email protected] | 0a561205 | 2011-06-29 03:29:18 | [diff] [blame] | 173 | } |
[email protected] | 0a80fed | 2011-03-24 22:31:48 | [diff] [blame] | 174 | } |
| 175 | |
| 176 | NonBlockingInvalidationNotifier::~NonBlockingInvalidationNotifier() { |
[email protected] | 4969b012 | 2012-06-16 01:58:28 | [diff] [blame] | 177 | DCHECK(parent_task_runner_->BelongsToCurrentThread()); |
| 178 | if (!network_task_runner_->PostTask( |
[email protected] | daf4e10 | 2011-04-26 08:30:28 | [diff] [blame] | 179 | FROM_HERE, |
[email protected] | 09e170f | 2011-10-28 23:22:02 | [diff] [blame] | 180 | base::Bind(&NonBlockingInvalidationNotifier::Core::Teardown, |
| 181 | core_.get()))) { |
[email protected] | daf4e10 | 2011-04-26 08:30:28 | [diff] [blame] | 182 | NOTREACHED(); |
[email protected] | 0a561205 | 2011-06-29 03:29:18 | [diff] [blame] | 183 | } |
[email protected] | 0a80fed | 2011-03-24 22:31:48 | [diff] [blame] | 184 | } |
| 185 | |
[email protected] | d914f02 | 2012-07-27 02:02:00 | [diff] [blame^] | 186 | void NonBlockingInvalidationNotifier::UpdateRegisteredIds( |
| 187 | SyncNotifierObserver* handler, const ObjectIdSet& ids) { |
[email protected] | 4969b012 | 2012-06-16 01:58:28 | [diff] [blame] | 188 | DCHECK(parent_task_runner_->BelongsToCurrentThread()); |
[email protected] | d914f02 | 2012-07-27 02:02:00 | [diff] [blame^] | 189 | const ObjectIdSet& all_registered_ids = |
| 190 | helper_.UpdateRegisteredIds(handler, ids); |
| 191 | if (!network_task_runner_->PostTask( |
| 192 | FROM_HERE, |
| 193 | base::Bind( |
| 194 | &NonBlockingInvalidationNotifier::Core::UpdateRegisteredIds, |
| 195 | core_.get(), |
| 196 | all_registered_ids))) { |
| 197 | NOTREACHED(); |
| 198 | } |
[email protected] | 0a80fed | 2011-03-24 22:31:48 | [diff] [blame] | 199 | } |
| 200 | |
[email protected] | 0a561205 | 2011-06-29 03:29:18 | [diff] [blame] | 201 | void NonBlockingInvalidationNotifier::SetUniqueId( |
| 202 | const std::string& unique_id) { |
[email protected] | 4969b012 | 2012-06-16 01:58:28 | [diff] [blame] | 203 | DCHECK(parent_task_runner_->BelongsToCurrentThread()); |
| 204 | if (!network_task_runner_->PostTask( |
[email protected] | 0a561205 | 2011-06-29 03:29:18 | [diff] [blame] | 205 | FROM_HERE, |
[email protected] | 09e170f | 2011-10-28 23:22:02 | [diff] [blame] | 206 | base::Bind(&NonBlockingInvalidationNotifier::Core::SetUniqueId, |
| 207 | core_.get(), unique_id))) { |
[email protected] | 0a561205 | 2011-06-29 03:29:18 | [diff] [blame] | 208 | NOTREACHED(); |
| 209 | } |
| 210 | } |
| 211 | |
[email protected] | 0857ae0b | 2012-05-31 00:39:26 | [diff] [blame] | 212 | void NonBlockingInvalidationNotifier::SetStateDeprecated( |
| 213 | const std::string& state) { |
[email protected] | 4969b012 | 2012-06-16 01:58:28 | [diff] [blame] | 214 | DCHECK(parent_task_runner_->BelongsToCurrentThread()); |
| 215 | if (!network_task_runner_->PostTask( |
[email protected] | daf4e10 | 2011-04-26 08:30:28 | [diff] [blame] | 216 | FROM_HERE, |
[email protected] | 0857ae0b | 2012-05-31 00:39:26 | [diff] [blame] | 217 | base::Bind( |
| 218 | &NonBlockingInvalidationNotifier::Core::SetStateDeprecated, |
| 219 | core_.get(), state))) { |
[email protected] | daf4e10 | 2011-04-26 08:30:28 | [diff] [blame] | 220 | NOTREACHED(); |
[email protected] | 0a561205 | 2011-06-29 03:29:18 | [diff] [blame] | 221 | } |
[email protected] | 0a80fed | 2011-03-24 22:31:48 | [diff] [blame] | 222 | } |
| 223 | |
| 224 | void NonBlockingInvalidationNotifier::UpdateCredentials( |
| 225 | const std::string& email, const std::string& token) { |
[email protected] | 4969b012 | 2012-06-16 01:58:28 | [diff] [blame] | 226 | DCHECK(parent_task_runner_->BelongsToCurrentThread()); |
| 227 | if (!network_task_runner_->PostTask( |
[email protected] | daf4e10 | 2011-04-26 08:30:28 | [diff] [blame] | 228 | FROM_HERE, |
[email protected] | 09e170f | 2011-10-28 23:22:02 | [diff] [blame] | 229 | base::Bind(&NonBlockingInvalidationNotifier::Core::UpdateCredentials, |
| 230 | core_.get(), email, token))) { |
[email protected] | daf4e10 | 2011-04-26 08:30:28 | [diff] [blame] | 231 | NOTREACHED(); |
[email protected] | 0a561205 | 2011-06-29 03:29:18 | [diff] [blame] | 232 | } |
[email protected] | 0a80fed | 2011-03-24 22:31:48 | [diff] [blame] | 233 | } |
| 234 | |
[email protected] | 2f15fd0e | 2011-08-27 05:29:09 | [diff] [blame] | 235 | void NonBlockingInvalidationNotifier::SendNotification( |
[email protected] | d45f0d9 | 2012-07-20 17:25:41 | [diff] [blame] | 236 | ModelTypeSet changed_types) { |
[email protected] | 4969b012 | 2012-06-16 01:58:28 | [diff] [blame] | 237 | DCHECK(parent_task_runner_->BelongsToCurrentThread()); |
[email protected] | 0a80fed | 2011-03-24 22:31:48 | [diff] [blame] | 238 | // InvalidationClient doesn't implement SendNotification(), so no |
| 239 | // need to forward on the call. |
| 240 | } |
| 241 | |
[email protected] | 2d3d1d1 | 2012-06-18 20:50:28 | [diff] [blame] | 242 | void NonBlockingInvalidationNotifier::OnNotificationsEnabled() { |
| 243 | DCHECK(parent_task_runner_->BelongsToCurrentThread()); |
[email protected] | d914f02 | 2012-07-27 02:02:00 | [diff] [blame^] | 244 | helper_.EmitOnNotificationsEnabled(); |
[email protected] | 2d3d1d1 | 2012-06-18 20:50:28 | [diff] [blame] | 245 | } |
| 246 | |
| 247 | void NonBlockingInvalidationNotifier::OnNotificationsDisabled( |
| 248 | NotificationsDisabledReason reason) { |
| 249 | DCHECK(parent_task_runner_->BelongsToCurrentThread()); |
[email protected] | d914f02 | 2012-07-27 02:02:00 | [diff] [blame^] | 250 | helper_.EmitOnNotificationsDisabled(reason); |
[email protected] | 2d3d1d1 | 2012-06-18 20:50:28 | [diff] [blame] | 251 | } |
| 252 | |
[email protected] | b9908a24 | 2011-11-19 09:31:32 | [diff] [blame] | 253 | void NonBlockingInvalidationNotifier::OnIncomingNotification( |
[email protected] | d914f02 | 2012-07-27 02:02:00 | [diff] [blame^] | 254 | const ObjectIdPayloadMap& id_payloads, |
[email protected] | 6990e4e0 | 2012-01-26 00:44:53 | [diff] [blame] | 255 | IncomingNotificationSource source) { |
[email protected] | 4969b012 | 2012-06-16 01:58:28 | [diff] [blame] | 256 | DCHECK(parent_task_runner_->BelongsToCurrentThread()); |
[email protected] | d914f02 | 2012-07-27 02:02:00 | [diff] [blame^] | 257 | helper_.DispatchInvalidationsToHandlers(id_payloads, source); |
[email protected] | b9908a24 | 2011-11-19 09:31:32 | [diff] [blame] | 258 | } |
| 259 | |
[email protected] | 65f17355 | 2012-06-28 22:43:58 | [diff] [blame] | 260 | } // namespace syncer |