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

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

Issue 56113003: Implement new invalidations ack tracking system (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Modify drive TODO comment + rebase Created 7 years 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_impl.h" 5 #include "chrome/browser/sync/glue/sync_backend_host_impl.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "chrome/browser/chrome_notification_types.h" 8 #include "chrome/browser/chrome_notification_types.h"
9 #include "chrome/browser/invalidation/invalidation_service.h" 9 #include "chrome/browser/invalidation/invalidation_service.h"
10 #include "chrome/browser/invalidation/invalidation_service_factory.h" 10 #include "chrome/browser/invalidation/invalidation_service_factory.h"
11 #include "chrome/browser/network_time/network_time_tracker.h" 11 #include "chrome/browser/network_time/network_time_tracker.h"
12 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/sync/glue/sync_backend_host_core.h" 13 #include "chrome/browser/sync/glue/sync_backend_host_core.h"
14 #include "chrome/browser/sync/glue/sync_backend_registrar.h" 14 #include "chrome/browser/sync/glue/sync_backend_registrar.h"
15 #include "chrome/browser/sync/glue/sync_frontend.h" 15 #include "chrome/browser/sync/glue/sync_frontend.h"
16 #include "chrome/browser/sync/sync_prefs.h" 16 #include "chrome/browser/sync/sync_prefs.h"
17 #include "chrome/common/chrome_switches.h" 17 #include "chrome/common/chrome_switches.h"
18 #include "content/public/browser/browser_thread.h" 18 #include "content/public/browser/browser_thread.h"
19 #include "content/public/browser/notification_details.h" 19 #include "content/public/browser/notification_details.h"
20 #include "content/public/browser/notification_source.h" 20 #include "content/public/browser/notification_source.h"
21 #include "sync/internal_api/public/base_transaction.h" 21 #include "sync/internal_api/public/base_transaction.h"
22 #include "sync/internal_api/public/http_bridge.h" 22 #include "sync/internal_api/public/http_bridge.h"
23 #include "sync/internal_api/public/internal_components_factory.h" 23 #include "sync/internal_api/public/internal_components_factory.h"
24 #include "sync/internal_api/public/internal_components_factory_impl.h" 24 #include "sync/internal_api/public/internal_components_factory_impl.h"
25 #include "sync/internal_api/public/sync_manager.h" 25 #include "sync/internal_api/public/sync_manager.h"
26 #include "sync/internal_api/public/sync_manager_factory.h" 26 #include "sync/internal_api/public/sync_manager_factory.h"
27 #include "sync/internal_api/public/util/experiments.h" 27 #include "sync/internal_api/public/util/experiments.h"
28 #include "sync/internal_api/public/util/sync_string_conversions.h" 28 #include "sync/internal_api/public/util/sync_string_conversions.h"
29 #include "sync/notifier/object_id_invalidation_map.h"
29 30
30 // Helper macros to log with the syncer thread name; useful when there 31 // Helper macros to log with the syncer thread name; useful when there
31 // are multiple syncers involved. 32 // are multiple syncers involved.
32 33
33 #define SLOG(severity) LOG(severity) << name_ << ": " 34 #define SLOG(severity) LOG(severity) << name_ << ": "
34 35
35 #define SDVLOG(verbose_level) DVLOG(verbose_level) << name_ << ": " 36 #define SDVLOG(verbose_level) DVLOG(verbose_level) << name_ << ": "
36 37
37 using syncer::InternalComponentsFactory; 38 using syncer::InternalComponentsFactory;
38 39
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 FROM_HERE, 646 FROM_HERE,
646 base::Bind(&SyncBackendHostCore::DoOnInvalidatorStateChange, 647 base::Bind(&SyncBackendHostCore::DoOnInvalidatorStateChange,
647 core_.get(), 648 core_.get(),
648 state)); 649 state));
649 } 650 }
650 651
651 void SyncBackendHostImpl::OnIncomingInvalidation( 652 void SyncBackendHostImpl::OnIncomingInvalidation(
652 const syncer::ObjectIdInvalidationMap& invalidation_map) { 653 const syncer::ObjectIdInvalidationMap& invalidation_map) {
653 // TODO(rlarocque): Acknowledge these invalidations only after the syncer has 654 // TODO(rlarocque): Acknowledge these invalidations only after the syncer has
654 // acted on them and saved the results to disk. 655 // acted on them and saved the results to disk.
655 syncer::ObjectIdSet ids = invalidation_map.GetObjectIds(); 656 invalidation_map.AcknowledgeAll();
656 for (syncer::ObjectIdSet::const_iterator it = ids.begin();
657 it != ids.end(); ++it) {
658 const syncer::AckHandle& handle =
659 invalidation_map.ForObject(*it).back().ack_handle();
660 invalidator_->AcknowledgeInvalidation(*it, handle);
661 }
662
663 registrar_->sync_thread()->message_loop()->PostTask( 657 registrar_->sync_thread()->message_loop()->PostTask(
664 FROM_HERE, 658 FROM_HERE,
665 base::Bind(&SyncBackendHostCore::DoOnIncomingInvalidation, 659 base::Bind(&SyncBackendHostCore::DoOnIncomingInvalidation,
666 core_.get(), 660 core_.get(),
667 invalidation_map)); 661 invalidation_map));
668 } 662 }
669 663
670 bool SyncBackendHostImpl::CheckPassphraseAgainstCachedPendingKeys( 664 bool SyncBackendHostImpl::CheckPassphraseAgainstCachedPendingKeys(
671 const std::string& passphrase) const { 665 const std::string& passphrase) const {
672 DCHECK(cached_pending_keys_.has_blob()); 666 DCHECK(cached_pending_keys_.has_blob());
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 base::MessageLoop* SyncBackendHostImpl::GetSyncLoopForTesting() { 748 base::MessageLoop* SyncBackendHostImpl::GetSyncLoopForTesting() {
755 return registrar_->sync_thread()->message_loop(); 749 return registrar_->sync_thread()->message_loop();
756 } 750 }
757 751
758 } // namespace browser_sync 752 } // namespace browser_sync
759 753
760 #undef SDVLOG 754 #undef SDVLOG
761 755
762 #undef SLOG 756 #undef SLOG
763 757
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/sync_backend_host_impl.h ('k') | chrome/browser/sync/glue/sync_backend_host_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698