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/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
119 } | 119 } |
120 | 120 |
121 void ChromeInvalidationClient::Invalidate( | 121 void ChromeInvalidationClient::Invalidate( |
122 const invalidation::Invalidation& invalidation, | 122 const invalidation::Invalidation& invalidation, |
123 invalidation::Closure* callback) { | 123 invalidation::Closure* callback) { |
124 DCHECK(non_thread_safe_.CalledOnValidThread()); | 124 DCHECK(non_thread_safe_.CalledOnValidThread()); |
125 DCHECK(invalidation::IsCallbackRepeatable(callback)); | 125 DCHECK(invalidation::IsCallbackRepeatable(callback)); |
126 VLOG(1) << "Invalidate: " << InvalidationToString(invalidation); | 126 VLOG(1) << "Invalidate: " << InvalidationToString(invalidation); |
127 syncable::ModelType model_type; | 127 syncable::ModelType model_type; |
128 if (ObjectIdToRealModelType(invalidation.object_id(), &model_type)) { | 128 if (ObjectIdToRealModelType(invalidation.object_id(), &model_type)) { |
129 listener_->OnInvalidate(model_type); | 129 if (invalidation.has_payload()) { |
130 listener_->OnInvalidate(model_type, invalidation.payload()); | |
131 } else { | |
132 LOG(WARNING) << "Received invalidation without payload."; | |
133 listener_->OnInvalidate(model_type, ""); | |
tim (not reviewing)
2011/01/11 23:20:02
nit - use std::string() instead of "" to save on g
Nicolas Zea
2011/01/12 00:11:37
Done.
| |
134 } | |
130 } else { | 135 } else { |
131 LOG(WARNING) << "Could not get invalidation model type; " | 136 LOG(WARNING) << "Could not get invalidation model type; " |
132 << "invalidating everything"; | 137 << "invalidating everything"; |
133 listener_->OnInvalidateAll(); | 138 listener_->OnInvalidateAll(); |
134 } | 139 } |
135 RunAndDeleteClosure(callback); | 140 RunAndDeleteClosure(callback); |
136 } | 141 } |
137 | 142 |
138 void ChromeInvalidationClient::InvalidateAll( | 143 void ChromeInvalidationClient::InvalidateAll( |
139 invalidation::Closure* callback) { | 144 invalidation::Closure* callback) { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
202 | 207 |
203 void ChromeInvalidationClient::HandleOutboundPacket( | 208 void ChromeInvalidationClient::HandleOutboundPacket( |
204 invalidation::NetworkEndpoint* const& network_endpoint) { | 209 invalidation::NetworkEndpoint* const& network_endpoint) { |
205 DCHECK(non_thread_safe_.CalledOnValidThread()); | 210 DCHECK(non_thread_safe_.CalledOnValidThread()); |
206 CHECK(cache_invalidation_packet_handler_.get()); | 211 CHECK(cache_invalidation_packet_handler_.get()); |
207 cache_invalidation_packet_handler_-> | 212 cache_invalidation_packet_handler_-> |
208 HandleOutboundPacket(network_endpoint); | 213 HandleOutboundPacket(network_endpoint); |
209 } | 214 } |
210 | 215 |
211 } // namespace sync_notifier | 216 } // namespace sync_notifier |
OLD | NEW |