OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "sync/internal_api/public/sessions/model_neutral_state.h" | 5 #include "sync/internal_api/public/sessions/model_neutral_state.h" |
6 | 6 |
7 namespace syncer { | 7 namespace syncer { |
8 namespace sessions { | 8 namespace sessions { |
9 | 9 |
10 ModelNeutralState::ModelNeutralState() | 10 ModelNeutralState::ModelNeutralState() |
11 : num_successful_commits(0), | 11 : num_successful_commits(0), |
12 num_successful_bookmark_commits(0), | 12 num_successful_bookmark_commits(0), |
13 num_updates_downloaded_total(0), | 13 num_updates_downloaded_total(0), |
14 num_tombstone_updates_downloaded_total(0), | 14 num_tombstone_updates_downloaded_total(0), |
15 num_reflected_updates_downloaded_total(0), | 15 num_reflected_updates_downloaded_total(0), |
16 num_local_overwrites(0), | 16 num_local_overwrites(0), |
17 num_server_overwrites(0), | 17 num_server_overwrites(0), |
18 last_get_key_result(UNSET), | 18 last_get_key_result(UNSET), |
19 last_download_updates_result(UNSET), | 19 last_download_updates_result(UNSET), |
20 commit_result(UNSET), | 20 commit_result(UNSET), |
21 conflicts_resolved(false), | 21 conflicts_resolved(false), |
22 items_committed(false), | 22 items_committed(false), |
23 debug_info_sent(false), | 23 debug_info_sent(false), |
24 num_server_changes_remaining(0) { | 24 num_server_changes_remaining(0) { |
25 } | 25 } |
26 | 26 |
27 ModelNeutralState::~ModelNeutralState() {} | 27 ModelNeutralState::~ModelNeutralState() {} |
28 | 28 |
| 29 bool HasSyncerError(const ModelNeutralState& state) { |
| 30 const bool get_key_error = SyncerErrorIsError(state.last_get_key_result); |
| 31 const bool download_updates_error = |
| 32 SyncerErrorIsError(state.last_download_updates_result); |
| 33 const bool commit_error = SyncerErrorIsError(state.commit_result); |
| 34 return get_key_error || download_updates_error || commit_error; |
| 35 } |
| 36 |
29 } // namespace sessions | 37 } // namespace sessions |
30 } // namespace syncer | 38 } // namespace syncer |
OLD | NEW |