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 #include "components/invalidation/non_blocking_invalidator.h" | 5 #include "components/invalidation/non_blocking_invalidator.h" |
6 | 6 |
7 #include <cstddef> | 7 #include <cstddef> |
8 | 8 |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 const std::string& client_info, | 230 const std::string& client_info, |
231 const scoped_refptr<net::URLRequestContextGetter>& request_context_getter) | 231 const scoped_refptr<net::URLRequestContextGetter>& request_context_getter) |
232 : invalidation_state_tracker_(invalidation_state_tracker), | 232 : invalidation_state_tracker_(invalidation_state_tracker), |
233 parent_task_runner_(base::ThreadTaskRunnerHandle::Get()), | 233 parent_task_runner_(base::ThreadTaskRunnerHandle::Get()), |
234 network_task_runner_(request_context_getter->GetNetworkTaskRunner()), | 234 network_task_runner_(request_context_getter->GetNetworkTaskRunner()), |
235 weak_ptr_factory_(this) { | 235 weak_ptr_factory_(this) { |
236 base::WeakPtr<NonBlockingInvalidator> weak_ptr_this = | 236 base::WeakPtr<NonBlockingInvalidator> weak_ptr_this = |
237 weak_ptr_factory_.GetWeakPtr(); | 237 weak_ptr_factory_.GetWeakPtr(); |
238 weak_ptr_this.get(); // Bind to this thread. | 238 weak_ptr_this.get(); // Bind to this thread. |
239 | 239 |
240 core_ = new Core(weak_ptr_this, | 240 core_ = new Core(weak_ptr_this, base::ThreadTaskRunnerHandle::Get()); |
241 base::MessageLoopProxy::current()); | |
242 | 241 |
243 InitializeOptions initialize_options(network_channel_creator, | 242 InitializeOptions initialize_options( |
244 invalidator_client_id, | 243 network_channel_creator, invalidator_client_id, saved_invalidations, |
245 saved_invalidations, | 244 invalidation_bootstrap_data, weak_ptr_this, |
246 invalidation_bootstrap_data, | 245 base::ThreadTaskRunnerHandle::Get(), client_info, request_context_getter); |
247 weak_ptr_this, | |
248 base::MessageLoopProxy::current(), | |
249 client_info, | |
250 request_context_getter); | |
251 | 246 |
252 if (!network_task_runner_->PostTask( | 247 if (!network_task_runner_->PostTask( |
253 FROM_HERE, | 248 FROM_HERE, |
254 base::Bind( | 249 base::Bind( |
255 &NonBlockingInvalidator::Core::Initialize, | 250 &NonBlockingInvalidator::Core::Initialize, |
256 core_.get(), | 251 core_.get(), |
257 initialize_options))) { | 252 initialize_options))) { |
258 NOTREACHED(); | 253 NOTREACHED(); |
259 } | 254 } |
260 } | 255 } |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 | 378 |
384 void NonBlockingInvalidator::OnIncomingInvalidation( | 379 void NonBlockingInvalidator::OnIncomingInvalidation( |
385 const ObjectIdInvalidationMap& invalidation_map) { | 380 const ObjectIdInvalidationMap& invalidation_map) { |
386 DCHECK(parent_task_runner_->BelongsToCurrentThread()); | 381 DCHECK(parent_task_runner_->BelongsToCurrentThread()); |
387 registrar_.DispatchInvalidationsToHandlers(invalidation_map); | 382 registrar_.DispatchInvalidationsToHandlers(invalidation_map); |
388 } | 383 } |
389 | 384 |
390 std::string NonBlockingInvalidator::GetOwnerName() const { return "Sync"; } | 385 std::string NonBlockingInvalidator::GetOwnerName() const { return "Sync"; } |
391 | 386 |
392 } // namespace syncer | 387 } // namespace syncer |
OLD | NEW |