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

Unified Diff: chrome/browser/sync/glue/sync_backend_host_impl.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, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/glue/sync_backend_host_impl.cc
diff --git a/chrome/browser/sync/glue/sync_backend_host_impl.cc b/chrome/browser/sync/glue/sync_backend_host_impl.cc
index de87a4939a37256e29d92fab4c6ee9479a2dd3cf..8fb02c08b2b1eae2bf63e5edd1c4e9c61adba970 100644
--- a/chrome/browser/sync/glue/sync_backend_host_impl.cc
+++ b/chrome/browser/sync/glue/sync_backend_host_impl.cc
@@ -234,6 +234,9 @@ void SyncBackendHostImpl::StopSyncingForShutdown() {
// Stop listening for and forwarding locally-triggered sync refresh requests.
notification_registrar_.RemoveAll();
+ // Stop non-blocking sync types from sending any more requests to the syncer.
+ sync_core_proxy_.reset();
+
DCHECK(registrar_->sync_thread()->IsRunning());
registrar_->RequestWorkerStopOnUIThread();
@@ -288,6 +291,12 @@ void SyncBackendHostImpl::UnregisterInvalidationIds() {
}
}
+void SyncBackendHostImpl::SetPreferredNonBlockingTypes(
+ syncer::ModelTypeSet types) {
+ preferred_non_blocking_types_ = types;
+ UpdateRegisteredInvalidationTypes();
+}
+
void SyncBackendHostImpl::ConfigureDataTypes(
syncer::ConfigureReason reason,
const DataTypeConfigStateMap& config_state_map,
@@ -427,6 +436,10 @@ syncer::UserShare* SyncBackendHostImpl::GetUserShare() const {
return core_->sync_manager()->GetUserShare();
}
+syncer::SyncCoreProxy SyncBackendHostImpl::GetSyncCoreProxy() {
+ return *sync_core_proxy_.get();
+}
+
SyncBackendHostImpl::Status SyncBackendHostImpl::GetDetailedStatus() {
DCHECK(initialized());
return core_->sync_manager()->GetDetailedStatus();
@@ -524,14 +537,20 @@ void SyncBackendHostImpl::FinishConfigureDataTypesOnFrontendLoop(
if (!frontend_)
return;
- invalidator_->UpdateRegisteredInvalidationIds(
- this,
- ModelTypeSetToObjectIdSet(enabled_types));
+ enabled_directory_types_ = enabled_types;
+ UpdateRegisteredInvalidationTypes();
if (!ready_task.is_null())
ready_task.Run(succeeded_configuration_types, failed_configuration_types);
}
+void SyncBackendHostImpl::UpdateRegisteredInvalidationTypes() {
Nicolas Zea 2014/04/02 23:19:05 How about changing this to UpdateEnabledTypes(dire
rlarocque 2014/04/03 01:03:46 I don't understand this suggestion. We'd still ne
Nicolas Zea 2014/04/03 17:52:15 Yeah, I think I was still thinking of the set of e
+ invalidator_->UpdateRegisteredInvalidationIds(
+ this,
+ ModelTypeSetToObjectIdSet(
+ Union(enabled_directory_types_, preferred_non_blocking_types_)));
+}
+
void SyncBackendHostImpl::Observe(
int type,
const content::NotificationSource& source,
@@ -563,13 +582,19 @@ void SyncBackendHostImpl::HandleControlTypesDownloadRetry() {
void SyncBackendHostImpl::HandleInitializationSuccessOnFrontendLoop(
const syncer::WeakHandle<syncer::JsBackend> js_backend,
const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>
- debug_info_listener) {
+ debug_info_listener,
+ base::WeakPtr<syncer::SyncCore> sync_core) {
Nicolas Zea 2014/04/02 23:19:05 What do you think about creating the SyncCoreProxy
rlarocque 2014/04/03 01:03:46 I think that's a good idea. Done.
DCHECK_EQ(base::MessageLoop::current(), frontend_loop_);
if (!frontend_)
return;
initialized_ = true;
+ sync_core_proxy_.reset(
+ new syncer::SyncCoreProxy(
+ registrar_->sync_thread()->message_loop_proxy(),
+ sync_core));
+
invalidator_->RegisterInvalidationHandler(this);
invalidation_handler_registered_ = true;

Powered by Google App Engine
This is Rietveld 408576698