| 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 #ifndef SYNC_ENGINE_SYNCER_H_ | 5 #ifndef SYNC_ENGINE_SYNCER_H_ |
| 6 #define SYNC_ENGINE_SYNCER_H_ | 6 #define SYNC_ENGINE_SYNCER_H_ |
| 7 | 7 |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
| 14 #include "base/synchronization/lock.h" | 14 #include "base/synchronization/lock.h" |
| 15 #include "sync/base/sync_export.h" | 15 #include "sync/base/sync_export.h" |
| 16 #include "sync/engine/conflict_resolver.h" | 16 #include "sync/engine/conflict_resolver.h" |
| 17 #include "sync/engine/syncer_types.h" | 17 #include "sync/engine/syncer_types.h" |
| 18 #include "sync/internal_api/public/base/model_type.h" | 18 #include "sync/internal_api/public/base/model_type.h" |
| 19 #include "sync/sessions/sync_session.h" | 19 #include "sync/sessions/sync_session.h" |
| 20 #include "sync/util/extensions_activity.h" | 20 #include "sync/util/extensions_activity.h" |
| 21 | 21 |
| 22 namespace syncer { | 22 namespace syncer { |
| 23 | 23 |
| 24 class CancelationSignal; | 24 class CancelationSignal; |
| 25 | 25 |
| 26 // A Syncer provides a control interface for driving the individual steps | 26 // A Syncer provides a control interface for driving the sync cycle. These |
| 27 // of the sync cycle. Each cycle (hopefully) moves the client into closer | 27 // cycles consist of downloading updates, parsing the response (aka. process |
| 28 // synchronization with the server. The individual steps are modeled | 28 // updates), applying updates while resolving conflicts, and committing local |
| 29 // as SyncerCommands, and the ordering of the steps is expressed using | 29 // changes. Some of these steps may be skipped if they're deemed to be |
| 30 // the SyncerStep enum. | 30 // unnecessary. |
| 31 // | 31 // |
| 32 // A Syncer instance expects to run on a dedicated thread. Calls | 32 // A Syncer instance expects to run on a dedicated thread. Calls to SyncShare() |
| 33 // to SyncShare() may take an unbounded amount of time, as SyncerCommands | 33 // may take an unbounded amount of time because it may block on network I/O, on |
| 34 // may block on network i/o, on lock contention, or on tasks posted to | 34 // lock contention, or on tasks posted to other threads. |
| 35 // other threads. | |
| 36 class SYNC_EXPORT_PRIVATE Syncer { | 35 class SYNC_EXPORT_PRIVATE Syncer { |
| 37 public: | 36 public: |
| 38 typedef std::vector<int64> UnsyncedMetaHandles; | 37 typedef std::vector<int64> UnsyncedMetaHandles; |
| 39 | 38 |
| 40 Syncer(CancelationSignal* cancelation_signal); | 39 Syncer(CancelationSignal* cancelation_signal); |
| 41 virtual ~Syncer(); | 40 virtual ~Syncer(); |
| 42 | 41 |
| 43 bool ExitRequested(); | 42 bool ExitRequested(); |
| 44 | 43 |
| 45 // Fetches and applies updates, resolves conflicts and commits local changes | 44 // Fetches and applies updates, resolves conflicts and commits local changes |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 FRIEND_TEST_ALL_PREFIXES(SyncerTest, DeletingEntryWithLocalEdits); | 109 FRIEND_TEST_ALL_PREFIXES(SyncerTest, DeletingEntryWithLocalEdits); |
| 111 FRIEND_TEST_ALL_PREFIXES(EntryCreatedInNewFolderTest, | 110 FRIEND_TEST_ALL_PREFIXES(EntryCreatedInNewFolderTest, |
| 112 EntryCreatedInNewFolderMidSync); | 111 EntryCreatedInNewFolderMidSync); |
| 113 | 112 |
| 114 DISALLOW_COPY_AND_ASSIGN(Syncer); | 113 DISALLOW_COPY_AND_ASSIGN(Syncer); |
| 115 }; | 114 }; |
| 116 | 115 |
| 117 } // namespace syncer | 116 } // namespace syncer |
| 118 | 117 |
| 119 #endif // SYNC_ENGINE_SYNCER_H_ | 118 #endif // SYNC_ENGINE_SYNCER_H_ |
| OLD | NEW |