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

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: Feedback from petewil Created 8 years, 3 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 void DoInitialize(const DoInitializeOptions& options); 139 void DoInitialize(const DoInitializeOptions& options);
140 140
141 // Called to perform credential update on behalf of 141 // Called to perform credential update on behalf of
142 // SyncBackendHost::UpdateCredentials. 142 // SyncBackendHost::UpdateCredentials.
143 void DoUpdateCredentials(const syncer::SyncCredentials& credentials); 143 void DoUpdateCredentials(const syncer::SyncCredentials& credentials);
144 144
145 // Called to update the given registered ids on behalf of 145 // Called to update the given registered ids on behalf of
146 // SyncBackendHost::UpdateRegisteredInvalidationIds. 146 // SyncBackendHost::UpdateRegisteredInvalidationIds.
147 void DoUpdateRegisteredInvalidationIds(const syncer::ObjectIdSet& ids); 147 void DoUpdateRegisteredInvalidationIds(const syncer::ObjectIdSet& ids);
148 148
149 // Called to acknowledge an invalidation on behalf of
150 // SyncBackendHost::AcknowledgeInvalidation.
151 void DoAcknowledgeInvalidation(const invalidation::ObjectId& id,
152 const syncer::AckHandle& ack_handle);
153
149 // Called to tell the syncapi to start syncing (generally after 154 // Called to tell the syncapi to start syncing (generally after
150 // initialization and authentication). 155 // initialization and authentication).
151 void DoStartSyncing(const syncer::ModelSafeRoutingInfo& routing_info); 156 void DoStartSyncing(const syncer::ModelSafeRoutingInfo& routing_info);
152 157
153 // Called to set the passphrase for encryption. 158 // Called to set the passphrase for encryption.
154 void DoSetEncryptionPassphrase(const std::string& passphrase, 159 void DoSetEncryptionPassphrase(const std::string& passphrase,
155 bool is_explicit); 160 bool is_explicit);
156 161
157 // Called to decrypt the pending keys. 162 // Called to decrypt the pending keys.
158 void DoSetDecryptionPassphrase(const std::string& passphrase); 163 void DoSetDecryptionPassphrase(const std::string& passphrase);
(...skipping 311 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 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
1152 // |sync_manager_| may end up being NULL here in tests (in 1166 // |sync_manager_| may end up being NULL here in tests (in
1153 // synchronous initialization mode) since this is called during 1167 // synchronous initialization mode) since this is called during
1154 // shutdown. 1168 // shutdown.
1155 // 1169 //
1156 // TODO(akalin): Fix this behavior (see http://crbug.com/140354). 1170 // TODO(akalin): Fix this behavior (see http://crbug.com/140354).
1157 if (sync_manager_.get()) { 1171 if (sync_manager_.get()) {
1158 sync_manager_->UpdateRegisteredInvalidationIds(this, ids); 1172 sync_manager_->UpdateRegisteredInvalidationIds(this, ids);
1159 } 1173 }
1160 } 1174 }
1161 1175
1176 void SyncBackendHost::Core::DoAcknowledgeInvalidation(
1177 const invalidation::ObjectId& id, const syncer::AckHandle& ack_handle) {
1178 DCHECK_EQ(MessageLoop::current(), sync_loop_);
1179 // |sync_manager_| may end up being NULL here in tests (in
1180 // synchronous initialization mode) since this is called during
1181 // shutdown.
1182 //
1183 // TODO(akalin): Fix this behavior (see http://crbug.com/140354).
1184 if (sync_manager_.get()) {
1185 sync_manager_->AcknowledgeInvalidation(id, ack_handle);
1186 }
1187 }
1188
1162 void SyncBackendHost::Core::DoStartSyncing( 1189 void SyncBackendHost::Core::DoStartSyncing(
1163 const syncer::ModelSafeRoutingInfo& routing_info) { 1190 const syncer::ModelSafeRoutingInfo& routing_info) {
1164 DCHECK_EQ(MessageLoop::current(), sync_loop_); 1191 DCHECK_EQ(MessageLoop::current(), sync_loop_);
1165 sync_manager_->StartSyncingNormally(routing_info); 1192 sync_manager_->StartSyncingNormally(routing_info);
1166 } 1193 }
1167 1194
1168 void SyncBackendHost::Core::DoAssociateNigori() { 1195 void SyncBackendHost::Core::DoAssociateNigori() {
1169 DCHECK_EQ(MessageLoop::current(), sync_loop_); 1196 DCHECK_EQ(MessageLoop::current(), sync_loop_);
1170 sync_manager_->GetEncryptionHandler()->Init(); 1197 sync_manager_->GetEncryptionHandler()->Init();
1171 host_.Call(FROM_HERE, 1198 host_.Call(FROM_HERE,
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
1542 const syncer::ModelTypeSet failed_configuration_types) { 1569 const syncer::ModelTypeSet failed_configuration_types) {
1543 HandleInitializationCompletedOnFrontendLoop( 1570 HandleInitializationCompletedOnFrontendLoop(
1544 failed_configuration_types.Empty()); 1571 failed_configuration_types.Empty());
1545 } 1572 }
1546 1573
1547 #undef SDVLOG 1574 #undef SDVLOG
1548 1575
1549 #undef SLOG 1576 #undef SLOG
1550 1577
1551 } // namespace browser_sync 1578 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698