[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] | a329cb8 | 2012-08-28 03:17:58 | [diff] [blame] | 5 | #include "sync/notifier/non_blocking_invalidator.h" |
[email protected] | 0a80fed | 2011-03-24 22:31:48 | [diff] [blame] | 6 | |
[email protected] | 85b25eb | 2012-08-10 19:32:08 | [diff] [blame] | 7 | #include <cstddef> |
| 8 | |
[email protected] | 4969b012 | 2012-06-16 01:58:28 | [diff] [blame] | 9 | #include "base/location.h" |
[email protected] | 0a80fed | 2011-03-24 22:31:48 | [diff] [blame] | 10 | #include "base/logging.h" |
[email protected] | 942e202 | 2011-04-07 22:27:43 | [diff] [blame] | 11 | #include "base/memory/scoped_ptr.h" |
[email protected] | 4969b012 | 2012-06-16 01:58:28 | [diff] [blame] | 12 | #include "base/single_thread_task_runner.h" |
| 13 | #include "base/thread_task_runner_handle.h" |
[email protected] | 942e202 | 2011-04-07 22:27:43 | [diff] [blame] | 14 | #include "base/threading/thread.h" |
[email protected] | 1f7eba7 | 2012-05-30 09:10:17 | [diff] [blame] | 15 | #include "jingle/notifier/listener/push_client.h" |
[email protected] | df006cbc | 2014-01-22 18:36:20 | [diff] [blame] | 16 | #include "sync/notifier/gcm_network_channel_delegate.h" |
[email protected] | b7fe4b5 | 2012-04-19 14:21:09 | [diff] [blame] | 17 | #include "sync/notifier/invalidation_notifier.h" |
[email protected] | a7b1639 | 2013-11-26 22:46:26 | [diff] [blame] | 18 | #include "sync/notifier/object_id_invalidation_map.h" |
[email protected] | 04a830a | 2014-01-04 02:48:51 | [diff] [blame] | 19 | #include "sync/notifier/sync_system_resources.h" |
[email protected] | 0a80fed | 2011-03-24 22:31:48 | [diff] [blame] | 20 | |
[email protected] | 65f17355 | 2012-06-28 22:43:58 | [diff] [blame] | 21 | namespace syncer { |
[email protected] | 0a80fed | 2011-03-24 22:31:48 | [diff] [blame] | 22 | |
[email protected] | 04a830a | 2014-01-04 02:48:51 | [diff] [blame] | 23 | struct NonBlockingInvalidator::InitializeOptions { |
| 24 | InitializeOptions( |
| 25 | NetworkChannelCreator network_channel_creator, |
| 26 | const std::string& invalidator_client_id, |
| 27 | const UnackedInvalidationsMap& saved_invalidations, |
| 28 | const std::string& invalidation_bootstrap_data, |
| 29 | const WeakHandle<InvalidationStateTracker>& |
| 30 | invalidation_state_tracker, |
| 31 | const std::string& client_info, |
| 32 | scoped_refptr<net::URLRequestContextGetter> request_context_getter) |
| 33 | : network_channel_creator(network_channel_creator), |
| 34 | invalidator_client_id(invalidator_client_id), |
| 35 | saved_invalidations(saved_invalidations), |
| 36 | invalidation_bootstrap_data(invalidation_bootstrap_data), |
| 37 | invalidation_state_tracker(invalidation_state_tracker), |
| 38 | client_info(client_info), |
| 39 | request_context_getter(request_context_getter) { |
| 40 | } |
| 41 | |
| 42 | NetworkChannelCreator network_channel_creator; |
| 43 | std::string invalidator_client_id; |
| 44 | UnackedInvalidationsMap saved_invalidations; |
| 45 | std::string invalidation_bootstrap_data; |
| 46 | WeakHandle<InvalidationStateTracker> invalidation_state_tracker; |
| 47 | std::string client_info; |
| 48 | scoped_refptr<net::URLRequestContextGetter> request_context_getter; |
| 49 | }; |
| 50 | |
| 51 | |
[email protected] | a329cb8 | 2012-08-28 03:17:58 | [diff] [blame] | 52 | class NonBlockingInvalidator::Core |
| 53 | : public base::RefCountedThreadSafe<NonBlockingInvalidator::Core>, |
| 54 | // InvalidationHandler to observe the InvalidationNotifier we create. |
| 55 | public InvalidationHandler { |
[email protected] | 942e202 | 2011-04-07 22:27:43 | [diff] [blame] | 56 | public: |
[email protected] | b9908a24 | 2011-11-19 09:31:32 | [diff] [blame] | 57 | // Called on parent thread. |delegate_observer| should be |
| 58 | // initialized. |
| 59 | explicit Core( |
[email protected] | a329cb8 | 2012-08-28 03:17:58 | [diff] [blame] | 60 | const WeakHandle<InvalidationHandler>& delegate_observer); |
[email protected] | 942e202 | 2011-04-07 22:27:43 | [diff] [blame] | 61 | |
| 62 | // Helpers called on I/O thread. |
[email protected] | e3b0ee5 | 2011-10-12 03:04:13 | [diff] [blame] | 63 | void Initialize( |
[email protected] | 04a830a | 2014-01-04 02:48:51 | [diff] [blame] | 64 | const NonBlockingInvalidator::InitializeOptions& initialize_options); |
[email protected] | 942e202 | 2011-04-07 22:27:43 | [diff] [blame] | 65 | void Teardown(); |
[email protected] | d914f02 | 2012-07-27 02:02:00 | [diff] [blame] | 66 | void UpdateRegisteredIds(const ObjectIdSet& ids); |
[email protected] | 942e202 | 2011-04-07 22:27:43 | [diff] [blame] | 67 | void UpdateCredentials(const std::string& email, const std::string& token); |
[email protected] | 942e202 | 2011-04-07 22:27:43 | [diff] [blame] | 68 | |
[email protected] | a329cb8 | 2012-08-28 03:17:58 | [diff] [blame] | 69 | // InvalidationHandler implementation (all called on I/O thread by |
[email protected] | 7800d79 | 2012-05-30 02:34:48 | [diff] [blame] | 70 | // InvalidationNotifier). |
[email protected] | 08a6f999 | 2012-09-07 19:19:16 | [diff] [blame] | 71 | virtual void OnInvalidatorStateChange(InvalidatorState reason) OVERRIDE; |
| 72 | virtual void OnIncomingInvalidation( |
[email protected] | 0d0b59d | 2013-02-02 00:24:47 | [diff] [blame] | 73 | const ObjectIdInvalidationMap& invalidation_map) OVERRIDE; |
[email protected] | 9b0d66b | 2014-02-20 13:16:01 | [diff] [blame^] | 74 | virtual std::string GetOwnerName() const OVERRIDE; |
[email protected] | 942e202 | 2011-04-07 22:27:43 | [diff] [blame] | 75 | |
| 76 | private: |
| 77 | friend class |
[email protected] | a329cb8 | 2012-08-28 03:17:58 | [diff] [blame] | 78 | base::RefCountedThreadSafe<NonBlockingInvalidator::Core>; |
[email protected] | 942e202 | 2011-04-07 22:27:43 | [diff] [blame] | 79 | // Called on parent or I/O thread. |
[email protected] | 6d44a14e | 2013-02-07 22:19:56 | [diff] [blame] | 80 | virtual ~Core(); |
[email protected] | 942e202 | 2011-04-07 22:27:43 | [diff] [blame] | 81 | |
[email protected] | b9908a24 | 2011-11-19 09:31:32 | [diff] [blame] | 82 | // The variables below should be used only on the I/O thread. |
[email protected] | a329cb8 | 2012-08-28 03:17:58 | [diff] [blame] | 83 | const WeakHandle<InvalidationHandler> delegate_observer_; |
[email protected] | 942e202 | 2011-04-07 22:27:43 | [diff] [blame] | 84 | scoped_ptr<InvalidationNotifier> invalidation_notifier_; |
[email protected] | 4969b012 | 2012-06-16 01:58:28 | [diff] [blame] | 85 | scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; |
[email protected] | b9908a24 | 2011-11-19 09:31:32 | [diff] [blame] | 86 | |
[email protected] | 942e202 | 2011-04-07 22:27:43 | [diff] [blame] | 87 | DISALLOW_COPY_AND_ASSIGN(Core); |
| 88 | }; |
| 89 | |
[email protected] | a329cb8 | 2012-08-28 03:17:58 | [diff] [blame] | 90 | NonBlockingInvalidator::Core::Core( |
| 91 | const WeakHandle<InvalidationHandler>& delegate_observer) |
[email protected] | b9908a24 | 2011-11-19 09:31:32 | [diff] [blame] | 92 | : delegate_observer_(delegate_observer) { |
| 93 | DCHECK(delegate_observer_.IsInitialized()); |
[email protected] | 942e202 | 2011-04-07 22:27:43 | [diff] [blame] | 94 | } |
| 95 | |
[email protected] | a329cb8 | 2012-08-28 03:17:58 | [diff] [blame] | 96 | NonBlockingInvalidator::Core::~Core() { |
[email protected] | 942e202 | 2011-04-07 22:27:43 | [diff] [blame] | 97 | } |
| 98 | |
[email protected] | a329cb8 | 2012-08-28 03:17:58 | [diff] [blame] | 99 | void NonBlockingInvalidator::Core::Initialize( |
[email protected] | 04a830a | 2014-01-04 02:48:51 | [diff] [blame] | 100 | const NonBlockingInvalidator::InitializeOptions& initialize_options) { |
| 101 | DCHECK(initialize_options.request_context_getter.get()); |
| 102 | network_task_runner_ = |
| 103 | initialize_options.request_context_getter->GetNetworkTaskRunner(); |
[email protected] | 4969b012 | 2012-06-16 01:58:28 | [diff] [blame] | 104 | DCHECK(network_task_runner_->BelongsToCurrentThread()); |
[email protected] | 04a830a | 2014-01-04 02:48:51 | [diff] [blame] | 105 | scoped_ptr<SyncNetworkChannel> network_channel = |
| 106 | initialize_options.network_channel_creator.Run(); |
[email protected] | 942e202 | 2011-04-07 22:27:43 | [diff] [blame] | 107 | invalidation_notifier_.reset( |
[email protected] | e3b0ee5 | 2011-10-12 03:04:13 | [diff] [blame] | 108 | new InvalidationNotifier( |
[email protected] | 04a830a | 2014-01-04 02:48:51 | [diff] [blame] | 109 | network_channel.Pass(), |
| 110 | initialize_options.invalidator_client_id, |
| 111 | initialize_options.saved_invalidations, |
| 112 | initialize_options.invalidation_bootstrap_data, |
| 113 | initialize_options.invalidation_state_tracker, |
| 114 | initialize_options.client_info)); |
[email protected] | 85b25eb | 2012-08-10 19:32:08 | [diff] [blame] | 115 | invalidation_notifier_->RegisterHandler(this); |
[email protected] | 942e202 | 2011-04-07 22:27:43 | [diff] [blame] | 116 | } |
| 117 | |
[email protected] | a329cb8 | 2012-08-28 03:17:58 | [diff] [blame] | 118 | void NonBlockingInvalidator::Core::Teardown() { |
[email protected] | 4969b012 | 2012-06-16 01:58:28 | [diff] [blame] | 119 | DCHECK(network_task_runner_->BelongsToCurrentThread()); |
[email protected] | 85b25eb | 2012-08-10 19:32:08 | [diff] [blame] | 120 | invalidation_notifier_->UnregisterHandler(this); |
[email protected] | 942e202 | 2011-04-07 22:27:43 | [diff] [blame] | 121 | invalidation_notifier_.reset(); |
[email protected] | 4969b012 | 2012-06-16 01:58:28 | [diff] [blame] | 122 | network_task_runner_ = NULL; |
[email protected] | 942e202 | 2011-04-07 22:27:43 | [diff] [blame] | 123 | } |
| 124 | |
[email protected] | a329cb8 | 2012-08-28 03:17:58 | [diff] [blame] | 125 | void NonBlockingInvalidator::Core::UpdateRegisteredIds(const ObjectIdSet& ids) { |
[email protected] | d914f02 | 2012-07-27 02:02:00 | [diff] [blame] | 126 | DCHECK(network_task_runner_->BelongsToCurrentThread()); |
| 127 | invalidation_notifier_->UpdateRegisteredIds(this, ids); |
| 128 | } |
| 129 | |
[email protected] | a329cb8 | 2012-08-28 03:17:58 | [diff] [blame] | 130 | void NonBlockingInvalidator::Core::UpdateCredentials(const std::string& email, |
| 131 | const std::string& token) { |
[email protected] | 4969b012 | 2012-06-16 01:58:28 | [diff] [blame] | 132 | DCHECK(network_task_runner_->BelongsToCurrentThread()); |
[email protected] | 942e202 | 2011-04-07 22:27:43 | [diff] [blame] | 133 | invalidation_notifier_->UpdateCredentials(email, token); |
| 134 | } |
| 135 | |
[email protected] | 08a6f999 | 2012-09-07 19:19:16 | [diff] [blame] | 136 | void NonBlockingInvalidator::Core::OnInvalidatorStateChange( |
| 137 | InvalidatorState reason) { |
[email protected] | 2d3d1d1 | 2012-06-18 20:50:28 | [diff] [blame] | 138 | DCHECK(network_task_runner_->BelongsToCurrentThread()); |
| 139 | delegate_observer_.Call( |
[email protected] | 08a6f999 | 2012-09-07 19:19:16 | [diff] [blame] | 140 | FROM_HERE, &InvalidationHandler::OnInvalidatorStateChange, reason); |
[email protected] | 2d3d1d1 | 2012-06-18 20:50:28 | [diff] [blame] | 141 | } |
| 142 | |
[email protected] | 08a6f999 | 2012-09-07 19:19:16 | [diff] [blame] | 143 | void NonBlockingInvalidator::Core::OnIncomingInvalidation( |
[email protected] | 0d0b59d | 2013-02-02 00:24:47 | [diff] [blame] | 144 | const ObjectIdInvalidationMap& invalidation_map) { |
[email protected] | 4969b012 | 2012-06-16 01:58:28 | [diff] [blame] | 145 | DCHECK(network_task_runner_->BelongsToCurrentThread()); |
[email protected] | b9908a24 | 2011-11-19 09:31:32 | [diff] [blame] | 146 | delegate_observer_.Call(FROM_HERE, |
[email protected] | 08a6f999 | 2012-09-07 19:19:16 | [diff] [blame] | 147 | &InvalidationHandler::OnIncomingInvalidation, |
[email protected] | 0d0b59d | 2013-02-02 00:24:47 | [diff] [blame] | 148 | invalidation_map); |
[email protected] | 942e202 | 2011-04-07 22:27:43 | [diff] [blame] | 149 | } |
| 150 | |
[email protected] | 9b0d66b | 2014-02-20 13:16:01 | [diff] [blame^] | 151 | std::string NonBlockingInvalidator::Core::GetOwnerName() const { |
| 152 | return "Sync"; |
| 153 | } |
| 154 | |
[email protected] | a329cb8 | 2012-08-28 03:17:58 | [diff] [blame] | 155 | NonBlockingInvalidator::NonBlockingInvalidator( |
[email protected] | 04a830a | 2014-01-04 02:48:51 | [diff] [blame] | 156 | NetworkChannelCreator network_channel_creator, |
[email protected] | d551123 | 2013-03-28 01:34:54 | [diff] [blame] | 157 | const std::string& invalidator_client_id, |
[email protected] | a7b1639 | 2013-11-26 22:46:26 | [diff] [blame] | 158 | const UnackedInvalidationsMap& saved_invalidations, |
[email protected] | 8cdb689 | 2012-10-03 05:54:40 | [diff] [blame] | 159 | const std::string& invalidation_bootstrap_data, |
[email protected] | d45f0d9 | 2012-07-20 17:25:41 | [diff] [blame] | 160 | const WeakHandle<InvalidationStateTracker>& |
[email protected] | 46e43ee | 2012-05-18 19:24:41 | [diff] [blame] | 161 | invalidation_state_tracker, |
[email protected] | 04a830a | 2014-01-04 02:48:51 | [diff] [blame] | 162 | const std::string& client_info, |
| 163 | const scoped_refptr<net::URLRequestContextGetter>& request_context_getter) |
[email protected] | 37d5b347 | 2013-10-10 16:20:36 | [diff] [blame] | 164 | : parent_task_runner_(base::ThreadTaskRunnerHandle::Get()), |
[email protected] | 04a830a | 2014-01-04 02:48:51 | [diff] [blame] | 165 | network_task_runner_(request_context_getter->GetNetworkTaskRunner()), |
[email protected] | 37d5b347 | 2013-10-10 16:20:36 | [diff] [blame] | 166 | weak_ptr_factory_(this) { |
| 167 | core_ = new Core(MakeWeakHandle(weak_ptr_factory_.GetWeakPtr())); |
| 168 | |
[email protected] | 04a830a | 2014-01-04 02:48:51 | [diff] [blame] | 169 | InitializeOptions initialize_options( |
| 170 | network_channel_creator, |
| 171 | invalidator_client_id, |
| 172 | saved_invalidations, |
| 173 | invalidation_bootstrap_data, |
| 174 | invalidation_state_tracker, |
| 175 | client_info, |
| 176 | request_context_getter); |
| 177 | |
[email protected] | 4969b012 | 2012-06-16 01:58:28 | [diff] [blame] | 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( |
[email protected] | a329cb8 | 2012-08-28 03:17:58 | [diff] [blame] | 181 | &NonBlockingInvalidator::Core::Initialize, |
[email protected] | 09e170f | 2011-10-28 23:22:02 | [diff] [blame] | 182 | core_.get(), |
[email protected] | 04a830a | 2014-01-04 02:48:51 | [diff] [blame] | 183 | initialize_options))) { |
[email protected] | daf4e10 | 2011-04-26 08:30:28 | [diff] [blame] | 184 | NOTREACHED(); |
[email protected] | 0a561205 | 2011-06-29 03:29:18 | [diff] [blame] | 185 | } |
[email protected] | 0a80fed | 2011-03-24 22:31:48 | [diff] [blame] | 186 | } |
| 187 | |
[email protected] | a329cb8 | 2012-08-28 03:17:58 | [diff] [blame] | 188 | NonBlockingInvalidator::~NonBlockingInvalidator() { |
[email protected] | 4969b012 | 2012-06-16 01:58:28 | [diff] [blame] | 189 | DCHECK(parent_task_runner_->BelongsToCurrentThread()); |
| 190 | if (!network_task_runner_->PostTask( |
[email protected] | daf4e10 | 2011-04-26 08:30:28 | [diff] [blame] | 191 | FROM_HERE, |
[email protected] | a329cb8 | 2012-08-28 03:17:58 | [diff] [blame] | 192 | base::Bind(&NonBlockingInvalidator::Core::Teardown, |
[email protected] | 09e170f | 2011-10-28 23:22:02 | [diff] [blame] | 193 | core_.get()))) { |
[email protected] | 93dcabfb | 2013-07-31 01:31:55 | [diff] [blame] | 194 | DVLOG(1) << "Network thread stopped before invalidator is destroyed."; |
[email protected] | 0a561205 | 2011-06-29 03:29:18 | [diff] [blame] | 195 | } |
[email protected] | 0a80fed | 2011-03-24 22:31:48 | [diff] [blame] | 196 | } |
| 197 | |
[email protected] | a329cb8 | 2012-08-28 03:17:58 | [diff] [blame] | 198 | void NonBlockingInvalidator::RegisterHandler(InvalidationHandler* handler) { |
[email protected] | 6529382 | 2012-08-10 04:07:19 | [diff] [blame] | 199 | DCHECK(parent_task_runner_->BelongsToCurrentThread()); |
[email protected] | 85b25eb | 2012-08-10 19:32:08 | [diff] [blame] | 200 | registrar_.RegisterHandler(handler); |
| 201 | } |
| 202 | |
[email protected] | a329cb8 | 2012-08-28 03:17:58 | [diff] [blame] | 203 | void NonBlockingInvalidator::UpdateRegisteredIds(InvalidationHandler* handler, |
| 204 | const ObjectIdSet& ids) { |
[email protected] | 85b25eb | 2012-08-10 19:32:08 | [diff] [blame] | 205 | DCHECK(parent_task_runner_->BelongsToCurrentThread()); |
| 206 | registrar_.UpdateRegisteredIds(handler, ids); |
[email protected] | d914f02 | 2012-07-27 02:02:00 | [diff] [blame] | 207 | if (!network_task_runner_->PostTask( |
| 208 | FROM_HERE, |
| 209 | base::Bind( |
[email protected] | a329cb8 | 2012-08-28 03:17:58 | [diff] [blame] | 210 | &NonBlockingInvalidator::Core::UpdateRegisteredIds, |
[email protected] | d914f02 | 2012-07-27 02:02:00 | [diff] [blame] | 211 | core_.get(), |
[email protected] | 85b25eb | 2012-08-10 19:32:08 | [diff] [blame] | 212 | registrar_.GetAllRegisteredIds()))) { |
[email protected] | d914f02 | 2012-07-27 02:02:00 | [diff] [blame] | 213 | NOTREACHED(); |
| 214 | } |
[email protected] | 0a80fed | 2011-03-24 22:31:48 | [diff] [blame] | 215 | } |
| 216 | |
[email protected] | a329cb8 | 2012-08-28 03:17:58 | [diff] [blame] | 217 | void NonBlockingInvalidator::UnregisterHandler(InvalidationHandler* handler) { |
[email protected] | 85b25eb | 2012-08-10 19:32:08 | [diff] [blame] | 218 | DCHECK(parent_task_runner_->BelongsToCurrentThread()); |
| 219 | registrar_.UnregisterHandler(handler); |
| 220 | } |
| 221 | |
[email protected] | 08a6f999 | 2012-09-07 19:19:16 | [diff] [blame] | 222 | InvalidatorState NonBlockingInvalidator::GetInvalidatorState() const { |
| 223 | DCHECK(parent_task_runner_->BelongsToCurrentThread()); |
| 224 | return registrar_.GetInvalidatorState(); |
| 225 | } |
| 226 | |
[email protected] | a329cb8 | 2012-08-28 03:17:58 | [diff] [blame] | 227 | void NonBlockingInvalidator::UpdateCredentials(const std::string& email, |
| 228 | const std::string& token) { |
[email protected] | 4969b012 | 2012-06-16 01:58:28 | [diff] [blame] | 229 | DCHECK(parent_task_runner_->BelongsToCurrentThread()); |
| 230 | if (!network_task_runner_->PostTask( |
[email protected] | daf4e10 | 2011-04-26 08:30:28 | [diff] [blame] | 231 | FROM_HERE, |
[email protected] | a329cb8 | 2012-08-28 03:17:58 | [diff] [blame] | 232 | base::Bind(&NonBlockingInvalidator::Core::UpdateCredentials, |
[email protected] | 09e170f | 2011-10-28 23:22:02 | [diff] [blame] | 233 | core_.get(), email, token))) { |
[email protected] | daf4e10 | 2011-04-26 08:30:28 | [diff] [blame] | 234 | NOTREACHED(); |
[email protected] | 0a561205 | 2011-06-29 03:29:18 | [diff] [blame] | 235 | } |
[email protected] | 0a80fed | 2011-03-24 22:31:48 | [diff] [blame] | 236 | } |
| 237 | |
[email protected] | 08a6f999 | 2012-09-07 19:19:16 | [diff] [blame] | 238 | void NonBlockingInvalidator::OnInvalidatorStateChange(InvalidatorState state) { |
[email protected] | 2d3d1d1 | 2012-06-18 20:50:28 | [diff] [blame] | 239 | DCHECK(parent_task_runner_->BelongsToCurrentThread()); |
[email protected] | 08a6f999 | 2012-09-07 19:19:16 | [diff] [blame] | 240 | registrar_.UpdateInvalidatorState(state); |
[email protected] | 2d3d1d1 | 2012-06-18 20:50:28 | [diff] [blame] | 241 | } |
| 242 | |
[email protected] | 08a6f999 | 2012-09-07 19:19:16 | [diff] [blame] | 243 | void NonBlockingInvalidator::OnIncomingInvalidation( |
[email protected] | 0d0b59d | 2013-02-02 00:24:47 | [diff] [blame] | 244 | const ObjectIdInvalidationMap& invalidation_map) { |
[email protected] | 4969b012 | 2012-06-16 01:58:28 | [diff] [blame] | 245 | DCHECK(parent_task_runner_->BelongsToCurrentThread()); |
[email protected] | 0d0b59d | 2013-02-02 00:24:47 | [diff] [blame] | 246 | registrar_.DispatchInvalidationsToHandlers(invalidation_map); |
[email protected] | b9908a24 | 2011-11-19 09:31:32 | [diff] [blame] | 247 | } |
| 248 | |
[email protected] | 9b0d66b | 2014-02-20 13:16:01 | [diff] [blame^] | 249 | std::string NonBlockingInvalidator::GetOwnerName() const { return "Sync"; } |
| 250 | |
[email protected] | 04a830a | 2014-01-04 02:48:51 | [diff] [blame] | 251 | NetworkChannelCreator |
| 252 | NonBlockingInvalidator::MakePushClientChannelCreator( |
| 253 | const notifier::NotifierOptions& notifier_options) { |
| 254 | return base::Bind(SyncNetworkChannel::CreatePushClientChannel, |
| 255 | notifier_options); |
| 256 | } |
| 257 | |
[email protected] | df006cbc | 2014-01-22 18:36:20 | [diff] [blame] | 258 | NetworkChannelCreator NonBlockingInvalidator::MakeGCMNetworkChannelCreator( |
| 259 | scoped_refptr<net::URLRequestContextGetter> request_context_getter, |
| 260 | scoped_ptr<GCMNetworkChannelDelegate> delegate) { |
| 261 | return base::Bind(&SyncNetworkChannel::CreateGCMNetworkChannel, |
| 262 | request_context_getter, |
| 263 | base::Passed(&delegate)); |
[email protected] | 04a830a | 2014-01-04 02:48:51 | [diff] [blame] | 264 | } |
| 265 | |
[email protected] | 65f17355 | 2012-06-28 22:43:58 | [diff] [blame] | 266 | } // namespace syncer |