OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-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 // | 5 // |
6 // THIS CLASS PROVIDES NO SYNCHRONIZATION GUARANTEES. | 6 // THIS CLASS PROVIDES NO SYNCHRONIZATION GUARANTEES. |
7 | 7 |
8 #include "chrome/browser/sync/engine/sync_process_state.h" | 8 #include "chrome/browser/sync/engine/sync_process_state.h" |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 #include <set> | 11 #include <set> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
15 #include "chrome/browser/sync/syncable/directory_manager.h" | 15 #include "chrome/browser/sync/syncable/directory_manager.h" |
16 #include "chrome/browser/sync/syncable/syncable.h" | 16 #include "chrome/browser/sync/syncable/syncable.h" |
17 | 17 |
18 using std::map; | 18 using std::map; |
19 using std::set; | 19 using std::set; |
20 using std::vector; | 20 using std::vector; |
21 | 21 |
22 namespace browser_sync { | 22 namespace browser_sync { |
23 | 23 |
24 SyncProcessState::SyncProcessState(const SyncProcessState& counts) | 24 SyncProcessState::SyncProcessState(const SyncProcessState& counts) |
25 : account_name_(counts.account_name_), | 25 : connection_manager_(counts.connection_manager_), |
| 26 account_name_(counts.account_name_), |
26 dirman_(counts.dirman_), | 27 dirman_(counts.dirman_), |
27 syncer_event_channel_(counts.syncer_event_channel_), | |
28 connection_manager_(counts.connection_manager_), | |
29 resolver_(counts.resolver_), | 28 resolver_(counts.resolver_), |
30 model_safe_worker_(counts.model_safe_worker_) { | 29 model_safe_worker_(counts.model_safe_worker_), |
| 30 syncer_event_channel_(counts.syncer_event_channel_) { |
31 *this = counts; | 31 *this = counts; |
32 } | 32 } |
33 | 33 |
34 SyncProcessState::SyncProcessState(syncable::DirectoryManager* dirman, | 34 SyncProcessState::SyncProcessState(syncable::DirectoryManager* dirman, |
35 PathString account_name, | 35 PathString account_name, |
36 ServerConnectionManager* connection_manager, | 36 ServerConnectionManager* connection_manager, |
37 ConflictResolver* const resolver, | 37 ConflictResolver* const resolver, |
38 SyncerEventChannel* syncer_event_channel, | 38 SyncerEventChannel* syncer_event_channel, |
39 ModelSafeWorker* model_safe_worker) | 39 ModelSafeWorker* model_safe_worker) |
40 : account_name_(account_name), | 40 : num_sync_cycles_(0), |
| 41 silenced_until_(0), |
| 42 connection_manager_(connection_manager), |
| 43 account_name_(account_name), |
41 dirman_(dirman), | 44 dirman_(dirman), |
| 45 resolver_(resolver), |
| 46 model_safe_worker_(model_safe_worker), |
42 syncer_event_channel_(syncer_event_channel), | 47 syncer_event_channel_(syncer_event_channel), |
43 connection_manager_(connection_manager), | |
44 model_safe_worker_(model_safe_worker), | |
45 resolver_(resolver), | |
46 syncer_stuck_(false), | |
47 num_sync_cycles_(0), | |
48 silenced_until_(0), | |
49 error_rate_(0), | 48 error_rate_(0), |
50 current_sync_timestamp_(0), | 49 current_sync_timestamp_(0), |
51 servers_latest_timestamp_(0), | 50 servers_latest_timestamp_(0), |
| 51 syncing_(false), |
| 52 invalid_store_(false), |
| 53 syncer_stuck_(false), |
52 error_commits_(0), | 54 error_commits_(0), |
| 55 conflicting_commits_(0), |
53 stalled_commits_(0), | 56 stalled_commits_(0), |
54 conflicting_commits_(0), | |
55 consecutive_problem_get_updates_(0), | 57 consecutive_problem_get_updates_(0), |
56 consecutive_problem_commits_(0), | 58 consecutive_problem_commits_(0), |
57 consecutive_transient_error_commits_(0), | 59 consecutive_transient_error_commits_(0), |
58 consecutive_errors_(0), | 60 consecutive_errors_(0), |
59 successful_commits_(0), | 61 successful_commits_(0), |
60 dirty_(false), | 62 dirty_(false), |
61 auth_dirty_(false), | 63 auth_dirty_(false), |
62 auth_failed_(false), | 64 auth_failed_(false) { |
63 invalid_store_(false) { | |
64 syncable::ScopedDirLookup dir(dirman_, account_name_); | 65 syncable::ScopedDirLookup dir(dirman_, account_name_); |
65 | 66 |
66 // The directory must be good here. | 67 // The directory must be good here. |
67 LOG_IF(ERROR, !dir.good()); | 68 LOG_IF(ERROR, !dir.good()); |
68 syncing_ = !dir->initial_sync_ended(); | 69 syncing_ = !dir->initial_sync_ended(); |
69 | 70 |
70 // If we have never synced then we are invalid until made otherwise. | 71 // If we have never synced then we are invalid until made otherwise. |
71 set_invalid_store((dir->last_sync_timestamp() <= 0)); | 72 set_invalid_store((dir->last_sync_timestamp() <= 0)); |
72 } | 73 } |
73 | 74 |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 auth_failed_ = true; | 317 auth_failed_ = true; |
317 } | 318 } |
318 | 319 |
319 void SyncProcessState::AuthSucceeded() { | 320 void SyncProcessState::AuthSucceeded() { |
320 // Dirty if the last one DID fail. | 321 // Dirty if the last one DID fail. |
321 UpdateAuthDirty(false != auth_failed_); | 322 UpdateAuthDirty(false != auth_failed_); |
322 auth_failed_ = false; | 323 auth_failed_ = false; |
323 } | 324 } |
324 | 325 |
325 } // namespace browser_sync | 326 } // namespace browser_sync |
OLD | NEW |