Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(319)

Side by Side Diff: chrome/browser/sync/glue/sync_backend_host.cc

Issue 10911084: Implement Invalidator::Acknowledge (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #include "chrome/browser/sync/glue/sync_backend_host.h" 7 #include "chrome/browser/sync/glue/sync_backend_host.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <map> 10 #include <map>
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 void DoInitialize(const DoInitializeOptions& options); 146 void DoInitialize(const DoInitializeOptions& options);
147 147
148 // Called to perform credential update on behalf of 148 // Called to perform credential update on behalf of
149 // SyncBackendHost::UpdateCredentials. 149 // SyncBackendHost::UpdateCredentials.
150 void DoUpdateCredentials(const syncer::SyncCredentials& credentials); 150 void DoUpdateCredentials(const syncer::SyncCredentials& credentials);
151 151
152 // Called to update the given registered ids on behalf of 152 // Called to update the given registered ids on behalf of
153 // SyncBackendHost::UpdateRegisteredInvalidationIds. 153 // SyncBackendHost::UpdateRegisteredInvalidationIds.
154 void DoUpdateRegisteredInvalidationIds(const syncer::ObjectIdSet& ids); 154 void DoUpdateRegisteredInvalidationIds(const syncer::ObjectIdSet& ids);
155 155
156 // Called to acknowledge an invalidation on behalf of
157 // SyncBackendHost::AcknowledgeInvalidation.
158 void DoAcknowledgeInvalidation(const invalidation::ObjectId& id,
159 const syncer::AckHandle& ack_handle);
160
156 // Called to tell the syncapi to start syncing (generally after 161 // Called to tell the syncapi to start syncing (generally after
157 // initialization and authentication). 162 // initialization and authentication).
158 void DoStartSyncing(const syncer::ModelSafeRoutingInfo& routing_info); 163 void DoStartSyncing(const syncer::ModelSafeRoutingInfo& routing_info);
159 164
160 // Called to set the passphrase for encryption. 165 // Called to set the passphrase for encryption.
161 void DoSetEncryptionPassphrase(const std::string& passphrase, 166 void DoSetEncryptionPassphrase(const std::string& passphrase,
162 bool is_explicit); 167 bool is_explicit);
163 168
164 // Called to decrypt the pending keys. 169 // Called to decrypt the pending keys.
165 void DoSetDecryptionPassphrase(const std::string& passphrase); 170 void DoSetDecryptionPassphrase(const std::string& passphrase);
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 475
471 void SyncBackendHost::UpdateRegisteredInvalidationIds( 476 void SyncBackendHost::UpdateRegisteredInvalidationIds(
472 const syncer::ObjectIdSet& ids) { 477 const syncer::ObjectIdSet& ids) {
473 DCHECK_EQ(MessageLoop::current(), frontend_loop_); 478 DCHECK_EQ(MessageLoop::current(), frontend_loop_);
474 DCHECK(sync_thread_.IsRunning()); 479 DCHECK(sync_thread_.IsRunning());
475 sync_thread_.message_loop()->PostTask(FROM_HERE, 480 sync_thread_.message_loop()->PostTask(FROM_HERE,
476 base::Bind(&SyncBackendHost::Core::DoUpdateRegisteredInvalidationIds, 481 base::Bind(&SyncBackendHost::Core::DoUpdateRegisteredInvalidationIds,
477 core_.get(), ids)); 482 core_.get(), ids));
478 } 483 }
479 484
485 void SyncBackendHost::AcknowledgeInvalidation(
486 const invalidation::ObjectId& id, const syncer::AckHandle& ack_handle) {
487 DCHECK_EQ(MessageLoop::current(), frontend_loop_);
488 DCHECK(sync_thread_.IsRunning());
489 sync_thread_.message_loop()->PostTask(FROM_HERE,
490 base::Bind(&SyncBackendHost::Core::DoAcknowledgeInvalidation,
491 core_.get(), id, ack_handle));
492 }
493
480 void SyncBackendHost::StartSyncingWithServer() { 494 void SyncBackendHost::StartSyncingWithServer() {
481 SDVLOG(1) << "SyncBackendHost::StartSyncingWithServer called."; 495 SDVLOG(1) << "SyncBackendHost::StartSyncingWithServer called.";
482 496
483 syncer::ModelSafeRoutingInfo routing_info; 497 syncer::ModelSafeRoutingInfo routing_info;
484 registrar_->GetModelSafeRoutingInfo(&routing_info); 498 registrar_->GetModelSafeRoutingInfo(&routing_info);
485 499
486 sync_thread_.message_loop()->PostTask(FROM_HERE, 500 sync_thread_.message_loop()->PostTask(FROM_HERE,
487 base::Bind(&SyncBackendHost::Core::DoStartSyncing, 501 base::Bind(&SyncBackendHost::Core::DoStartSyncing,
488 core_.get(), routing_info)); 502 core_.get(), routing_info));
489 } 503 }
(...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after
1230 // |sync_manager_| may end up being NULL here in tests (in 1244 // |sync_manager_| may end up being NULL here in tests (in
1231 // synchronous initialization mode) since this is called during 1245 // synchronous initialization mode) since this is called during
1232 // shutdown. 1246 // shutdown.
1233 // 1247 //
1234 // TODO(akalin): Fix this behavior (see http://crbug.com/140354). 1248 // TODO(akalin): Fix this behavior (see http://crbug.com/140354).
1235 if (sync_manager_.get()) { 1249 if (sync_manager_.get()) {
1236 sync_manager_->UpdateRegisteredInvalidationIds(this, ids); 1250 sync_manager_->UpdateRegisteredInvalidationIds(this, ids);
1237 } 1251 }
1238 } 1252 }
1239 1253
1254 void SyncBackendHost::Core::DoAcknowledgeInvalidation(
1255 const invalidation::ObjectId& id, const syncer::AckHandle& ack_handle) {
1256 DCHECK_EQ(MessageLoop::current(), sync_loop_);
1257 // |sync_manager_| may end up being NULL here in tests (in
1258 // synchronous initialization mode).
1259 //
1260 // TODO(akalin): Fix this behavior (see http://crbug.com/140354).
1261 if (sync_manager_.get()) {
1262 sync_manager_->AcknowledgeInvalidation(id, ack_handle);
1263 }
1264 }
1265
1240 void SyncBackendHost::Core::DoStartSyncing( 1266 void SyncBackendHost::Core::DoStartSyncing(
1241 const syncer::ModelSafeRoutingInfo& routing_info) { 1267 const syncer::ModelSafeRoutingInfo& routing_info) {
1242 DCHECK_EQ(MessageLoop::current(), sync_loop_); 1268 DCHECK_EQ(MessageLoop::current(), sync_loop_);
1243 sync_manager_->StartSyncingNormally(routing_info); 1269 sync_manager_->StartSyncingNormally(routing_info);
1244 } 1270 }
1245 1271
1246 void SyncBackendHost::Core::DoSetEncryptionPassphrase( 1272 void SyncBackendHost::Core::DoSetEncryptionPassphrase(
1247 const std::string& passphrase, 1273 const std::string& passphrase,
1248 bool is_explicit) { 1274 bool is_explicit) {
1249 DCHECK_EQ(MessageLoop::current(), sync_loop_); 1275 DCHECK_EQ(MessageLoop::current(), sync_loop_);
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
1630 DVLOG(1) << "Connection status changed: " 1656 DVLOG(1) << "Connection status changed: "
1631 << syncer::ConnectionStatusToString(status); 1657 << syncer::ConnectionStatusToString(status);
1632 frontend_->OnConnectionStatusChange(status); 1658 frontend_->OnConnectionStatusChange(status);
1633 } 1659 }
1634 1660
1635 #undef SDVLOG 1661 #undef SDVLOG
1636 1662
1637 #undef SLOG 1663 #undef SLOG
1638 1664
1639 } // namespace browser_sync 1665 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698