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

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

Issue 1161006: Make it clear what last_sync_timestamp actually tracks. Update (Closed)
Patch Set: Undo accidental patch-juggling mistake. Created 10 years, 9 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
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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_end_command.h" 5 #include "chrome/browser/sync/engine/syncer_end_command.h"
6 6
7 #include "chrome/browser/sync/engine/syncer_types.h" 7 #include "chrome/browser/sync/engine/syncer_types.h"
8 #include "chrome/browser/sync/sessions/sync_session.h" 8 #include "chrome/browser/sync/sessions/sync_session.h"
9 #include "chrome/browser/sync/syncable/directory_manager.h" 9 #include "chrome/browser/sync/syncable/directory_manager.h"
10 #include "chrome/browser/sync/util/event_sys-inl.h" 10 #include "chrome/browser/sync/util/event_sys-inl.h"
11 11
12 namespace browser_sync { 12 namespace browser_sync {
13 13
14 SyncerEndCommand::SyncerEndCommand() {} 14 SyncerEndCommand::SyncerEndCommand() {}
15 SyncerEndCommand::~SyncerEndCommand() {} 15 SyncerEndCommand::~SyncerEndCommand() {}
16 16
17 void SyncerEndCommand::ExecuteImpl(sessions::SyncSession* session) { 17 void SyncerEndCommand::ExecuteImpl(sessions::SyncSession* session) {
18 sessions::StatusController* status(session->status_controller()); 18 sessions::StatusController* status(session->status_controller());
19 status->set_syncing(false); 19 status->set_syncing(false);
20 20
21 if (!session->HasMoreToSync()) { 21 // This might be the first time we've fully completed a sync cycle.
22 // This might be the first time we've fully completed a sync cycle. 22 if (!session->HasMoreToSync() &&
23 DCHECK(status->got_zero_updates()); 23 status->server_says_nothing_more_to_download()) {
24
25 syncable::ScopedDirLookup dir(session->context()->directory_manager(), 24 syncable::ScopedDirLookup dir(session->context()->directory_manager(),
26 session->context()->account_name()); 25 session->context()->account_name());
27 if (!dir.good()) { 26 if (!dir.good()) {
28 LOG(ERROR) << "Scoped dir lookup failed!"; 27 LOG(ERROR) << "Scoped dir lookup failed!";
29 return; 28 return;
30 } 29 }
31 30
32 // This gets persisted to the directory's backing store. 31 // This gets persisted to the directory's backing store.
33 dir->set_initial_sync_ended(true); 32 dir->set_initial_sync_ended(true);
34 } 33 }
35 34
36 SyncerEvent event(SyncerEvent::SYNC_CYCLE_ENDED); 35 SyncerEvent event(SyncerEvent::SYNC_CYCLE_ENDED);
37 sessions::SyncSessionSnapshot snapshot(session->TakeSnapshot()); 36 sessions::SyncSessionSnapshot snapshot(session->TakeSnapshot());
38 event.snapshot = &snapshot; 37 event.snapshot = &snapshot;
39 session->context()->syncer_event_channel()->NotifyListeners(event); 38 session->context()->syncer_event_channel()->NotifyListeners(event);
40 } 39 }
41 40
42 } // namespace browser_sync 41 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/engine/syncer.cc ('k') | chrome/browser/sync/engine/verify_updates_command.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698