OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/sync/notifier/chrome_invalidation_client.h" | 5 #include "chrome/browser/sync/notifier/chrome_invalidation_client.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 // with server-issued notifications. Remove this when it's not | 89 // with server-issued notifications. Remove this when it's not |
90 // needed anymore. | 90 // needed anymore. |
91 registration_manager_->RegisterType(syncable::UNSPECIFIED); | 91 registration_manager_->RegisterType(syncable::UNSPECIFIED); |
92 } | 92 } |
93 | 93 |
94 void ChromeInvalidationClient::Invalidate( | 94 void ChromeInvalidationClient::Invalidate( |
95 const invalidation::Invalidation& invalidation, | 95 const invalidation::Invalidation& invalidation, |
96 invalidation::Closure* callback) { | 96 invalidation::Closure* callback) { |
97 DCHECK(non_thread_safe_.CalledOnValidThread()); | 97 DCHECK(non_thread_safe_.CalledOnValidThread()); |
98 DCHECK(invalidation::IsCallbackRepeatable(callback)); | 98 DCHECK(invalidation::IsCallbackRepeatable(callback)); |
99 LOG(INFO) << "Invalidate: " << InvalidationToString(invalidation); | 99 VLOG(1) << "Invalidate: " << InvalidationToString(invalidation); |
100 syncable::ModelType model_type; | 100 syncable::ModelType model_type; |
101 if (ObjectIdToRealModelType(invalidation.object_id(), &model_type)) { | 101 if (ObjectIdToRealModelType(invalidation.object_id(), &model_type)) { |
102 listener_->OnInvalidate(model_type); | 102 listener_->OnInvalidate(model_type); |
103 } else { | 103 } else { |
104 LOG(WARNING) << "Could not get invalidation model type; " | 104 LOG(WARNING) << "Could not get invalidation model type; " |
105 << "invalidating everything"; | 105 << "invalidating everything"; |
106 listener_->OnInvalidateAll(); | 106 listener_->OnInvalidateAll(); |
107 } | 107 } |
108 RunAndDeleteClosure(callback); | 108 RunAndDeleteClosure(callback); |
109 } | 109 } |
110 | 110 |
111 void ChromeInvalidationClient::InvalidateAll( | 111 void ChromeInvalidationClient::InvalidateAll( |
112 invalidation::Closure* callback) { | 112 invalidation::Closure* callback) { |
113 DCHECK(non_thread_safe_.CalledOnValidThread()); | 113 DCHECK(non_thread_safe_.CalledOnValidThread()); |
114 DCHECK(invalidation::IsCallbackRepeatable(callback)); | 114 DCHECK(invalidation::IsCallbackRepeatable(callback)); |
115 LOG(INFO) << "InvalidateAll"; | 115 VLOG(1) << "InvalidateAll"; |
116 listener_->OnInvalidateAll(); | 116 listener_->OnInvalidateAll(); |
117 RunAndDeleteClosure(callback); | 117 RunAndDeleteClosure(callback); |
118 } | 118 } |
119 | 119 |
120 void ChromeInvalidationClient::AllRegistrationsLost( | 120 void ChromeInvalidationClient::AllRegistrationsLost( |
121 invalidation::Closure* callback) { | 121 invalidation::Closure* callback) { |
122 DCHECK(non_thread_safe_.CalledOnValidThread()); | 122 DCHECK(non_thread_safe_.CalledOnValidThread()); |
123 DCHECK(invalidation::IsCallbackRepeatable(callback)); | 123 DCHECK(invalidation::IsCallbackRepeatable(callback)); |
124 LOG(INFO) << "AllRegistrationsLost"; | 124 VLOG(1) << "AllRegistrationsLost"; |
125 registration_manager_->MarkAllRegistrationsLost(); | 125 registration_manager_->MarkAllRegistrationsLost(); |
126 RunAndDeleteClosure(callback); | 126 RunAndDeleteClosure(callback); |
127 } | 127 } |
128 | 128 |
129 void ChromeInvalidationClient::RegistrationLost( | 129 void ChromeInvalidationClient::RegistrationLost( |
130 const invalidation::ObjectId& object_id, | 130 const invalidation::ObjectId& object_id, |
131 invalidation::Closure* callback) { | 131 invalidation::Closure* callback) { |
132 DCHECK(non_thread_safe_.CalledOnValidThread()); | 132 DCHECK(non_thread_safe_.CalledOnValidThread()); |
133 DCHECK(invalidation::IsCallbackRepeatable(callback)); | 133 DCHECK(invalidation::IsCallbackRepeatable(callback)); |
134 LOG(INFO) << "RegistrationLost: " << ObjectIdToString(object_id); | 134 VLOG(1) << "RegistrationLost: " << ObjectIdToString(object_id); |
135 syncable::ModelType model_type; | 135 syncable::ModelType model_type; |
136 if (ObjectIdToRealModelType(object_id, &model_type)) { | 136 if (ObjectIdToRealModelType(object_id, &model_type)) { |
137 registration_manager_->MarkRegistrationLost(model_type); | 137 registration_manager_->MarkRegistrationLost(model_type); |
138 } else { | 138 } else { |
139 LOG(WARNING) << "Could not get object id model type; ignoring"; | 139 LOG(WARNING) << "Could not get object id model type; ignoring"; |
140 } | 140 } |
141 RunAndDeleteClosure(callback); | 141 RunAndDeleteClosure(callback); |
142 } | 142 } |
143 | 143 |
144 } // namespace sync_notifier | 144 } // namespace sync_notifier |
OLD | NEW |