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/engine/syncer.h" | 5 #include "sync/engine/syncer.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 // shifted to completely using Ordinals. | 29 // shifted to completely using Ordinals. |
30 // See http://crbug.com/145412 . | 30 // See http://crbug.com/145412 . |
31 #include "sync/internal_api/public/base/node_ordinal.h" | 31 #include "sync/internal_api/public/base/node_ordinal.h" |
32 | 32 |
33 using base::Time; | 33 using base::Time; |
34 using base::TimeDelta; | 34 using base::TimeDelta; |
35 using sync_pb::ClientCommand; | 35 using sync_pb::ClientCommand; |
36 | 36 |
37 namespace syncer { | 37 namespace syncer { |
38 | 38 |
39 using sessions::ScopedSessionContextConflictResolver; | |
40 using sessions::StatusController; | 39 using sessions::StatusController; |
41 using sessions::SyncSession; | 40 using sessions::SyncSession; |
42 using syncable::IS_UNAPPLIED_UPDATE; | 41 using syncable::IS_UNAPPLIED_UPDATE; |
43 using syncable::SERVER_CTIME; | 42 using syncable::SERVER_CTIME; |
44 using syncable::SERVER_IS_DEL; | 43 using syncable::SERVER_IS_DEL; |
45 using syncable::SERVER_IS_DIR; | 44 using syncable::SERVER_IS_DIR; |
46 using syncable::SERVER_MTIME; | 45 using syncable::SERVER_MTIME; |
47 using syncable::SERVER_NON_UNIQUE_NAME; | 46 using syncable::SERVER_NON_UNIQUE_NAME; |
48 using syncable::SERVER_PARENT_ID; | 47 using syncable::SERVER_PARENT_ID; |
49 using syncable::SERVER_ORDINAL_IN_PARENT; | 48 using syncable::SERVER_ORDINAL_IN_PARENT; |
(...skipping 29 matching lines...) Expand all Loading... |
79 } | 78 } |
80 | 79 |
81 void Syncer::RequestEarlyExit() { | 80 void Syncer::RequestEarlyExit() { |
82 base::AutoLock lock(early_exit_requested_lock_); | 81 base::AutoLock lock(early_exit_requested_lock_); |
83 early_exit_requested_ = true; | 82 early_exit_requested_ = true; |
84 } | 83 } |
85 | 84 |
86 bool Syncer::SyncShare(sessions::SyncSession* session, | 85 bool Syncer::SyncShare(sessions::SyncSession* session, |
87 SyncerStep first_step, | 86 SyncerStep first_step, |
88 SyncerStep last_step) { | 87 SyncerStep last_step) { |
89 ScopedSessionContextConflictResolver scoped(session->context(), | |
90 &resolver_); | |
91 session->mutable_status_controller()->UpdateStartTime(); | 88 session->mutable_status_controller()->UpdateStartTime(); |
92 SyncerStep current_step = first_step; | 89 SyncerStep current_step = first_step; |
93 | 90 |
94 SyncerStep next_step = current_step; | 91 SyncerStep next_step = current_step; |
95 while (!ExitRequested()) { | 92 while (!ExitRequested()) { |
96 TRACE_EVENT1("sync", "SyncerStateMachine", | 93 TRACE_EVENT1("sync", "SyncerStateMachine", |
97 "state", SyncerStepToString(current_step)); | 94 "state", SyncerStepToString(current_step)); |
98 DVLOG(1) << "Syncer step:" << SyncerStepToString(current_step); | 95 DVLOG(1) << "Syncer step:" << SyncerStepToString(current_step); |
99 | 96 |
100 switch (current_step) { | 97 switch (current_step) { |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 entry->Put(SERVER_CTIME, Time()); | 208 entry->Put(SERVER_CTIME, Time()); |
212 entry->Put(SERVER_VERSION, 0); | 209 entry->Put(SERVER_VERSION, 0); |
213 entry->Put(SERVER_IS_DIR, false); | 210 entry->Put(SERVER_IS_DIR, false); |
214 entry->Put(SERVER_IS_DEL, false); | 211 entry->Put(SERVER_IS_DEL, false); |
215 entry->Put(IS_UNAPPLIED_UPDATE, false); | 212 entry->Put(IS_UNAPPLIED_UPDATE, false); |
216 entry->Put(SERVER_SPECIFICS, sync_pb::EntitySpecifics::default_instance()); | 213 entry->Put(SERVER_SPECIFICS, sync_pb::EntitySpecifics::default_instance()); |
217 entry->Put(SERVER_ORDINAL_IN_PARENT, Int64ToNodeOrdinal(0)); | 214 entry->Put(SERVER_ORDINAL_IN_PARENT, Int64ToNodeOrdinal(0)); |
218 } | 215 } |
219 | 216 |
220 } // namespace syncer | 217 } // namespace syncer |
OLD | NEW |