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

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

Issue 158953004: sync: Move migration signal out of snapshot (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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
« no previous file with comments | « chrome/browser/sync/glue/sync_backend_host_impl.h ('k') | sync/engine/all_status.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 void SyncBackendHostImpl::HandleSyncCycleCompletedOnFrontendLoop( 595 void SyncBackendHostImpl::HandleSyncCycleCompletedOnFrontendLoop(
596 const syncer::sessions::SyncSessionSnapshot& snapshot) { 596 const syncer::sessions::SyncSessionSnapshot& snapshot) {
597 if (!frontend_) 597 if (!frontend_)
598 return; 598 return;
599 DCHECK_EQ(base::MessageLoop::current(), frontend_loop_); 599 DCHECK_EQ(base::MessageLoop::current(), frontend_loop_);
600 600
601 last_snapshot_ = snapshot; 601 last_snapshot_ = snapshot;
602 602
603 SDVLOG(1) << "Got snapshot " << snapshot.ToString(); 603 SDVLOG(1) << "Got snapshot " << snapshot.ToString();
604 604
605 const syncer::ModelTypeSet to_migrate =
606 snapshot.model_neutral_state().types_needing_local_migration;
607 if (!to_migrate.Empty())
608 frontend_->OnMigrationNeededForTypes(to_migrate);
609
610 // Process any changes to the datatypes we're syncing. 605 // Process any changes to the datatypes we're syncing.
611 // TODO(sync): add support for removing types. 606 // TODO(sync): add support for removing types.
612 if (initialized()) 607 if (initialized())
613 AddExperimentalTypes(); 608 AddExperimentalTypes();
Nicolas Zea 2014/02/12 20:05:18 Kindda unrelated to this patch, but I wonder if we
614 609
615 if (initialized()) 610 if (initialized())
616 frontend_->OnSyncCycleCompleted(); 611 frontend_->OnSyncCycleCompleted();
617 } 612 }
618 613
619 void SyncBackendHostImpl::RetryConfigurationOnFrontendLoop( 614 void SyncBackendHostImpl::RetryConfigurationOnFrontendLoop(
620 const base::Closure& retry_callback) { 615 const base::Closure& retry_callback) {
621 SDVLOG(1) << "Failed to complete configuration, informing of retry."; 616 SDVLOG(1) << "Failed to complete configuration, informing of retry.";
622 retry_callback.Run(); 617 retry_callback.Run();
623 } 618 }
(...skipping 10 matching lines...) Expand all
634 } 629 }
635 630
636 void SyncBackendHostImpl::HandleActionableErrorEventOnFrontendLoop( 631 void SyncBackendHostImpl::HandleActionableErrorEventOnFrontendLoop(
637 const syncer::SyncProtocolError& sync_error) { 632 const syncer::SyncProtocolError& sync_error) {
638 if (!frontend_) 633 if (!frontend_)
639 return; 634 return;
640 DCHECK_EQ(base::MessageLoop::current(), frontend_loop_); 635 DCHECK_EQ(base::MessageLoop::current(), frontend_loop_);
641 frontend_->OnActionableError(sync_error); 636 frontend_->OnActionableError(sync_error);
642 } 637 }
643 638
639 void SyncBackendHostImpl::HandleMigrationRequestedOnFrontendLoop(
640 syncer::ModelTypeSet types) {
641 if (!frontend_)
642 return;
643 DCHECK_EQ(base::MessageLoop::current(), frontend_loop_);
644 frontend_->OnMigrationNeededForTypes(types);
645 }
646
644 void SyncBackendHostImpl::OnInvalidatorStateChange( 647 void SyncBackendHostImpl::OnInvalidatorStateChange(
645 syncer::InvalidatorState state) { 648 syncer::InvalidatorState state) {
646 registrar_->sync_thread()->message_loop()->PostTask( 649 registrar_->sync_thread()->message_loop()->PostTask(
647 FROM_HERE, 650 FROM_HERE,
648 base::Bind(&SyncBackendHostCore::DoOnInvalidatorStateChange, 651 base::Bind(&SyncBackendHostCore::DoOnInvalidatorStateChange,
649 core_.get(), 652 core_.get(),
650 state)); 653 state));
651 } 654 }
652 655
653 void SyncBackendHostImpl::OnIncomingInvalidation( 656 void SyncBackendHostImpl::OnIncomingInvalidation(
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 base::MessageLoop* SyncBackendHostImpl::GetSyncLoopForTesting() { 749 base::MessageLoop* SyncBackendHostImpl::GetSyncLoopForTesting() {
747 return registrar_->sync_thread()->message_loop(); 750 return registrar_->sync_thread()->message_loop();
748 } 751 }
749 752
750 } // namespace browser_sync 753 } // namespace browser_sync
751 754
752 #undef SDVLOG 755 #undef SDVLOG
753 756
754 #undef SLOG 757 #undef SLOG
755 758
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/sync_backend_host_impl.h ('k') | sync/engine/all_status.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698