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

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

Issue 7604019: [Sync] Add client-side plumbing for server control of sessions commit delay (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile error and address comments 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/sync/engine/syncapi.cc ('k') | chrome/browser/sync/engine/syncer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/syncer.h" 5 #include "chrome/browser/sync/engine/syncer.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/time.h" 8 #include "base/time.h"
9 #include "base/tracked.h" 9 #include "base/tracked.h"
10 #include "chrome/browser/sync/engine/apply_updates_command.h" 10 #include "chrome/browser/sync/engine/apply_updates_command.h"
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 command.max_commit_batch_size()); 305 command.max_commit_batch_size());
306 } 306 }
307 if (command.has_set_sync_long_poll_interval()) { 307 if (command.has_set_sync_long_poll_interval()) {
308 session->delegate()->OnReceivedLongPollIntervalUpdate( 308 session->delegate()->OnReceivedLongPollIntervalUpdate(
309 TimeDelta::FromSeconds(command.set_sync_long_poll_interval())); 309 TimeDelta::FromSeconds(command.set_sync_long_poll_interval()));
310 } 310 }
311 if (command.has_set_sync_poll_interval()) { 311 if (command.has_set_sync_poll_interval()) {
312 session->delegate()->OnReceivedShortPollIntervalUpdate( 312 session->delegate()->OnReceivedShortPollIntervalUpdate(
313 TimeDelta::FromSeconds(command.set_sync_poll_interval())); 313 TimeDelta::FromSeconds(command.set_sync_poll_interval()));
314 } 314 }
315
316 if (command.has_sessions_commit_delay_seconds()) {
317 session->delegate()->OnReceivedSessionsCommitDelay(
318 TimeDelta::FromSeconds(command.sessions_commit_delay_seconds()));
319 }
315 } 320 }
316 321
317 void CopyServerFields(syncable::Entry* src, syncable::MutableEntry* dest) { 322 void CopyServerFields(syncable::Entry* src, syncable::MutableEntry* dest) {
318 dest->Put(SERVER_NON_UNIQUE_NAME, src->Get(SERVER_NON_UNIQUE_NAME)); 323 dest->Put(SERVER_NON_UNIQUE_NAME, src->Get(SERVER_NON_UNIQUE_NAME));
319 dest->Put(SERVER_PARENT_ID, src->Get(SERVER_PARENT_ID)); 324 dest->Put(SERVER_PARENT_ID, src->Get(SERVER_PARENT_ID));
320 dest->Put(SERVER_MTIME, src->Get(SERVER_MTIME)); 325 dest->Put(SERVER_MTIME, src->Get(SERVER_MTIME));
321 dest->Put(SERVER_CTIME, src->Get(SERVER_CTIME)); 326 dest->Put(SERVER_CTIME, src->Get(SERVER_CTIME));
322 dest->Put(SERVER_VERSION, src->Get(SERVER_VERSION)); 327 dest->Put(SERVER_VERSION, src->Get(SERVER_VERSION));
323 dest->Put(SERVER_IS_DIR, src->Get(SERVER_IS_DIR)); 328 dest->Put(SERVER_IS_DIR, src->Get(SERVER_IS_DIR));
324 dest->Put(SERVER_IS_DEL, src->Get(SERVER_IS_DEL)); 329 dest->Put(SERVER_IS_DEL, src->Get(SERVER_IS_DEL));
325 dest->Put(IS_UNAPPLIED_UPDATE, src->Get(IS_UNAPPLIED_UPDATE)); 330 dest->Put(IS_UNAPPLIED_UPDATE, src->Get(IS_UNAPPLIED_UPDATE));
326 dest->Put(SERVER_SPECIFICS, src->Get(SERVER_SPECIFICS)); 331 dest->Put(SERVER_SPECIFICS, src->Get(SERVER_SPECIFICS));
327 dest->Put(SERVER_POSITION_IN_PARENT, src->Get(SERVER_POSITION_IN_PARENT)); 332 dest->Put(SERVER_POSITION_IN_PARENT, src->Get(SERVER_POSITION_IN_PARENT));
328 } 333 }
329 334
330 void ClearServerData(syncable::MutableEntry* entry) { 335 void ClearServerData(syncable::MutableEntry* entry) {
331 entry->Put(SERVER_NON_UNIQUE_NAME, ""); 336 entry->Put(SERVER_NON_UNIQUE_NAME, "");
332 entry->Put(SERVER_PARENT_ID, syncable::kNullId); 337 entry->Put(SERVER_PARENT_ID, syncable::kNullId);
333 entry->Put(SERVER_MTIME, 0); 338 entry->Put(SERVER_MTIME, 0);
334 entry->Put(SERVER_CTIME, 0); 339 entry->Put(SERVER_CTIME, 0);
335 entry->Put(SERVER_VERSION, 0); 340 entry->Put(SERVER_VERSION, 0);
336 entry->Put(SERVER_IS_DIR, false); 341 entry->Put(SERVER_IS_DIR, false);
337 entry->Put(SERVER_IS_DEL, false); 342 entry->Put(SERVER_IS_DEL, false);
338 entry->Put(IS_UNAPPLIED_UPDATE, false); 343 entry->Put(IS_UNAPPLIED_UPDATE, false);
339 entry->Put(SERVER_SPECIFICS, sync_pb::EntitySpecifics::default_instance()); 344 entry->Put(SERVER_SPECIFICS, sync_pb::EntitySpecifics::default_instance());
340 entry->Put(SERVER_POSITION_IN_PARENT, 0); 345 entry->Put(SERVER_POSITION_IN_PARENT, 0);
341 } 346 }
342 347
343 } // namespace browser_sync 348 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/engine/syncapi.cc ('k') | chrome/browser/sync/engine/syncer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698