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

Side by Side Diff: components/sync/driver/glue/sync_backend_host_core.cc

Issue 2106743002: WIP: Local sync only... (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix after rebase. Created 4 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
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 "components/sync/driver/glue/sync_backend_host_core.h" 5 #include "components/sync/driver/glue/sync_backend_host_core.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 sync_manager_->RefreshTypes(types); 146 sync_manager_->RefreshTypes(types);
147 } 147 }
148 148
149 void SyncBackendHostCore::OnInitializationComplete( 149 void SyncBackendHostCore::OnInitializationComplete(
150 const syncer::WeakHandle<syncer::JsBackend>& js_backend, 150 const syncer::WeakHandle<syncer::JsBackend>& js_backend,
151 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>& 151 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>&
152 debug_info_listener, 152 debug_info_listener,
153 bool success, 153 bool success,
154 const syncer::ModelTypeSet restored_types) { 154 const syncer::ModelTypeSet restored_types) {
155 DCHECK(sync_loop_->task_runner()->BelongsToCurrentThread()); 155 DCHECK(sync_loop_->task_runner()->BelongsToCurrentThread());
156 156 LOG(ERROR) << "@@@@@ SyncBackendHostCore::OnInitializationComplete " << succes s;
157 DCHECK(success);
157 if (!success) { 158 if (!success) {
158 DoDestroySyncManager(syncer::STOP_SYNC); 159 DoDestroySyncManager(syncer::STOP_SYNC);
159 host_.Call(FROM_HERE, 160 host_.Call(FROM_HERE,
160 &SyncBackendHostImpl::HandleInitializationFailureOnFrontendLoop); 161 &SyncBackendHostImpl::HandleInitializationFailureOnFrontendLoop);
161 return; 162 return;
162 } 163 }
163 164
164 // Register for encryption related changes now. We have to do this before 165 // Register for encryption related changes now. We have to do this before
165 // the initializing downloading control types or initializing the encryption 166 // the initializing downloading control types or initializing the encryption
166 // handler in order to receive notifications triggered during encryption 167 // handler in order to receive notifications triggered during encryption
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 args.restored_keystore_key_for_bootstrapping = 429 args.restored_keystore_key_for_bootstrapping =
429 options->restored_keystore_key_for_bootstrapping; 430 options->restored_keystore_key_for_bootstrapping;
430 args.internal_components_factory = 431 args.internal_components_factory =
431 std::move(options->internal_components_factory); 432 std::move(options->internal_components_factory);
432 args.encryptor = &encryptor_; 433 args.encryptor = &encryptor_;
433 args.unrecoverable_error_handler = options->unrecoverable_error_handler; 434 args.unrecoverable_error_handler = options->unrecoverable_error_handler;
434 args.report_unrecoverable_error_function = 435 args.report_unrecoverable_error_function =
435 options->report_unrecoverable_error_function; 436 options->report_unrecoverable_error_function;
436 args.cancelation_signal = &stop_syncing_signal_; 437 args.cancelation_signal = &stop_syncing_signal_;
437 args.saved_nigori_state = std::move(options->saved_nigori_state); 438 args.saved_nigori_state = std::move(options->saved_nigori_state);
439 LOG(ERROR) << "@@@@@ SyncBackendHostCore::DoInitialize";
438 sync_manager_->Init(&args); 440 sync_manager_->Init(&args);
439 } 441 }
440 442
441 void SyncBackendHostCore::DoUpdateCredentials( 443 void SyncBackendHostCore::DoUpdateCredentials(
442 const syncer::SyncCredentials& credentials) { 444 const syncer::SyncCredentials& credentials) {
443 DCHECK(sync_loop_->task_runner()->BelongsToCurrentThread()); 445 DCHECK(sync_loop_->task_runner()->BelongsToCurrentThread());
444 // UpdateCredentials can be called during backend initialization, possibly 446 // UpdateCredentials can be called during backend initialization, possibly
445 // when backend initialization has failed but hasn't notified the UI thread 447 // when backend initialization has failed but hasn't notified the UI thread
446 // yet. In that case, the sync manager may have been destroyed on the sync 448 // yet. In that case, the sync manager may have been destroyed on the sync
447 // thread before this task was executed, so we do nothing. 449 // thread before this task was executed, so we do nothing.
(...skipping 22 matching lines...) Expand all
470 472
471 DVLOG(1) << "Initilalizing Control Types"; 473 DVLOG(1) << "Initilalizing Control Types";
472 474
473 // Initialize encryption. 475 // Initialize encryption.
474 sync_manager_->GetEncryptionHandler()->Init(); 476 sync_manager_->GetEncryptionHandler()->Init();
475 477
476 // Note: experiments are currently handled via SBH::AddExperimentalTypes, 478 // Note: experiments are currently handled via SBH::AddExperimentalTypes,
477 // which is called at the end of every sync cycle. 479 // which is called at the end of every sync cycle.
478 // TODO(zea): eventually add an experiment handler and initialize it here. 480 // TODO(zea): eventually add an experiment handler and initialize it here.
479 481
482 LOG(ERROR) << "@@@@@ SyncBackendHostCore::DoInitialProcessControlTypes beg";
483
480 if (!sync_manager_->GetUserShare()) { // NULL in some tests. 484 if (!sync_manager_->GetUserShare()) { // NULL in some tests.
481 DVLOG(1) << "Skipping initialization of DeviceInfo"; 485 DVLOG(1) << "Skipping initialization of DeviceInfo";
482 host_.Call(FROM_HERE, 486 host_.Call(FROM_HERE,
483 &SyncBackendHostImpl::HandleInitializationFailureOnFrontendLoop); 487 &SyncBackendHostImpl::HandleInitializationFailureOnFrontendLoop);
484 return; 488 return;
485 } 489 }
490 LOG(ERROR) << "@@@@@ SyncBackendHostCore::DoInitialProcessControlTypes mid";
486 491
487 if (!sync_manager_->InitialSyncEndedTypes().HasAll(syncer::ControlTypes())) { 492 if (!sync_manager_->InitialSyncEndedTypes().HasAll(syncer::ControlTypes())) {
488 LOG(ERROR) << "Failed to download control types"; 493 LOG(ERROR) << "Failed to download control types";
489 host_.Call(FROM_HERE, 494 host_.Call(FROM_HERE,
490 &SyncBackendHostImpl::HandleInitializationFailureOnFrontendLoop); 495 &SyncBackendHostImpl::HandleInitializationFailureOnFrontendLoop);
491 return; 496 return;
492 } 497 }
493 498
499 LOG(ERROR) << "@@@@@ SyncBackendHostCore::DoInitialProcessControlTypes done";
494 host_.Call(FROM_HERE, 500 host_.Call(FROM_HERE,
495 &SyncBackendHostImpl::HandleInitializationSuccessOnFrontendLoop, 501 &SyncBackendHostImpl::HandleInitializationSuccessOnFrontendLoop,
496 js_backend_, debug_info_listener_, 502 js_backend_, debug_info_listener_,
497 base::Passed(sync_manager_->GetModelTypeConnectorProxy()), 503 base::Passed(sync_manager_->GetModelTypeConnectorProxy()),
498 sync_manager_->cache_guid()); 504 sync_manager_->cache_guid());
499 505
500 js_backend_.Reset(); 506 js_backend_.Reset();
501 debug_info_listener_.Reset(); 507 debug_info_listener_.Reset();
502 } 508 }
503 509
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 } 701 }
696 702
697 void SyncBackendHostCore::ClearServerDataDone( 703 void SyncBackendHostCore::ClearServerDataDone(
698 const base::Closure& frontend_callback) { 704 const base::Closure& frontend_callback) {
699 DCHECK(sync_loop_->task_runner()->BelongsToCurrentThread()); 705 DCHECK(sync_loop_->task_runner()->BelongsToCurrentThread());
700 host_.Call(FROM_HERE, &SyncBackendHostImpl::ClearServerDataDoneOnFrontendLoop, 706 host_.Call(FROM_HERE, &SyncBackendHostImpl::ClearServerDataDoneOnFrontendLoop,
701 frontend_callback); 707 frontend_callback);
702 } 708 }
703 709
704 } // namespace browser_sync 710 } // namespace browser_sync
OLDNEW
« no previous file with comments | « components/sync/core_impl/sync_manager_impl.cc ('k') | components/sync/driver/startup_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698