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

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

Issue 6104003: sync: use progress markers instead of timestamps during GetUpdates (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: For review Created 9 years, 11 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/syncapi.h" 5 #include "chrome/browser/sync/engine/syncapi.h"
6 6
7 #include <bitset> 7 #include <bitset>
8 #include <iomanip> 8 #include <iomanip>
9 #include <list> 9 #include <list>
10 #include <string> 10 #include <string>
(...skipping 2047 matching lines...) Expand 10 before | Expand all | Expand 10 after
2058 else if (exists_now && existed_before && VisiblePropertiesDiffer(*i, e)) 2058 else if (exists_now && existed_before && VisiblePropertiesDiffer(*i, e))
2059 change_buffers_[type].PushUpdatedItem(id, VisiblePositionsDiffer(*i, e)); 2059 change_buffers_[type].PushUpdatedItem(id, VisiblePositionsDiffer(*i, e));
2060 2060
2061 SetExtraChangeRecordData(id, type, &change_buffers_[type], 2061 SetExtraChangeRecordData(id, type, &change_buffers_[type],
2062 dir_manager()->cryptographer(), *i, 2062 dir_manager()->cryptographer(), *i,
2063 existed_before, exists_now); 2063 existed_before, exists_now);
2064 } 2064 }
2065 } 2065 }
2066 2066
2067 SyncManager::Status::Summary 2067 SyncManager::Status::Summary
2068 SyncManager::SyncInternal::ComputeAggregatedStatusSummary() { 2068 SyncManager::SyncInternal::ComputeAggregatedStatusSummary() {
tim (not reviewing) 2011/01/11 19:14:23 'Compute' is misleading now, Maybe just GetStatusS
ncarter (slow) 2011/01/13 00:06:13 Done.
2069 switch (allstatus_.status().icon) { 2069 return allstatus_.status().summary;
2070 case AllStatus::OFFLINE:
2071 return Status::OFFLINE;
2072 case AllStatus::OFFLINE_UNSYNCED:
2073 return Status::OFFLINE_UNSYNCED;
2074 case AllStatus::SYNCING:
2075 return Status::SYNCING;
2076 case AllStatus::READY:
2077 return Status::READY;
2078 case AllStatus::CONFLICT:
2079 return Status::CONFLICT;
2080 case AllStatus::OFFLINE_UNUSABLE:
2081 return Status::OFFLINE_UNUSABLE;
2082 default:
2083 return Status::INVALID;
2084 }
2085 } 2070 }
2086 2071
2087 SyncManager::Status SyncManager::SyncInternal::ComputeAggregatedStatus() { 2072 SyncManager::Status SyncManager::SyncInternal::ComputeAggregatedStatus() {
2088 Status return_status = 2073 return allstatus_.status();
2089 { ComputeAggregatedStatusSummary(),
2090 allstatus_.status().authenticated,
2091 allstatus_.status().server_up,
2092 allstatus_.status().server_reachable,
2093 allstatus_.status().server_broken,
2094 allstatus_.status().notifications_enabled,
2095 allstatus_.status().notifications_received,
2096 allstatus_.status().notifications_sent,
2097 allstatus_.status().unsynced_count,
2098 allstatus_.status().conflicting_count,
2099 allstatus_.status().syncing,
2100 allstatus_.status().initial_sync_ended,
2101 allstatus_.status().syncer_stuck,
2102 allstatus_.status().updates_available,
2103 allstatus_.status().updates_received,
2104 allstatus_.status().disk_full,
2105 false, // TODO(ncarter): invalid store?
2106 allstatus_.status().max_consecutive_errors};
2107 return return_status;
2108 } 2074 }
2109 2075
2110 void SyncManager::SyncInternal::OnSyncEngineEvent( 2076 void SyncManager::SyncInternal::OnSyncEngineEvent(
2111 const SyncEngineEvent& event) { 2077 const SyncEngineEvent& event) {
2112 if (!observer_) 2078 if (!observer_)
2113 return; 2079 return;
2114 2080
2115 // Only send an event if this is due to a cycle ending and this cycle 2081 // Only send an event if this is due to a cycle ending and this cycle
2116 // concludes a canonical "sync" process; that is, based on what is known 2082 // concludes a canonical "sync" process; that is, based on what is known
2117 // locally we are "all happy" and up-to-date. There may be new changes on 2083 // locally we are "all happy" and up-to-date. There may be new changes on
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
2351 DCHECK(data_->initialized()) << "GetUserShare requires initialization!"; 2317 DCHECK(data_->initialized()) << "GetUserShare requires initialization!";
2352 return data_->GetUserShare(); 2318 return data_->GetUserShare();
2353 } 2319 }
2354 2320
2355 bool SyncManager::HasUnsyncedItems() const { 2321 bool SyncManager::HasUnsyncedItems() const {
2356 sync_api::ReadTransaction trans(GetUserShare()); 2322 sync_api::ReadTransaction trans(GetUserShare());
2357 return (trans.GetWrappedTrans()->directory()->unsynced_entity_count() != 0); 2323 return (trans.GetWrappedTrans()->directory()->unsynced_entity_count() != 0);
2358 } 2324 }
2359 2325
2360 } // namespace sync_api 2326 } // namespace sync_api
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698