OLD | NEW |
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/sessions/session_state.h" | 5 #include "chrome/browser/sync/sessions/session_state.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 | 44 |
45 SyncerStatus::SyncerStatus() | 45 SyncerStatus::SyncerStatus() |
46 : invalid_store(false), | 46 : invalid_store(false), |
47 syncer_stuck(false), | 47 syncer_stuck(false), |
48 syncing(false), | 48 syncing(false), |
49 num_successful_commits(0), | 49 num_successful_commits(0), |
50 num_successful_bookmark_commits(0), | 50 num_successful_bookmark_commits(0), |
51 num_updates_downloaded_total(0), | 51 num_updates_downloaded_total(0), |
52 num_tombstone_updates_downloaded_total(0), | 52 num_tombstone_updates_downloaded_total(0), |
53 num_local_overwrites(0), | 53 num_local_overwrites(0), |
54 num_server_overwrites(0) { | 54 num_server_overwrites(0), |
| 55 throttled(false) { |
55 } | 56 } |
56 | 57 |
57 SyncerStatus::~SyncerStatus() { | 58 SyncerStatus::~SyncerStatus() { |
58 } | 59 } |
59 | 60 |
60 DictionaryValue* SyncerStatus::ToValue() const { | 61 DictionaryValue* SyncerStatus::ToValue() const { |
61 DictionaryValue* value = new DictionaryValue(); | 62 DictionaryValue* value = new DictionaryValue(); |
62 value->SetBoolean("invalidStore", invalid_store); | 63 value->SetBoolean("invalidStore", invalid_store); |
63 value->SetBoolean("syncerStuck", syncer_stuck); | 64 value->SetBoolean("syncerStuck", syncer_stuck); |
64 value->SetBoolean("syncing", syncing); | 65 value->SetBoolean("syncing", syncing); |
65 value->SetInteger("numSuccessfulCommits", num_successful_commits); | 66 value->SetInteger("numSuccessfulCommits", num_successful_commits); |
66 value->SetInteger("numSuccessfulBookmarkCommits", | 67 value->SetInteger("numSuccessfulBookmarkCommits", |
67 num_successful_bookmark_commits); | 68 num_successful_bookmark_commits); |
68 value->SetInteger("numUpdatesDownloadedTotal", | 69 value->SetInteger("numUpdatesDownloadedTotal", |
69 num_updates_downloaded_total); | 70 num_updates_downloaded_total); |
70 value->SetInteger("numTombstoneUpdatesDownloadedTotal", | 71 value->SetInteger("numTombstoneUpdatesDownloadedTotal", |
71 num_tombstone_updates_downloaded_total); | 72 num_tombstone_updates_downloaded_total); |
72 value->SetInteger("numLocalOverwrites", num_local_overwrites); | 73 value->SetInteger("numLocalOverwrites", num_local_overwrites); |
73 value->SetInteger("numServerOverwrites", num_server_overwrites); | 74 value->SetInteger("numServerOverwrites", num_server_overwrites); |
| 75 value->SetBoolean("throttled", throttled); |
74 return value; | 76 return value; |
75 } | 77 } |
76 | 78 |
77 DictionaryValue* DownloadProgressMarkersToValue( | 79 DictionaryValue* DownloadProgressMarkersToValue( |
78 const std::string | 80 const std::string |
79 (&download_progress_markers)[syncable::MODEL_TYPE_COUNT]) { | 81 (&download_progress_markers)[syncable::MODEL_TYPE_COUNT]) { |
80 DictionaryValue* value = new DictionaryValue(); | 82 DictionaryValue* value = new DictionaryValue(); |
81 for (int i = syncable::FIRST_REAL_MODEL_TYPE; | 83 for (int i = syncable::FIRST_REAL_MODEL_TYPE; |
82 i < syncable::MODEL_TYPE_COUNT; ++i) { | 84 i < syncable::MODEL_TYPE_COUNT; ++i) { |
83 // TODO(akalin): Unpack the value into a protobuf. | 85 // TODO(akalin): Unpack the value into a protobuf. |
(...skipping 30 matching lines...) Expand all Loading... |
114 bool is_share_usable, | 116 bool is_share_usable, |
115 const syncable::ModelTypeBitSet& initial_sync_ended, | 117 const syncable::ModelTypeBitSet& initial_sync_ended, |
116 const std::string | 118 const std::string |
117 (&download_progress_markers)[syncable::MODEL_TYPE_COUNT], | 119 (&download_progress_markers)[syncable::MODEL_TYPE_COUNT], |
118 bool more_to_sync, | 120 bool more_to_sync, |
119 bool is_silenced, | 121 bool is_silenced, |
120 int64 unsynced_count, | 122 int64 unsynced_count, |
121 int num_blocking_conflicting_updates, | 123 int num_blocking_conflicting_updates, |
122 int num_conflicting_updates, | 124 int num_conflicting_updates, |
123 bool did_commit_items, | 125 bool did_commit_items, |
124 const SyncSourceInfo& source) | 126 const SyncSourceInfo& source, |
| 127 size_t num_entries) |
125 : syncer_status(syncer_status), | 128 : syncer_status(syncer_status), |
126 errors(errors), | 129 errors(errors), |
127 num_server_changes_remaining(num_server_changes_remaining), | 130 num_server_changes_remaining(num_server_changes_remaining), |
128 is_share_usable(is_share_usable), | 131 is_share_usable(is_share_usable), |
129 initial_sync_ended(initial_sync_ended), | 132 initial_sync_ended(initial_sync_ended), |
130 download_progress_markers(), | 133 download_progress_markers(), |
131 has_more_to_sync(more_to_sync), | 134 has_more_to_sync(more_to_sync), |
132 is_silenced(is_silenced), | 135 is_silenced(is_silenced), |
133 unsynced_count(unsynced_count), | 136 unsynced_count(unsynced_count), |
134 num_blocking_conflicting_updates(num_blocking_conflicting_updates), | 137 num_blocking_conflicting_updates(num_blocking_conflicting_updates), |
135 num_conflicting_updates(num_conflicting_updates), | 138 num_conflicting_updates(num_conflicting_updates), |
136 did_commit_items(did_commit_items), | 139 did_commit_items(did_commit_items), |
137 source(source) { | 140 source(source), |
| 141 num_entries(num_entries){ |
138 for (int i = syncable::FIRST_REAL_MODEL_TYPE; | 142 for (int i = syncable::FIRST_REAL_MODEL_TYPE; |
139 i < syncable::MODEL_TYPE_COUNT; ++i) { | 143 i < syncable::MODEL_TYPE_COUNT; ++i) { |
140 const_cast<std::string&>(this->download_progress_markers[i]).assign( | 144 const_cast<std::string&>(this->download_progress_markers[i]).assign( |
141 download_progress_markers[i]); | 145 download_progress_markers[i]); |
142 } | 146 } |
143 } | 147 } |
144 | 148 |
145 SyncSessionSnapshot::~SyncSessionSnapshot() {} | 149 SyncSessionSnapshot::~SyncSessionSnapshot() {} |
146 | 150 |
147 DictionaryValue* SyncSessionSnapshot::ToValue() const { | 151 DictionaryValue* SyncSessionSnapshot::ToValue() const { |
(...skipping 10 matching lines...) Expand all Loading... |
158 DownloadProgressMarkersToValue(download_progress_markers)); | 162 DownloadProgressMarkersToValue(download_progress_markers)); |
159 value->SetBoolean("hasMoreToSync", has_more_to_sync); | 163 value->SetBoolean("hasMoreToSync", has_more_to_sync); |
160 value->SetBoolean("isSilenced", is_silenced); | 164 value->SetBoolean("isSilenced", is_silenced); |
161 // We don't care too much if we lose precision here, also. | 165 // We don't care too much if we lose precision here, also. |
162 value->SetInteger("unsyncedCount", | 166 value->SetInteger("unsyncedCount", |
163 static_cast<int>(unsynced_count)); | 167 static_cast<int>(unsynced_count)); |
164 value->SetInteger("numBlockingConflictingUpdates", | 168 value->SetInteger("numBlockingConflictingUpdates", |
165 num_blocking_conflicting_updates); | 169 num_blocking_conflicting_updates); |
166 value->SetInteger("numConflictingUpdates", num_conflicting_updates); | 170 value->SetInteger("numConflictingUpdates", num_conflicting_updates); |
167 value->SetBoolean("didCommitItems", did_commit_items); | 171 value->SetBoolean("didCommitItems", did_commit_items); |
| 172 value->SetInteger("num_entries", num_entries); |
168 value->Set("source", source.ToValue()); | 173 value->Set("source", source.ToValue()); |
169 return value; | 174 return value; |
170 } | 175 } |
171 | 176 |
172 ConflictProgress::ConflictProgress(bool* dirty_flag) : dirty_(dirty_flag) {} | 177 ConflictProgress::ConflictProgress(bool* dirty_flag) : dirty_(dirty_flag) {} |
173 | 178 |
174 ConflictProgress::~ConflictProgress() { | 179 ConflictProgress::~ConflictProgress() { |
175 CleanupSets(); | 180 CleanupSets(); |
176 } | 181 } |
177 | 182 |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 | 382 |
378 PerModelSafeGroupState::PerModelSafeGroupState(bool* dirty_flag) | 383 PerModelSafeGroupState::PerModelSafeGroupState(bool* dirty_flag) |
379 : conflict_progress(dirty_flag) { | 384 : conflict_progress(dirty_flag) { |
380 } | 385 } |
381 | 386 |
382 PerModelSafeGroupState::~PerModelSafeGroupState() { | 387 PerModelSafeGroupState::~PerModelSafeGroupState() { |
383 } | 388 } |
384 | 389 |
385 } // namespace sessions | 390 } // namespace sessions |
386 } // namespace browser_sync | 391 } // namespace browser_sync |
OLD | NEW |