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

Unified Diff: chrome/browser/sync/profile_sync_service.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, 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
« no previous file with comments | « chrome/browser/sync/profile_sync_service.h ('k') | sync/internal_api/public/sync_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/profile_sync_service.cc
diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc
index 2e704e3c97434d120980d988e8191fabf7c2be27..42f2b71d19f3d41ef6cc2231b096089402136ced 100644
--- a/chrome/browser/sync/profile_sync_service.cc
+++ b/chrome/browser/sync/profile_sync_service.cc
@@ -79,6 +79,7 @@
#include "sync/internal_api/public/configure_reason.h"
#include "sync/internal_api/public/http_bridge_network_resources.h"
#include "sync/internal_api/public/network_resources.h"
+#include "sync/internal_api/public/sync_core_proxy.h"
#include "sync/internal_api/public/sync_encryption_handler.h"
#include "sync/internal_api/public/util/experiments.h"
#include "sync/internal_api/public/util/sync_string_conversions.h"
@@ -345,10 +346,18 @@ void ProfileSyncService::UnregisterAuthNotifications() {
void ProfileSyncService::RegisterDataTypeController(
DataTypeController* data_type_controller) {
DCHECK_EQ(data_type_controllers_.count(data_type_controller->type()), 0U);
+ DCHECK(!GetRegisteredNonBlockingDataTypes().Has(
+ data_type_controller->type()));
data_type_controllers_[data_type_controller->type()] =
data_type_controller;
}
+void ProfileSyncService::RegisterNonBlockingType(syncer::ModelType type) {
+ DCHECK_EQ(data_type_controllers_.count(type), 0U);
+ DCHECK(!GetRegisteredNonBlockingDataTypes().Has(type));
+ non_blocking_types_.Put(type);
+}
+
browser_sync::SessionModelAssociator*
ProfileSyncService::GetSessionModelAssociatorDeprecated() {
if (!IsSessionsDataTypeControllerRunning())
@@ -939,6 +948,8 @@ void ProfileSyncService::OnBackendInitialized(
backend_->RequestBufferedProtocolEventsAndEnableForwarding();
}
+ syncer::SyncCoreProxy sync_core_proxy_ = backend_->GetSyncCoreProxy();
+
// If we have a cached passphrase use it to decrypt/encrypt data now that the
// backend is initialized. We want to call this before notifying observers in
// case this operation affects the "passphrase required" status.
@@ -1213,7 +1224,7 @@ void ProfileSyncService::OnPassphraseRequired(
<< syncer::PassphraseRequiredReasonToString(reason);
passphrase_required_reason_ = reason;
- const syncer::ModelTypeSet types = GetPreferredDataTypes();
+ const syncer::ModelTypeSet types = GetPreferredDirectoryDataTypes();
Nicolas Zea 2014/04/03 20:36:08 It's unclear to me how we should trigger reconfigu
if (data_type_manager_) {
// Reconfigure without the encrypted types (excluded implicitly via the
// failed datatypes handler).
@@ -1241,7 +1252,7 @@ void ProfileSyncService::OnPassphraseAccepted() {
// Make sure the data types that depend on the passphrase are started at
// this time.
- const syncer::ModelTypeSet types = GetPreferredDataTypes();
+ const syncer::ModelTypeSet types = GetPreferredDirectoryDataTypes();
if (data_type_manager_) {
// Re-enable any encrypted types if necessary.
data_type_manager_->Configure(types,
@@ -1674,7 +1685,27 @@ syncer::ModelTypeSet ProfileSyncService::GetPreferredDataTypes() const {
return preferred_types;
}
+syncer::ModelTypeSet
+ProfileSyncService::GetPreferredDirectoryDataTypes() const {
+ const syncer::ModelTypeSet registered_directory_types =
+ GetRegisteredDirectoryDataTypes();
+ const syncer::ModelTypeSet preferred_types =
+ sync_prefs_.GetPreferredDataTypes(registered_directory_types);
+ return preferred_types;
+}
+
+syncer::ModelTypeSet
+ProfileSyncService::GetPreferredNonBlockingDataTypes() const {
+ return sync_prefs_.GetPreferredDataTypes(GetRegisteredNonBlockingDataTypes());
+}
+
syncer::ModelTypeSet ProfileSyncService::GetRegisteredDataTypes() const {
+ return Union(GetRegisteredDirectoryDataTypes(),
+ GetRegisteredNonBlockingDataTypes());
+}
+
+syncer::ModelTypeSet
+ProfileSyncService::GetRegisteredDirectoryDataTypes() const {
syncer::ModelTypeSet registered_types;
// The data_type_controllers_ are determined by command-line flags; that's
// effectively what controls the values returned here.
@@ -1686,6 +1717,11 @@ syncer::ModelTypeSet ProfileSyncService::GetRegisteredDataTypes() const {
return registered_types;
}
+syncer::ModelTypeSet
+ProfileSyncService::GetRegisteredNonBlockingDataTypes() const {
+ return non_blocking_types_;
+}
+
bool ProfileSyncService::IsUsingSecondaryPassphrase() const {
syncer::PassphraseType passphrase_type = GetPassphraseType();
return passphrase_type == syncer::FROZEN_IMPLICIT_PASSPHRASE ||
@@ -1707,7 +1743,8 @@ bool ProfileSyncService::IsCryptographerReady(
void ProfileSyncService::ConfigurePriorityDataTypes() {
const syncer::ModelTypeSet priority_types =
- Intersection(GetPreferredDataTypes(), syncer::PriorityUserTypes());
+ Intersection(GetPreferredDirectoryDataTypes(),
+ syncer::PriorityUserTypes());
if (!priority_types.Empty()) {
const syncer::ConfigureReason reason = HasSyncSetupCompleted() ?
syncer::CONFIGURE_REASON_RECONFIGURATION :
@@ -1745,7 +1782,7 @@ void ProfileSyncService::ConfigureDataTypeManager() {
base::Unretained(this))));
}
- const syncer::ModelTypeSet types = GetPreferredDataTypes();
+ const syncer::ModelTypeSet types = GetPreferredDirectoryDataTypes();
syncer::ConfigureReason reason = syncer::CONFIGURE_REASON_UNKNOWN;
if (!HasSyncSetupCompleted()) {
reason = syncer::CONFIGURE_REASON_NEW_CLIENT;
@@ -1862,6 +1899,9 @@ base::Value* ProfileSyncService::GetTypeStatusMap() const {
} else if (throttled_types.Has(type)) {
type_status->SetString("status", "warning");
type_status->SetString("value", "Throttled");
+ } else if (GetRegisteredNonBlockingDataTypes().Has(type)) {
+ type_status->SetString("status", "ok");
+ type_status->SetString("value", "Non-Blocking");
} else if (active_types.Has(type)) {
type_status->SetString("status", "ok");
type_status->SetString("value", "Active: " +
« no previous file with comments | « chrome/browser/sync/profile_sync_service.h ('k') | sync/internal_api/public/sync_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698