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

Unified Diff: chrome/browser/sync/engine/sync_scheduler.cc

Issue 7719011: Move some files from sync/engine to internal_api (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Refresh the diff and remove unintended change Created 9 years, 4 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/engine/sync_scheduler.h ('k') | chrome/browser/sync/engine/sync_scheduler_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/engine/sync_scheduler.cc
diff --git a/chrome/browser/sync/engine/sync_scheduler.cc b/chrome/browser/sync/engine/sync_scheduler.cc
index 993b72755abcd019a89a4ff8380c7a91d5c9dbac..394fb828cef1f9656a57ed90e09bf76da454ba0d 100644
--- a/chrome/browser/sync/engine/sync_scheduler.cc
+++ b/chrome/browser/sync/engine/sync_scheduler.cc
@@ -104,24 +104,6 @@ GetUpdatesCallerInfo::GetUpdatesSource GetUpdatesFromNudgeSource(
}
}
-GetUpdatesCallerInfo::GetUpdatesSource GetSourceFromReason(
- sync_api::ConfigureReason reason) {
- switch (reason) {
- case sync_api::CONFIGURE_REASON_RECONFIGURATION:
- return GetUpdatesCallerInfo::RECONFIGURATION;
- case sync_api::CONFIGURE_REASON_MIGRATION:
- return GetUpdatesCallerInfo::MIGRATION;
- case sync_api::CONFIGURE_REASON_NEW_CLIENT:
- return GetUpdatesCallerInfo::NEW_CLIENT;
- case sync_api::CONFIGURE_REASON_NEWLY_ENABLED_DATA_TYPE:
- return GetUpdatesCallerInfo::NEWLY_SUPPORTED_DATATYPE;
- default:
- NOTREACHED();
- }
-
- return GetUpdatesCallerInfo::UNKNOWN;
-}
-
SyncScheduler::WaitInterval::WaitInterval(Mode mode, TimeDelta length)
: mode(mode), had_nudge(false), length(length) { }
@@ -139,6 +121,19 @@ namespace {
const int kDefaultSessionsCommitDelaySeconds = 10;
+bool IsConfigRelatedUpdateSourceValue(
+ GetUpdatesCallerInfo::GetUpdatesSource source) {
+ switch (source) {
+ case GetUpdatesCallerInfo::RECONFIGURATION:
+ case GetUpdatesCallerInfo::MIGRATION:
+ case GetUpdatesCallerInfo::NEW_CLIENT:
+ case GetUpdatesCallerInfo::NEWLY_SUPPORTED_DATATYPE:
+ return true;
+ default:
+ return false;
+ }
+}
+
} // namespace
SyncScheduler::SyncScheduler(const std::string& name,
@@ -571,9 +566,11 @@ void GetModelSafeParamsForTypes(const ModelTypeBitSet& types,
}
}
-void SyncScheduler::ScheduleConfig(const ModelTypeBitSet& types,
- sync_api::ConfigureReason reason) {
+void SyncScheduler::ScheduleConfig(
+ const ModelTypeBitSet& types,
+ GetUpdatesCallerInfo::GetUpdatesSource source) {
DCHECK_EQ(MessageLoop::current(), sync_loop_);
+ DCHECK(IsConfigRelatedUpdateSourceValue(source));
SVLOG(2) << "Scheduling a config";
ModelSafeRoutingInfo routes;
std::vector<ModelSafeWorker*> workers;
@@ -582,8 +579,7 @@ void SyncScheduler::ScheduleConfig(const ModelTypeBitSet& types,
PostTask(FROM_HERE, "ScheduleConfigImpl",
method_factory_.NewRunnableMethod(
- &SyncScheduler::ScheduleConfigImpl, routes, workers,
- GetSourceFromReason(reason)));
+ &SyncScheduler::ScheduleConfigImpl, routes, workers, source));
}
void SyncScheduler::ScheduleConfigImpl(
« no previous file with comments | « chrome/browser/sync/engine/sync_scheduler.h ('k') | chrome/browser/sync/engine/sync_scheduler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698