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

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: Use scoped_ptr instead of raw pointer. 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
« no previous file with comments | « no previous file | sync/internal_api/public/sync_manager.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_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 =
448 &stop_syncing_signal_); 448 options->internal_components_factory.Pass();
449 args.encryptor = &encryptor_;
450 args.unrecoverable_error_handler =
451 options->unrecoverable_error_handler.Pass();
452 args.report_unrecoverable_error_function =
453 options->report_unrecoverable_error_function;
454 args.cancelation_signal = &stop_syncing_signal_;
455 sync_manager_->Init(&args);
449 } 456 }
450 457
451 void SyncBackendHostCore::DoUpdateCredentials( 458 void SyncBackendHostCore::DoUpdateCredentials(
452 const syncer::SyncCredentials& credentials) { 459 const syncer::SyncCredentials& credentials) {
453 DCHECK_EQ(base::MessageLoop::current(), sync_loop_); 460 DCHECK_EQ(base::MessageLoop::current(), sync_loop_);
454 // UpdateCredentials can be called during backend initialization, possibly 461 // UpdateCredentials can be called during backend initialization, possibly
455 // when backend initialization has failed but hasn't notified the UI thread 462 // 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 463 // 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. 464 // thread before this task was executed, so we do nothing.
458 if (sync_manager_) { 465 if (sync_manager_) {
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 base::TimeDelta::FromSeconds(kSaveChangesIntervalSeconds), 751 base::TimeDelta::FromSeconds(kSaveChangesIntervalSeconds),
745 this, &SyncBackendHostCore::SaveChanges); 752 this, &SyncBackendHostCore::SaveChanges);
746 } 753 }
747 754
748 void SyncBackendHostCore::SaveChanges() { 755 void SyncBackendHostCore::SaveChanges() {
749 DCHECK_EQ(base::MessageLoop::current(), sync_loop_); 756 DCHECK_EQ(base::MessageLoop::current(), sync_loop_);
750 sync_manager_->SaveChanges(); 757 sync_manager_->SaveChanges();
751 } 758 }
752 759
753 } // namespace browser_sync 760 } // namespace browser_sync
OLDNEW
« no previous file with comments | « no previous file | sync/internal_api/public/sync_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698