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 std::string payload; | |
130 // payload() CHECK()'s has_payload(), so we must check it ourselves first. | |
131 if (invalidation.has_payload()) | |
132 payload = invalidation.payload(); | |
133 | |
134 // TODO(akalin): This is a hack to make new sync data types work | 129 // TODO(akalin): This is a hack to make new sync data types work |
135 // with server-issued notifications. Remove this when it's not | 130 // with server-issued notifications. Remove this when it's not |
136 // needed anymore. | 131 // needed anymore. |
137 if (model_type == syncable::UNSPECIFIED) { | 132 if (model_type == syncable::UNSPECIFIED) { |
138 listener_->OnInvalidateAll(); | 133 listener_->OnInvalidateAll(); |
139 } else { | 134 } else { |
140 listener_->OnInvalidate(model_type, payload); | 135 listener_->OnInvalidate(model_type); |
141 } | 136 } |
142 } else { | 137 } else { |
143 LOG(WARNING) << "Could not get invalidation model type; " | 138 LOG(WARNING) << "Could not get invalidation model type; " |
144 << "invalidating everything"; | 139 << "invalidating everything"; |
145 listener_->OnInvalidateAll(); | 140 listener_->OnInvalidateAll(); |
146 } | 141 } |
147 RunAndDeleteClosure(callback); | 142 RunAndDeleteClosure(callback); |
148 } | 143 } |
149 | 144 |
150 void ChromeInvalidationClient::InvalidateAll( | 145 void ChromeInvalidationClient::InvalidateAll( |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 | 209 |
215 void ChromeInvalidationClient::HandleOutboundPacket( | 210 void ChromeInvalidationClient::HandleOutboundPacket( |
216 invalidation::NetworkEndpoint* const& network_endpoint) { | 211 invalidation::NetworkEndpoint* const& network_endpoint) { |
217 DCHECK(non_thread_safe_.CalledOnValidThread()); | 212 DCHECK(non_thread_safe_.CalledOnValidThread()); |
218 CHECK(cache_invalidation_packet_handler_.get()); | 213 CHECK(cache_invalidation_packet_handler_.get()); |
219 cache_invalidation_packet_handler_-> | 214 cache_invalidation_packet_handler_-> |
220 HandleOutboundPacket(network_endpoint); | 215 HandleOutboundPacket(network_endpoint); |
221 } | 216 } |
222 | 217 |
223 } // namespace sync_notifier | 218 } // namespace sync_notifier |
OLD | NEW |