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

Side by Side Diff: components/sync/engine_impl/sync_manager_impl.cc

Issue 2644373003: Revert of [Sync] Make directory types registration explicit in ModelTypeRegistry (Closed)
Patch Set: Created 3 years, 11 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
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 "components/sync/engine_impl/sync_manager_impl.h" 5 #include "components/sync/engine_impl/sync_manager_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 175
176 if (marker.token().empty()) 176 if (marker.token().empty())
177 result.Put(i.Get()); 177 result.Put(i.Get());
178 } 178 }
179 return result; 179 return result;
180 } 180 }
181 181
182 void SyncManagerImpl::ConfigureSyncer( 182 void SyncManagerImpl::ConfigureSyncer(
183 ConfigureReason reason, 183 ConfigureReason reason,
184 ModelTypeSet to_download, 184 ModelTypeSet to_download,
185 const ModelSafeRoutingInfo& new_routing_info,
185 const base::Closure& ready_task, 186 const base::Closure& ready_task,
186 const base::Closure& retry_task) { 187 const base::Closure& retry_task) {
187 DCHECK(thread_checker_.CalledOnValidThread()); 188 DCHECK(thread_checker_.CalledOnValidThread());
188 DCHECK(!ready_task.is_null()); 189 DCHECK(!ready_task.is_null());
189 DCHECK(initialized_); 190 DCHECK(initialized_);
190 191
191 // Don't download non-blocking types that have already completed initial sync. 192 // Don't download non-blocking types that have already completed initial sync.
192 to_download.RemoveAll( 193 to_download.RemoveAll(
193 model_type_registry_->GetInitialSyncDoneNonBlockingTypes()); 194 model_type_registry_->GetInitialSyncDoneNonBlockingTypes());
194 195
195 DVLOG(1) << "Configuring -" 196 DVLOG(1) << "Configuring -"
196 << "\n\t" 197 << "\n\t"
198 << "current types: "
199 << ModelTypeSetToString(GetRoutingInfoTypes(new_routing_info))
200 << "\n\t"
197 << "types to download: " << ModelTypeSetToString(to_download); 201 << "types to download: " << ModelTypeSetToString(to_download);
198 ConfigurationParams params(GetSourceFromReason(reason), to_download, 202 ConfigurationParams params(GetSourceFromReason(reason), to_download,
199 ready_task, retry_task); 203 new_routing_info, ready_task, retry_task);
200 204
201 scheduler_->Start(SyncScheduler::CONFIGURATION_MODE, base::Time()); 205 scheduler_->Start(SyncScheduler::CONFIGURATION_MODE, base::Time());
202 scheduler_->ScheduleConfiguration(params); 206 scheduler_->ScheduleConfiguration(params);
203 } 207 }
204 208
205 void SyncManagerImpl::Init(InitArgs* args) { 209 void SyncManagerImpl::Init(InitArgs* args) {
206 CHECK(!initialized_); 210 CHECK(!initialized_);
207 DCHECK(thread_checker_.CalledOnValidThread()); 211 DCHECK(thread_checker_.CalledOnValidThread());
208 DCHECK(args->post_factory.get()); 212 DCHECK(args->post_factory.get());
209 if (!args->enable_local_sync_backend) { 213 if (!args->enable_local_sync_backend) {
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 base::Time explicit_passphrase_time) { 389 base::Time explicit_passphrase_time) {
386 allstatus_.SetPassphraseType(type); 390 allstatus_.SetPassphraseType(type);
387 allstatus_.SetKeystoreMigrationTime( 391 allstatus_.SetKeystoreMigrationTime(
388 sync_encryption_handler_->migration_time()); 392 sync_encryption_handler_->migration_time());
389 } 393 }
390 394
391 void SyncManagerImpl::OnLocalSetPassphraseEncryption( 395 void SyncManagerImpl::OnLocalSetPassphraseEncryption(
392 const SyncEncryptionHandler::NigoriState& nigori_state) {} 396 const SyncEncryptionHandler::NigoriState& nigori_state) {}
393 397
394 void SyncManagerImpl::StartSyncingNormally( 398 void SyncManagerImpl::StartSyncingNormally(
399 const ModelSafeRoutingInfo& routing_info,
395 base::Time last_poll_time) { 400 base::Time last_poll_time) {
396 // Start the sync scheduler. 401 // Start the sync scheduler.
402 // TODO(sync): We always want the newest set of routes when we switch back
403 // to normal mode. Figure out how to enforce set_routing_info is always
404 // appropriately set and that it's only modified when switching to normal
405 // mode.
397 DCHECK(thread_checker_.CalledOnValidThread()); 406 DCHECK(thread_checker_.CalledOnValidThread());
407 cycle_context_->SetRoutingInfo(routing_info);
398 scheduler_->Start(SyncScheduler::NORMAL_MODE, last_poll_time); 408 scheduler_->Start(SyncScheduler::NORMAL_MODE, last_poll_time);
399 } 409 }
400 410
401 void SyncManagerImpl::StartConfiguration() {
402 DCHECK(thread_checker_.CalledOnValidThread());
403 scheduler_->Start(SyncScheduler::CONFIGURATION_MODE, base::Time());
404 }
405
406 syncable::Directory* SyncManagerImpl::directory() { 411 syncable::Directory* SyncManagerImpl::directory() {
407 return share_.directory.get(); 412 return share_.directory.get();
408 } 413 }
409 414
410 const SyncScheduler* SyncManagerImpl::scheduler() const { 415 const SyncScheduler* SyncManagerImpl::scheduler() const {
411 return scheduler_.get(); 416 return scheduler_.get();
412 } 417 }
413 418
414 bool SyncManagerImpl::GetHasInvalidAuthTokenForTest() const { 419 bool SyncManagerImpl::GetHasInvalidAuthTokenForTest() const {
415 return connection_manager_->HasInvalidAuthToken(); 420 return connection_manager_->HasInvalidAuthToken();
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 899
895 void SyncManagerImpl::SaveChanges() { 900 void SyncManagerImpl::SaveChanges() {
896 directory()->SaveChanges(); 901 directory()->SaveChanges();
897 } 902 }
898 903
899 UserShare* SyncManagerImpl::GetUserShare() { 904 UserShare* SyncManagerImpl::GetUserShare() {
900 DCHECK(initialized_); 905 DCHECK(initialized_);
901 return &share_; 906 return &share_;
902 } 907 }
903 908
904 ModelTypeConnector* SyncManagerImpl::GetModelTypeConnector() {
905 DCHECK(thread_checker_.CalledOnValidThread());
906 return model_type_registry_.get();
907 }
908
909 std::unique_ptr<ModelTypeConnector> 909 std::unique_ptr<ModelTypeConnector>
910 SyncManagerImpl::GetModelTypeConnectorProxy() { 910 SyncManagerImpl::GetModelTypeConnectorProxy() {
911 DCHECK(initialized_); 911 DCHECK(initialized_);
912 return base::MakeUnique<ModelTypeConnectorProxy>( 912 return base::MakeUnique<ModelTypeConnectorProxy>(
913 base::ThreadTaskRunnerHandle::Get(), model_type_registry_->AsWeakPtr()); 913 base::ThreadTaskRunnerHandle::Get(), model_type_registry_->AsWeakPtr());
914 } 914 }
915 915
916 const std::string SyncManagerImpl::cache_guid() { 916 const std::string SyncManagerImpl::cache_guid() {
917 DCHECK(initialized_); 917 DCHECK(initialized_);
918 return directory()->cache_guid(); 918 return directory()->cache_guid();
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 DCHECK(thread_checker_.CalledOnValidThread()); 1007 DCHECK(thread_checker_.CalledOnValidThread());
1008 cycle_context_->set_cookie_jar_mismatch(account_mismatch); 1008 cycle_context_->set_cookie_jar_mismatch(account_mismatch);
1009 cycle_context_->set_cookie_jar_empty(empty_jar); 1009 cycle_context_->set_cookie_jar_empty(empty_jar);
1010 } 1010 }
1011 1011
1012 void SyncManagerImpl::OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd) { 1012 void SyncManagerImpl::OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd) {
1013 directory()->OnMemoryDump(pmd); 1013 directory()->OnMemoryDump(pmd);
1014 } 1014 }
1015 1015
1016 } // namespace syncer 1016 } // namespace syncer
OLDNEW
« no previous file with comments | « components/sync/engine_impl/sync_manager_impl.h ('k') | components/sync/engine_impl/sync_manager_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698