OLD | NEW |
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 "chrome/browser/sync/glue/sync_backend_host.h" | 5 #include "chrome/browser/sync/glue/sync_backend_host.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 1487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1498 void SyncBackendHost::OnInvalidatorStateChange(syncer::InvalidatorState state) { | 1498 void SyncBackendHost::OnInvalidatorStateChange(syncer::InvalidatorState state) { |
1499 registrar_->sync_thread()->message_loop()->PostTask( | 1499 registrar_->sync_thread()->message_loop()->PostTask( |
1500 FROM_HERE, | 1500 FROM_HERE, |
1501 base::Bind(&SyncBackendHost::Core::DoOnInvalidatorStateChange, | 1501 base::Bind(&SyncBackendHost::Core::DoOnInvalidatorStateChange, |
1502 core_.get(), | 1502 core_.get(), |
1503 state)); | 1503 state)); |
1504 } | 1504 } |
1505 | 1505 |
1506 void SyncBackendHost::OnIncomingInvalidation( | 1506 void SyncBackendHost::OnIncomingInvalidation( |
1507 const syncer::ObjectIdInvalidationMap& invalidation_map) { | 1507 const syncer::ObjectIdInvalidationMap& invalidation_map) { |
1508 // TODO(dcheng): Acknowledge immediately for now. Fix this once the | 1508 // TODO(rlarocque): Acknowledge these invalidations only after the syncer has |
1509 // invalidator doesn't repeatedly ping for unacknowledged invaliations, since | 1509 // acted on them and saved the results to disk. |
1510 // it conflicts with the sync scheduler's internal backoff algorithm. | 1510 syncer::ObjectIdSet ids = invalidation_map.GetObjectIds(); |
1511 // See http://crbug.com/124149 for more information. | 1511 for (syncer::ObjectIdSet::const_iterator it = ids.begin(); |
1512 for (syncer::ObjectIdInvalidationMap::const_iterator it = | 1512 it != ids.end(); ++it) { |
1513 invalidation_map.begin(); it != invalidation_map.end(); ++it) { | 1513 const syncer::AckHandle& handle = |
1514 invalidator_->AcknowledgeInvalidation(it->first, it->second.ack_handle); | 1514 invalidation_map.ForObject(*it).back().ack_handle(); |
| 1515 invalidator_->AcknowledgeInvalidation(*it, handle); |
1515 } | 1516 } |
1516 | 1517 |
1517 registrar_->sync_thread()->message_loop()->PostTask( | 1518 registrar_->sync_thread()->message_loop()->PostTask( |
1518 FROM_HERE, | 1519 FROM_HERE, |
1519 base::Bind(&SyncBackendHost::Core::DoOnIncomingInvalidation, | 1520 base::Bind(&SyncBackendHost::Core::DoOnIncomingInvalidation, |
1520 core_.get(), | 1521 core_.get(), |
1521 invalidation_map)); | 1522 invalidation_map)); |
1522 } | 1523 } |
1523 | 1524 |
1524 bool SyncBackendHost::CheckPassphraseAgainstCachedPendingKeys( | 1525 bool SyncBackendHost::CheckPassphraseAgainstCachedPendingKeys( |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1616 | 1617 |
1617 base::MessageLoop* SyncBackendHost::GetSyncLoopForTesting() { | 1618 base::MessageLoop* SyncBackendHost::GetSyncLoopForTesting() { |
1618 return registrar_->sync_thread()->message_loop(); | 1619 return registrar_->sync_thread()->message_loop(); |
1619 } | 1620 } |
1620 | 1621 |
1621 #undef SDVLOG | 1622 #undef SDVLOG |
1622 | 1623 |
1623 #undef SLOG | 1624 #undef SLOG |
1624 | 1625 |
1625 } // namespace browser_sync | 1626 } // namespace browser_sync |
OLD | NEW |