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

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

Issue 451743002: Pass args to SyncManager::Init via a struct. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add SYNC_EXPORT tag to InitArgs. Created 6 years, 4 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
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_core.h" 5 #include "chrome/browser/sync/glue/sync_backend_host_core.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "chrome/browser/sync/glue/device_info.h" 9 #include "chrome/browser/sync/glue/device_info.h"
10 #include "chrome/browser/sync/glue/invalidation_adapter.h" 10 #include "chrome/browser/sync/glue/invalidation_adapter.h"
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 if (!base::CreateDirectory(sync_data_folder_path_)) { 423 if (!base::CreateDirectory(sync_data_folder_path_)) {
424 DLOG(FATAL) << "Sync Data directory creation failed."; 424 DLOG(FATAL) << "Sync Data directory creation failed.";
425 } 425 }
426 426
427 DCHECK(!registrar_); 427 DCHECK(!registrar_);
428 registrar_ = options->registrar; 428 registrar_ = options->registrar;
429 DCHECK(registrar_); 429 DCHECK(registrar_);
430 430
431 sync_manager_ = options->sync_manager_factory->CreateSyncManager(name_); 431 sync_manager_ = options->sync_manager_factory->CreateSyncManager(name_);
432 sync_manager_->AddObserver(this); 432 sync_manager_->AddObserver(this);
433 sync_manager_->Init(sync_data_folder_path_, 433
434 options->event_handler, 434 syncer::SyncManager::InitArgs args;
435 options->service_url, 435 args.database_location = sync_data_folder_path_;
436 options->http_bridge_factory.Pass(), 436 args.event_handler = options->event_handler;
437 options->workers, 437 args.service_url = options->service_url;
438 options->extensions_activity, 438 args.post_factory = options->http_bridge_factory.Pass();
439 options->registrar /* as SyncManager::ChangeDelegate */, 439 args.workers = options->workers;
440 options->credentials, 440 args.extensions_activity = options->extensions_activity;
441 options->invalidator_client_id, 441 args.change_delegate = options->registrar; // as SyncManager::ChangeDelegate
442 options->restored_key_for_bootstrapping, 442 args.credentials = options->credentials;
443 options->restored_keystore_key_for_bootstrapping, 443 args.invalidator_client_id = options->invalidator_client_id;
444 options->internal_components_factory.get(), 444 args.restored_key_for_bootstrapping = options->restored_key_for_bootstrapping;
445 &encryptor_, 445 args.restored_keystore_key_for_bootstrapping =
446 options->unrecoverable_error_handler.Pass(), 446 options->restored_keystore_key_for_bootstrapping;
447 options->report_unrecoverable_error_function, 447 args.internal_components_factory = options->internal_components_factory.get();
448 &stop_syncing_signal_); 448 args.encryptor = &encryptor_;
449 args.unrecoverable_error_handler =
450 options->unrecoverable_error_handler.Pass();
451 args.report_unrecoverable_error_function =
452 options->report_unrecoverable_error_function;
453 args.cancelation_signal = &stop_syncing_signal_;
454 sync_manager_->Init(&args);
449 } 455 }
450 456
451 void SyncBackendHostCore::DoUpdateCredentials( 457 void SyncBackendHostCore::DoUpdateCredentials(
452 const syncer::SyncCredentials& credentials) { 458 const syncer::SyncCredentials& credentials) {
453 DCHECK_EQ(base::MessageLoop::current(), sync_loop_); 459 DCHECK_EQ(base::MessageLoop::current(), sync_loop_);
454 // UpdateCredentials can be called during backend initialization, possibly 460 // UpdateCredentials can be called during backend initialization, possibly
455 // when backend initialization has failed but hasn't notified the UI thread 461 // when backend initialization has failed but hasn't notified the UI thread
456 // yet. In that case, the sync manager may have been destroyed on the sync 462 // yet. In that case, the sync manager may have been destroyed on the sync
457 // thread before this task was executed, so we do nothing. 463 // thread before this task was executed, so we do nothing.
458 if (sync_manager_) { 464 if (sync_manager_) {
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 base::TimeDelta::FromSeconds(kSaveChangesIntervalSeconds), 750 base::TimeDelta::FromSeconds(kSaveChangesIntervalSeconds),
745 this, &SyncBackendHostCore::SaveChanges); 751 this, &SyncBackendHostCore::SaveChanges);
746 } 752 }
747 753
748 void SyncBackendHostCore::SaveChanges() { 754 void SyncBackendHostCore::SaveChanges() {
749 DCHECK_EQ(base::MessageLoop::current(), sync_loop_); 755 DCHECK_EQ(base::MessageLoop::current(), sync_loop_);
750 sync_manager_->SaveChanges(); 756 sync_manager_->SaveChanges();
751 } 757 }
752 758
753 } // namespace browser_sync 759 } // namespace browser_sync
OLDNEW
« no previous file with comments | « no previous file | sync/internal_api/public/sync_manager.h » ('j') | sync/internal_api/public/sync_manager.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698