Commit 4cda8457 authored by mlerman's avatar mlerman Committed by Commit bot

Disable sync for Lightspeed experimentation.

We want to determine Sync's contribution to Browser startup. As such,
we will add code allowing us to disable Sync (or a part thereof) via
Finch.

The SupervisedUserService was/is not robust to disabling Sync (it
crashes). Since disabling sync is a generally supported feature
(there's a command line flag), that is now fixed.

BUG=454788

Review URL: https://codereview.chromium.org/933293005

Cr-Commit-Position: refs/heads/master@{#317642}
parent e74cff74
......@@ -146,6 +146,18 @@ syncer::ModelTypeSet GetDisabledTypesFromCommandLine(
syncer::ModelTypeSet disabled_types;
std::string disabled_types_str =
command_line.GetSwitchValueASCII(switches::kDisableSyncTypes);
// Disable sync types experimentally to measure impact on startup time.
// TODO(mlerman): Remove this after the experiment. crbug.com/454788
std::string disable_types_finch =
variations::GetVariationParamValue("LightSpeed", "DisableSyncPart");
if (!disable_types_finch.empty()) {
if (disabled_types_str.empty())
disabled_types_str = disable_types_finch;
else
disabled_types_str += ", " + disable_types_finch;
}
disabled_types = syncer::ModelTypeSetFromString(disabled_types_str);
return disabled_types;
}
......
......@@ -32,6 +32,7 @@
#include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "components/signin/core/browser/profile_oauth2_token_service.h"
#include "components/signin/core/browser/signin_manager.h"
#include "components/variations/variations_associated_data.h"
#include "url/gurl.h"
#if defined(ENABLE_EXTENSIONS)
......@@ -50,6 +51,15 @@ ProfileSyncService* ProfileSyncServiceFactory::GetForProfile(
if (!ProfileSyncService::IsSyncEnabled())
return NULL;
// Disable sync experimentally to measure impact on startup time. Supervised
// users are unaffected, since supervised users rely completely on sync.
// TODO(mlerman): Remove this after the experiment. crbug.com/454788
if (!profile->IsSupervised() &&
!variations::GetVariationParamValue("LightSpeed", "DisableSync")
.empty()) {
return NULL;
}
return static_cast<ProfileSyncService*>(
GetInstance()->GetServiceForBrowserContext(profile, true));
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment