| 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 #include "sync/notifier/invalidation_notifier.h" | 5 #include "sync/notifier/invalidation_notifier.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop_proxy.h" | 9 #include "base/message_loop_proxy.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 DCHECK(CalledOnValidThread()); | 45 DCHECK(CalledOnValidThread()); |
| 46 registrar_.UpdateRegisteredIds(handler, ids); | 46 registrar_.UpdateRegisteredIds(handler, ids); |
| 47 invalidation_listener_.UpdateRegisteredIds(registrar_.GetAllRegisteredIds()); | 47 invalidation_listener_.UpdateRegisteredIds(registrar_.GetAllRegisteredIds()); |
| 48 } | 48 } |
| 49 | 49 |
| 50 void InvalidationNotifier::UnregisterHandler(InvalidationHandler* handler) { | 50 void InvalidationNotifier::UnregisterHandler(InvalidationHandler* handler) { |
| 51 DCHECK(CalledOnValidThread()); | 51 DCHECK(CalledOnValidThread()); |
| 52 registrar_.UnregisterHandler(handler); | 52 registrar_.UnregisterHandler(handler); |
| 53 } | 53 } |
| 54 | 54 |
| 55 void InvalidationNotifier::Acknowledge(const invalidation::ObjectId& id, |
| 56 const AckHandle& ack_handle) { |
| 57 DCHECK(CalledOnValidThread()); |
| 58 invalidation_listener_.Acknowledge(id, ack_handle); |
| 59 } |
| 60 |
| 55 InvalidatorState InvalidationNotifier::GetInvalidatorState() const { | 61 InvalidatorState InvalidationNotifier::GetInvalidatorState() const { |
| 56 DCHECK(CalledOnValidThread()); | 62 DCHECK(CalledOnValidThread()); |
| 57 return registrar_.GetInvalidatorState(); | 63 return registrar_.GetInvalidatorState(); |
| 58 } | 64 } |
| 59 | 65 |
| 60 void InvalidationNotifier::SetUniqueId(const std::string& unique_id) { | 66 void InvalidationNotifier::SetUniqueId(const std::string& unique_id) { |
| 61 DCHECK(CalledOnValidThread()); | 67 DCHECK(CalledOnValidThread()); |
| 62 client_id_ = unique_id; | 68 client_id_ = unique_id; |
| 63 DVLOG(1) << "Setting unique ID to " << unique_id; | 69 DVLOG(1) << "Setting unique ID to " << unique_id; |
| 64 CHECK(!client_id_.empty()); | 70 CHECK(!client_id_.empty()); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 89 DCHECK(CalledOnValidThread()); | 95 DCHECK(CalledOnValidThread()); |
| 90 registrar_.DispatchInvalidationsToHandlers(invalidation_map); | 96 registrar_.DispatchInvalidationsToHandlers(invalidation_map); |
| 91 } | 97 } |
| 92 | 98 |
| 93 void InvalidationNotifier::OnInvalidatorStateChange(InvalidatorState state) { | 99 void InvalidationNotifier::OnInvalidatorStateChange(InvalidatorState state) { |
| 94 DCHECK(CalledOnValidThread()); | 100 DCHECK(CalledOnValidThread()); |
| 95 registrar_.UpdateInvalidatorState(state); | 101 registrar_.UpdateInvalidatorState(state); |
| 96 } | 102 } |
| 97 | 103 |
| 98 } // namespace syncer | 104 } // namespace syncer |
| OLD | NEW |