| OLD | NEW |
| 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/sessions/sync_session.h" | 5 #include "chrome/browser/sync/sessions/sync_session.h" |
| 6 #include "chrome/browser/sync/syncable/directory_manager.h" | 6 #include "chrome/browser/sync/syncable/directory_manager.h" |
| 7 | 7 |
| 8 namespace browser_sync { | 8 namespace browser_sync { |
| 9 namespace sessions { | 9 namespace sessions { |
| 10 | 10 |
| 11 SyncSession::SyncSession(SyncSessionContext* context, Delegate* delegate) | 11 SyncSession::SyncSession(SyncSessionContext* context, Delegate* delegate) |
| 12 : context_(context), | 12 : context_(context), |
| 13 source_(sync_pb::GetUpdatesCallerInfo::UNKNOWN), | 13 source_(sync_pb::GetUpdatesCallerInfo::UNKNOWN), |
| 14 write_transaction_(NULL), | 14 write_transaction_(NULL), |
| 15 delegate_(delegate), | 15 delegate_(delegate), |
| 16 auth_failure_occurred_(false) { | 16 auth_failure_occurred_(false) { |
| 17 |
| 18 std::vector<ModelSafeWorker*>* s = |
| 19 const_cast<std::vector<ModelSafeWorker*>* >(&workers_); |
| 20 context_->registrar()->GetWorkers(s); |
| 21 |
| 22 // TODO(tim): Use ModelSafeRoutingInfo to silo parts of the session status by |
| 23 // ModelSafeGroup; |
| 24 // e.g. have a map<class, commit_ids>, map<class, ConflictProgress> etc. |
| 25 // The routing will be used to map multiple model types into the right silo. |
| 26 // The routing info can't change throughout a session, so we're assured that |
| 27 // (for example) commit_ids for syncable::AUTOFILL items that were being |
| 28 // processed as part of the GROUP_PASSIVE run (because they weren't being |
| 29 // synced) *continue* to be for this whole session, even though the |
| 30 // ModelSafeWorkerRegistrar may be configured to route syncable::AUTOFILL to |
| 31 // GROUP_DB now. |
| 32 group_restriction_in_effect_ = false; |
| 33 group_restriction_ = GROUP_PASSIVE; |
| 17 } | 34 } |
| 18 | 35 |
| 19 SyncSessionSnapshot SyncSession::TakeSnapshot() const { | 36 SyncSessionSnapshot SyncSession::TakeSnapshot() const { |
| 20 syncable::ScopedDirLookup dir(context_->directory_manager(), | 37 syncable::ScopedDirLookup dir(context_->directory_manager(), |
| 21 context_->account_name()); | 38 context_->account_name()); |
| 22 if (!dir.good()) | 39 if (!dir.good()) |
| 23 LOG(ERROR) << "Scoped dir lookup failed!"; | 40 LOG(ERROR) << "Scoped dir lookup failed!"; |
| 24 | 41 |
| 25 const bool is_share_usable = dir->initial_sync_ended(); | 42 const bool is_share_usable = dir->initial_sync_ended(); |
| 26 return SyncSessionSnapshot( | 43 return SyncSessionSnapshot( |
| (...skipping 22 matching lines...) Expand all Loading... |
| 49 status.conflict_sets_built() || | 66 status.conflict_sets_built() || |
| 50 status.conflicts_resolved() || | 67 status.conflicts_resolved() || |
| 51 // Or, we have conflicting updates, but we're making progress on | 68 // Or, we have conflicting updates, but we're making progress on |
| 52 // resolving them... | 69 // resolving them... |
| 53 !status.got_zero_updates() || | 70 !status.got_zero_updates() || |
| 54 status.timestamp_dirty(); | 71 status.timestamp_dirty(); |
| 55 } | 72 } |
| 56 | 73 |
| 57 } // namespace sessions | 74 } // namespace sessions |
| 58 } // namespace browser_sync | 75 } // namespace browser_sync |
| OLD | NEW |