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

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: 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 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 // provide a callback for when it finishes. 466 // provide a callback for when it finishes.
467 synced_device_tracker_.reset( 467 synced_device_tracker_.reset(
468 new SyncedDeviceTracker(sync_manager_->GetUserShare(), 468 new SyncedDeviceTracker(sync_manager_->GetUserShare(),
469 sync_manager_->cache_guid())); 469 sync_manager_->cache_guid()));
470 synced_device_tracker_->InitLocalDeviceInfo( 470 synced_device_tracker_->InitLocalDeviceInfo(
471 base::Bind(&SyncBackendHostCore::DoFinishInitialProcessControlTypes, 471 base::Bind(&SyncBackendHostCore::DoFinishInitialProcessControlTypes,
472 weak_ptr_factory_.GetWeakPtr())); 472 weak_ptr_factory_.GetWeakPtr()));
473 } 473 }
474 474
475 void SyncBackendHostCore::DoFinishInitialProcessControlTypes() { 475 void SyncBackendHostCore::DoFinishInitialProcessControlTypes() {
476 DCHECK_EQ(base::MessageLoop::current(), sync_loop_);
477
476 registrar_->ActivateDataType(syncer::DEVICE_INFO, 478 registrar_->ActivateDataType(syncer::DEVICE_INFO,
477 syncer::GROUP_PASSIVE, 479 syncer::GROUP_PASSIVE,
478 synced_device_tracker_.get(), 480 synced_device_tracker_.get(),
479 sync_manager_->GetUserShare()); 481 sync_manager_->GetUserShare());
480 482
483 base::WeakPtr<syncer::SyncCore> sync_core = sync_manager_->GetSyncCore();
484
485 // De-reference the WeakPtr while we're here to signal to the debugging
486 // mechanisms that it belongs to the sync thread. This helps us DCHECK
487 // earlier if the pointer is misused.
488 sync_core.get();
Nicolas Zea 2014/04/02 23:19:05 I don't think this is necessary. A weak pointer al
rlarocque 2014/04/03 01:03:46 IIRC, I added this statement because it helped me
Nicolas Zea 2014/04/03 17:52:15 Huh, I missed that. Fair enough then.
489
481 host_.Call( 490 host_.Call(
482 FROM_HERE, 491 FROM_HERE,
483 &SyncBackendHostImpl::HandleInitializationSuccessOnFrontendLoop, 492 &SyncBackendHostImpl::HandleInitializationSuccessOnFrontendLoop,
484 js_backend_, 493 js_backend_,
485 debug_info_listener_); 494 debug_info_listener_,
495 sync_core);
486 496
487 js_backend_.Reset(); 497 js_backend_.Reset();
488 debug_info_listener_.Reset(); 498 debug_info_listener_.Reset();
489 } 499 }
490 500
491 void SyncBackendHostCore::DoSetDecryptionPassphrase( 501 void SyncBackendHostCore::DoSetDecryptionPassphrase(
492 const std::string& passphrase) { 502 const std::string& passphrase) {
493 DCHECK_EQ(base::MessageLoop::current(), sync_loop_); 503 DCHECK_EQ(base::MessageLoop::current(), sync_loop_);
494 sync_manager_->GetEncryptionHandler()->SetDecryptionPassphrase( 504 sync_manager_->GetEncryptionHandler()->SetDecryptionPassphrase(
495 passphrase); 505 passphrase);
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 this, &SyncBackendHostCore::SaveChanges); 640 this, &SyncBackendHostCore::SaveChanges);
631 } 641 }
632 642
633 void SyncBackendHostCore::SaveChanges() { 643 void SyncBackendHostCore::SaveChanges() {
634 DCHECK_EQ(base::MessageLoop::current(), sync_loop_); 644 DCHECK_EQ(base::MessageLoop::current(), sync_loop_);
635 sync_manager_->SaveChanges(); 645 sync_manager_->SaveChanges();
636 } 646 }
637 647
638 } // namespace browser_sync 648 } // namespace browser_sync
639 649
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698