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

Side by Side Diff: chrome/browser/sync/engine/sync_scheduler.cc

Issue 7655055: [Sync] Make BackendMigrator not wait for full sync cycles (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix mac test Created 9 years, 3 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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/engine/sync_scheduler.h" 5 #include "chrome/browser/sync/engine/sync_scheduler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cstring> 8 #include <cstring>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 ModelSafeGroup group; 408 ModelSafeGroup group;
409 }; 409 };
410 410
411 void SyncScheduler::ScheduleClearUserData() { 411 void SyncScheduler::ScheduleClearUserData() {
412 DCHECK_EQ(MessageLoop::current(), sync_loop_); 412 DCHECK_EQ(MessageLoop::current(), sync_loop_);
413 PostTask(FROM_HERE, "ScheduleClearUserDataImpl", 413 PostTask(FROM_HERE, "ScheduleClearUserDataImpl",
414 method_factory_.NewRunnableMethod( 414 method_factory_.NewRunnableMethod(
415 &SyncScheduler::ScheduleClearUserDataImpl)); 415 &SyncScheduler::ScheduleClearUserDataImpl));
416 } 416 }
417 417
418 // TODO(sync): Remove the *Impl methods for the other Schedule*
419 // functions, too.
418 void SyncScheduler::ScheduleCleanupDisabledTypes() { 420 void SyncScheduler::ScheduleCleanupDisabledTypes() {
419 DCHECK_EQ(MessageLoop::current(), sync_loop_); 421 DCHECK_EQ(MessageLoop::current(), sync_loop_);
420 PostTask(FROM_HERE, "ScheduleCleanupDisabledTypes", 422 ScheduleSyncSessionJob(
421 method_factory_.NewRunnableMethod( 423 TimeDelta::FromSeconds(0), SyncSessionJob::CLEANUP_DISABLED_TYPES,
422 &SyncScheduler::ScheduleCleanupDisabledTypesImpl)); 424 CreateSyncSession(SyncSourceInfo()), FROM_HERE);
423 } 425 }
424 426
425 void SyncScheduler::ScheduleNudge( 427 void SyncScheduler::ScheduleNudge(
426 const TimeDelta& delay, 428 const TimeDelta& delay,
427 NudgeSource source, const ModelTypeBitSet& types, 429 NudgeSource source, const ModelTypeBitSet& types,
428 const tracked_objects::Location& nudge_location) { 430 const tracked_objects::Location& nudge_location) {
429 DCHECK_EQ(MessageLoop::current(), sync_loop_); 431 DCHECK_EQ(MessageLoop::current(), sync_loop_);
430 SVLOG_LOC(nudge_location, 2) 432 SVLOG_LOC(nudge_location, 2)
431 << "Nudge scheduled with delay " << delay.InMilliseconds() << " ms, " 433 << "Nudge scheduled with delay " << delay.InMilliseconds() << " ms, "
432 << "source " << GetNudgeSourceString(source) << ", " 434 << "source " << GetNudgeSourceString(source) << ", "
(...skipping 26 matching lines...) Expand all
459 nudge_location)); 461 nudge_location));
460 } 462 }
461 463
462 void SyncScheduler::ScheduleClearUserDataImpl() { 464 void SyncScheduler::ScheduleClearUserDataImpl() {
463 DCHECK_EQ(MessageLoop::current(), sync_loop_); 465 DCHECK_EQ(MessageLoop::current(), sync_loop_);
464 ScheduleSyncSessionJob( 466 ScheduleSyncSessionJob(
465 TimeDelta::FromSeconds(0), SyncSessionJob::CLEAR_USER_DATA, 467 TimeDelta::FromSeconds(0), SyncSessionJob::CLEAR_USER_DATA,
466 CreateSyncSession(SyncSourceInfo()), FROM_HERE); 468 CreateSyncSession(SyncSourceInfo()), FROM_HERE);
467 } 469 }
468 470
469 void SyncScheduler::ScheduleCleanupDisabledTypesImpl() {
470 DCHECK_EQ(MessageLoop::current(), sync_loop_);
471 ScheduleSyncSessionJob(
472 TimeDelta::FromSeconds(0), SyncSessionJob::CLEANUP_DISABLED_TYPES,
473 CreateSyncSession(SyncSourceInfo()), FROM_HERE);
474 }
475
476 void SyncScheduler::ScheduleNudgeImpl( 471 void SyncScheduler::ScheduleNudgeImpl(
477 const TimeDelta& delay, 472 const TimeDelta& delay,
478 GetUpdatesCallerInfo::GetUpdatesSource source, 473 GetUpdatesCallerInfo::GetUpdatesSource source,
479 const ModelTypePayloadMap& types_with_payloads, 474 const ModelTypePayloadMap& types_with_payloads,
480 bool is_canary_job, const tracked_objects::Location& nudge_location) { 475 bool is_canary_job, const tracked_objects::Location& nudge_location) {
481 DCHECK_EQ(MessageLoop::current(), sync_loop_); 476 DCHECK_EQ(MessageLoop::current(), sync_loop_);
482 477
483 SVLOG_LOC(nudge_location, 2) 478 SVLOG_LOC(nudge_location, 2)
484 << "In ScheduleNudgeImpl with delay " 479 << "In ScheduleNudgeImpl with delay "
485 << delay.InMilliseconds() << " ms, " 480 << delay.InMilliseconds() << " ms, "
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
999 copy.is_canary_job = is_canary_job; 994 copy.is_canary_job = is_canary_job;
1000 DoSyncSessionJob(copy); 995 DoSyncSessionJob(copy);
1001 } 996 }
1002 } 997 }
1003 998
1004 SyncSession* SyncScheduler::CreateSyncSession(const SyncSourceInfo& source) { 999 SyncSession* SyncScheduler::CreateSyncSession(const SyncSourceInfo& source) {
1005 DCHECK_EQ(MessageLoop::current(), sync_loop_); 1000 DCHECK_EQ(MessageLoop::current(), sync_loop_);
1006 ModelSafeRoutingInfo routes; 1001 ModelSafeRoutingInfo routes;
1007 std::vector<ModelSafeWorker*> workers; 1002 std::vector<ModelSafeWorker*> workers;
1008 session_context_->registrar()->GetModelSafeRoutingInfo(&routes); 1003 session_context_->registrar()->GetModelSafeRoutingInfo(&routes);
1004 VLOG(2) << "Creating sync session with routes "
1005 << ModelSafeRoutingInfoToString(routes);
1009 session_context_->registrar()->GetWorkers(&workers); 1006 session_context_->registrar()->GetWorkers(&workers);
1010 SyncSourceInfo info(source); 1007 SyncSourceInfo info(source);
1011 1008
1012 SyncSession* session(new SyncSession(session_context_.get(), this, info, 1009 SyncSession* session(new SyncSession(session_context_.get(), this, info,
1013 routes, workers)); 1010 routes, workers));
1014 1011
1015 return session; 1012 return session;
1016 } 1013 }
1017 1014
1018 void SyncScheduler::PollTimerCallback() { 1015 void SyncScheduler::PollTimerCallback() {
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
1105 1102
1106 #undef SVLOG_LOC 1103 #undef SVLOG_LOC
1107 1104
1108 #undef SVLOG 1105 #undef SVLOG
1109 1106
1110 #undef SLOG 1107 #undef SLOG
1111 1108
1112 #undef ENUM_CASE 1109 #undef ENUM_CASE
1113 1110
1114 } // browser_sync 1111 } // browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698