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

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

Issue 217183003: Add non-blocking sync code to ProfileSyncService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove NonBlocking type invalidations support Created 6 years, 8 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/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "chrome/browser/sync/glue/device_info.h" 10 #include "chrome/browser/sync/glue/device_info.h"
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 // provide a callback for when it finishes. 467 // provide a callback for when it finishes.
468 synced_device_tracker_.reset( 468 synced_device_tracker_.reset(
469 new SyncedDeviceTracker(sync_manager_->GetUserShare(), 469 new SyncedDeviceTracker(sync_manager_->GetUserShare(),
470 sync_manager_->cache_guid())); 470 sync_manager_->cache_guid()));
471 synced_device_tracker_->InitLocalDeviceInfo( 471 synced_device_tracker_->InitLocalDeviceInfo(
472 base::Bind(&SyncBackendHostCore::DoFinishInitialProcessControlTypes, 472 base::Bind(&SyncBackendHostCore::DoFinishInitialProcessControlTypes,
473 weak_ptr_factory_.GetWeakPtr())); 473 weak_ptr_factory_.GetWeakPtr()));
474 } 474 }
475 475
476 void SyncBackendHostCore::DoFinishInitialProcessControlTypes() { 476 void SyncBackendHostCore::DoFinishInitialProcessControlTypes() {
477 DCHECK_EQ(base::MessageLoop::current(), sync_loop_);
478
477 registrar_->ActivateDataType(syncer::DEVICE_INFO, 479 registrar_->ActivateDataType(syncer::DEVICE_INFO,
478 syncer::GROUP_PASSIVE, 480 syncer::GROUP_PASSIVE,
479 synced_device_tracker_.get(), 481 synced_device_tracker_.get(),
480 sync_manager_->GetUserShare()); 482 sync_manager_->GetUserShare());
481 483
484 base::WeakPtr<syncer::SyncCore> sync_core = sync_manager_->GetSyncCore();
485
486 // De-reference the WeakPtr while we're here to signal to the debugging
487 // mechanisms that it belongs to the sync thread. This helps us DCHECK
488 // earlier if the pointer is misused.
489 sync_core.get();
490
482 host_.Call( 491 host_.Call(
483 FROM_HERE, 492 FROM_HERE,
484 &SyncBackendHostImpl::HandleInitializationSuccessOnFrontendLoop, 493 &SyncBackendHostImpl::HandleInitializationSuccessOnFrontendLoop,
485 js_backend_, 494 js_backend_,
486 debug_info_listener_); 495 debug_info_listener_,
496 syncer::SyncCoreProxy(base::MessageLoopProxy::current(), sync_core));
487 497
488 js_backend_.Reset(); 498 js_backend_.Reset();
489 debug_info_listener_.Reset(); 499 debug_info_listener_.Reset();
490 } 500 }
491 501
492 void SyncBackendHostCore::DoSetDecryptionPassphrase( 502 void SyncBackendHostCore::DoSetDecryptionPassphrase(
493 const std::string& passphrase) { 503 const std::string& passphrase) {
494 DCHECK_EQ(base::MessageLoop::current(), sync_loop_); 504 DCHECK_EQ(base::MessageLoop::current(), sync_loop_);
495 sync_manager_->GetEncryptionHandler()->SetDecryptionPassphrase( 505 sync_manager_->GetEncryptionHandler()->SetDecryptionPassphrase(
496 passphrase); 506 passphrase);
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 this, &SyncBackendHostCore::SaveChanges); 662 this, &SyncBackendHostCore::SaveChanges);
653 } 663 }
654 664
655 void SyncBackendHostCore::SaveChanges() { 665 void SyncBackendHostCore::SaveChanges() {
656 DCHECK_EQ(base::MessageLoop::current(), sync_loop_); 666 DCHECK_EQ(base::MessageLoop::current(), sync_loop_);
657 sync_manager_->SaveChanges(); 667 sync_manager_->SaveChanges();
658 } 668 }
659 669
660 } // namespace browser_sync 670 } // namespace browser_sync
661 671
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698