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()) { |
akalin
2011/01/12 09:55:19
No need for the has_payload() check, assuming the
Nicolas Zea
2011/01/13 19:17:30
The has_payload is method isn't a protobuf defined
akalin
2011/01/13 19:47:41
Ah, I forgot about that. How about:
std::string
Nicolas Zea
2011/01/18 06:07:23
Done.
| |
130 listener_->OnInvalidate(model_type, invalidation.payload()); | |
131 } else { | |
132 listener_->OnInvalidate(model_type, std::string("")); | |
133 } | |
130 } else { | 134 } else { |
131 LOG(WARNING) << "Could not get invalidation model type; " | 135 LOG(WARNING) << "Could not get invalidation model type; " |
132 << "invalidating everything"; | 136 << "invalidating everything"; |
133 listener_->OnInvalidateAll(); | 137 listener_->OnInvalidateAll(); |
134 } | 138 } |
135 RunAndDeleteClosure(callback); | 139 RunAndDeleteClosure(callback); |
136 } | 140 } |
137 | 141 |
138 void ChromeInvalidationClient::InvalidateAll( | 142 void ChromeInvalidationClient::InvalidateAll( |
139 invalidation::Closure* callback) { | 143 invalidation::Closure* callback) { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
202 | 206 |
203 void ChromeInvalidationClient::HandleOutboundPacket( | 207 void ChromeInvalidationClient::HandleOutboundPacket( |
204 invalidation::NetworkEndpoint* const& network_endpoint) { | 208 invalidation::NetworkEndpoint* const& network_endpoint) { |
205 DCHECK(non_thread_safe_.CalledOnValidThread()); | 209 DCHECK(non_thread_safe_.CalledOnValidThread()); |
206 CHECK(cache_invalidation_packet_handler_.get()); | 210 CHECK(cache_invalidation_packet_handler_.get()); |
207 cache_invalidation_packet_handler_-> | 211 cache_invalidation_packet_handler_-> |
208 HandleOutboundPacket(network_endpoint); | 212 HandleOutboundPacket(network_endpoint); |
209 } | 213 } |
210 | 214 |
211 } // namespace sync_notifier | 215 } // namespace sync_notifier |
OLD | NEW |