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

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: Restart test + more cleanup Created 8 years, 2 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 void DoInitialize(const DoInitializeOptions& options); 142 void DoInitialize(const DoInitializeOptions& options);
143 143
144 // Called to perform credential update on behalf of 144 // Called to perform credential update on behalf of
145 // SyncBackendHost::UpdateCredentials. 145 // SyncBackendHost::UpdateCredentials.
146 void DoUpdateCredentials(const syncer::SyncCredentials& credentials); 146 void DoUpdateCredentials(const syncer::SyncCredentials& credentials);
147 147
148 // Called to update the given registered ids on behalf of 148 // Called to update the given registered ids on behalf of
149 // SyncBackendHost::UpdateRegisteredInvalidationIds. 149 // SyncBackendHost::UpdateRegisteredInvalidationIds.
150 void DoUpdateRegisteredInvalidationIds(const syncer::ObjectIdSet& ids); 150 void DoUpdateRegisteredInvalidationIds(const syncer::ObjectIdSet& ids);
151 151
152 // Called to acknowledge an invalidation on behalf of
153 // SyncBackendHost::AcknowledgeInvalidation.
154 void DoAcknowledgeInvalidation(const invalidation::ObjectId& id,
155 const syncer::AckHandle& ack_handle);
156
152 // Called to tell the syncapi to start syncing (generally after 157 // Called to tell the syncapi to start syncing (generally after
153 // initialization and authentication). 158 // initialization and authentication).
154 void DoStartSyncing(const syncer::ModelSafeRoutingInfo& routing_info); 159 void DoStartSyncing(const syncer::ModelSafeRoutingInfo& routing_info);
155 160
156 // Called to set the passphrase for encryption. 161 // Called to set the passphrase for encryption.
157 void DoSetEncryptionPassphrase(const std::string& passphrase, 162 void DoSetEncryptionPassphrase(const std::string& passphrase,
158 bool is_explicit); 163 bool is_explicit);
159 164
160 // Called to decrypt the pending keys. 165 // Called to decrypt the pending keys.
161 void DoSetDecryptionPassphrase(const std::string& passphrase); 166 void DoSetDecryptionPassphrase(const std::string& passphrase);
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 448
444 void SyncBackendHost::UpdateRegisteredInvalidationIds( 449 void SyncBackendHost::UpdateRegisteredInvalidationIds(
445 const syncer::ObjectIdSet& ids) { 450 const syncer::ObjectIdSet& ids) {
446 DCHECK_EQ(MessageLoop::current(), frontend_loop_); 451 DCHECK_EQ(MessageLoop::current(), frontend_loop_);
447 DCHECK(sync_thread_.IsRunning()); 452 DCHECK(sync_thread_.IsRunning());
448 sync_thread_.message_loop()->PostTask(FROM_HERE, 453 sync_thread_.message_loop()->PostTask(FROM_HERE,
449 base::Bind(&SyncBackendHost::Core::DoUpdateRegisteredInvalidationIds, 454 base::Bind(&SyncBackendHost::Core::DoUpdateRegisteredInvalidationIds,
450 core_.get(), ids)); 455 core_.get(), ids));
451 } 456 }
452 457
458 void SyncBackendHost::AcknowledgeInvalidation(
459 const invalidation::ObjectId& id, const syncer::AckHandle& ack_handle) {
460 DCHECK_EQ(MessageLoop::current(), frontend_loop_);
461 DCHECK(sync_thread_.IsRunning());
462 sync_thread_.message_loop()->PostTask(FROM_HERE,
463 base::Bind(&SyncBackendHost::Core::DoAcknowledgeInvalidation,
464 core_.get(), id, ack_handle));
465 }
466
453 void SyncBackendHost::StartSyncingWithServer() { 467 void SyncBackendHost::StartSyncingWithServer() {
454 SDVLOG(1) << "SyncBackendHost::StartSyncingWithServer called."; 468 SDVLOG(1) << "SyncBackendHost::StartSyncingWithServer called.";
455 469
456 syncer::ModelSafeRoutingInfo routing_info; 470 syncer::ModelSafeRoutingInfo routing_info;
457 registrar_->GetModelSafeRoutingInfo(&routing_info); 471 registrar_->GetModelSafeRoutingInfo(&routing_info);
458 472
459 sync_thread_.message_loop()->PostTask(FROM_HERE, 473 sync_thread_.message_loop()->PostTask(FROM_HERE,
460 base::Bind(&SyncBackendHost::Core::DoStartSyncing, 474 base::Bind(&SyncBackendHost::Core::DoStartSyncing,
461 core_.get(), routing_info)); 475 core_.get(), routing_info));
462 } 476 }
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after
1122 // |sync_manager_| may end up being NULL here in tests (in 1136 // |sync_manager_| may end up being NULL here in tests (in
1123 // synchronous initialization mode) since this is called during 1137 // synchronous initialization mode) since this is called during
1124 // shutdown. 1138 // shutdown.
1125 // 1139 //
1126 // TODO(akalin): Fix this behavior (see http://crbug.com/140354). 1140 // TODO(akalin): Fix this behavior (see http://crbug.com/140354).
1127 if (sync_manager_.get()) { 1141 if (sync_manager_.get()) {
1128 sync_manager_->UpdateRegisteredInvalidationIds(this, ids); 1142 sync_manager_->UpdateRegisteredInvalidationIds(this, ids);
1129 } 1143 }
1130 } 1144 }
1131 1145
1146 void SyncBackendHost::Core::DoAcknowledgeInvalidation(
1147 const invalidation::ObjectId& id, const syncer::AckHandle& ack_handle) {
1148 DCHECK_EQ(MessageLoop::current(), sync_loop_);
1149 // |sync_manager_| may end up being NULL here in tests (in
1150 // synchronous initialization mode) since this is called during
1151 // shutdown.
1152 //
1153 // TODO(akalin): Fix this behavior (see http://crbug.com/140354).
1154 if (sync_manager_.get()) {
1155 sync_manager_->AcknowledgeInvalidation(id, ack_handle);
1156 }
1157 }
1158
1132 void SyncBackendHost::Core::DoStartSyncing( 1159 void SyncBackendHost::Core::DoStartSyncing(
1133 const syncer::ModelSafeRoutingInfo& routing_info) { 1160 const syncer::ModelSafeRoutingInfo& routing_info) {
1134 DCHECK_EQ(MessageLoop::current(), sync_loop_); 1161 DCHECK_EQ(MessageLoop::current(), sync_loop_);
1135 sync_manager_->StartSyncingNormally(routing_info); 1162 sync_manager_->StartSyncingNormally(routing_info);
1136 } 1163 }
1137 1164
1138 void SyncBackendHost::Core::DoAssociateNigori() { 1165 void SyncBackendHost::Core::DoAssociateNigori() {
1139 DCHECK_EQ(MessageLoop::current(), sync_loop_); 1166 DCHECK_EQ(MessageLoop::current(), sync_loop_);
1140 sync_manager_->GetEncryptionHandler()->Init(); 1167 sync_manager_->GetEncryptionHandler()->Init();
1141 host_.Call(FROM_HERE, 1168 host_.Call(FROM_HERE,
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
1514 const syncer::ModelTypeSet failed_configuration_types) { 1541 const syncer::ModelTypeSet failed_configuration_types) {
1515 HandleInitializationCompletedOnFrontendLoop( 1542 HandleInitializationCompletedOnFrontendLoop(
1516 failed_configuration_types.Empty()); 1543 failed_configuration_types.Empty());
1517 } 1544 }
1518 1545
1519 #undef SDVLOG 1546 #undef SDVLOG
1520 1547
1521 #undef SLOG 1548 #undef SLOG
1522 1549
1523 } // namespace browser_sync 1550 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698