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

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

Issue 8787006: Delay autofill commits to reduce client to server traffic. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: For review. Created 9 years 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/bind.h" 10 #include "base/bind.h"
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 535
536 if (pending_nudge_.get()) { 536 if (pending_nudge_.get()) {
537 if (IsBackingOff() && delay > TimeDelta::FromSeconds(1)) { 537 if (IsBackingOff() && delay > TimeDelta::FromSeconds(1)) {
538 SDVLOG(2) << "Dropping the nudge because we are in backoff"; 538 SDVLOG(2) << "Dropping the nudge because we are in backoff";
539 return; 539 return;
540 } 540 }
541 541
542 SDVLOG(2) << "Coalescing pending nudge"; 542 SDVLOG(2) << "Coalescing pending nudge";
543 pending_nudge_->session->Coalesce(*(job.session.get())); 543 pending_nudge_->session->Coalesce(*(job.session.get()));
544 544
545 if (!IsBackingOff()) { 545 SDVLOG(2) << "Rescheduling pending nudge";
546 SDVLOG(2) << "Dropping a nudge because" 546 SyncSession* s = pending_nudge_->session.get();
547 << " we are not in backoff and the job was coalesced"; 547 job.session.reset(new SyncSession(s->context(), s->delegate(),
548 return; 548 s->source(), s->routing_info(), s->workers()));
549 } else { 549
550 SDVLOG(2) << "Rescheduling pending nudge"; 550 // Choose the start time as the earliest of the 2.
551 SyncSession* s = pending_nudge_->session.get(); 551 job.scheduled_start = std::min(job.scheduled_start,
552 job.session.reset(new SyncSession(s->context(), s->delegate(), 552 pending_nudge_->scheduled_start);
tim (not reviewing) 2011/12/06 20:15:57 This was explicitly not the goal of the implementa
lipalani1 2011/12/06 20:44:06 This is a needed change and is deliberate. Need:
553 s->source(), s->routing_info(), s->workers())); 553 pending_nudge_.reset();
554 pending_nudge_.reset();
555 }
556 } 554 }
557 555
558 // TODO(lipalani) - pass the job itself to ScheduleSyncSessionJob. 556 // TODO(lipalani) - pass the job itself to ScheduleSyncSessionJob.
559 ScheduleSyncSessionJob(delay, SyncSessionJob::NUDGE, job.session.release(), 557 ScheduleSyncSessionJob(delay, SyncSessionJob::NUDGE, job.session.release(),
560 nudge_location); 558 nudge_location);
561 } 559 }
562 560
563 // Helper to extract the routing info and workers corresponding to types in 561 // Helper to extract the routing info and workers corresponding to types in
564 // |types| from |registrar|. 562 // |types| from |registrar|.
565 void GetModelSafeParamsForTypes(const ModelTypeBitSet& types, 563 void GetModelSafeParamsForTypes(const ModelTypeBitSet& types,
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
1187 1185
1188 #undef SDVLOG_LOC 1186 #undef SDVLOG_LOC
1189 1187
1190 #undef SDVLOG 1188 #undef SDVLOG
1191 1189
1192 #undef SLOG 1190 #undef SLOG
1193 1191
1194 #undef ENUM_CASE 1192 #undef ENUM_CASE
1195 1193
1196 } // browser_sync 1194 } // browser_sync
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/sync/engine/sync_scheduler_unittest.cc » ('j') | chrome/browser/sync/internal_api/sync_manager.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698