| 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 <stdint.h> |
| 9 |
| 8 #include <utility> | 10 #include <utility> |
| 9 #include <vector> | 11 #include <vector> |
| 10 | 12 |
| 11 #include "base/basictypes.h" | |
| 12 #include "base/callback.h" | 13 #include "base/callback.h" |
| 13 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
| 15 #include "base/macros.h" |
| 14 #include "base/synchronization/lock.h" | 16 #include "base/synchronization/lock.h" |
| 15 #include "sync/base/sync_export.h" | 17 #include "sync/base/sync_export.h" |
| 16 #include "sync/engine/conflict_resolver.h" | 18 #include "sync/engine/conflict_resolver.h" |
| 17 #include "sync/engine/syncer_types.h" | 19 #include "sync/engine/syncer_types.h" |
| 18 #include "sync/internal_api/public/base/model_type.h" | 20 #include "sync/internal_api/public/base/model_type.h" |
| 19 #include "sync/sessions/sync_session.h" | 21 #include "sync/sessions/sync_session.h" |
| 20 #include "sync/util/extensions_activity.h" | 22 #include "sync/util/extensions_activity.h" |
| 21 | 23 |
| 22 namespace syncer { | 24 namespace syncer { |
| 23 | 25 |
| 24 class CancelationSignal; | 26 class CancelationSignal; |
| 25 class CommitProcessor; | 27 class CommitProcessor; |
| 26 class GetUpdatesProcessor; | 28 class GetUpdatesProcessor; |
| 27 | 29 |
| 28 // A Syncer provides a control interface for driving the sync cycle. These | 30 // A Syncer provides a control interface for driving the sync cycle. These |
| 29 // cycles consist of downloading updates, parsing the response (aka. process | 31 // cycles consist of downloading updates, parsing the response (aka. process |
| 30 // updates), applying updates while resolving conflicts, and committing local | 32 // updates), applying updates while resolving conflicts, and committing local |
| 31 // changes. Some of these steps may be skipped if they're deemed to be | 33 // changes. Some of these steps may be skipped if they're deemed to be |
| 32 // unnecessary. | 34 // unnecessary. |
| 33 // | 35 // |
| 34 // A Syncer instance expects to run on a dedicated thread. Calls to SyncShare() | 36 // A Syncer instance expects to run on a dedicated thread. Calls to SyncShare() |
| 35 // may take an unbounded amount of time because it may block on network I/O, on | 37 // may take an unbounded amount of time because it may block on network I/O, on |
| 36 // lock contention, or on tasks posted to other threads. | 38 // lock contention, or on tasks posted to other threads. |
| 37 class SYNC_EXPORT Syncer { | 39 class SYNC_EXPORT Syncer { |
| 38 public: | 40 public: |
| 39 typedef std::vector<int64> UnsyncedMetaHandles; | 41 typedef std::vector<int64_t> UnsyncedMetaHandles; |
| 40 | 42 |
| 41 explicit Syncer(CancelationSignal* cancelation_signal); | 43 explicit Syncer(CancelationSignal* cancelation_signal); |
| 42 virtual ~Syncer(); | 44 virtual ~Syncer(); |
| 43 | 45 |
| 44 // Whether an early exist was requested due to a cancelation signal. | 46 // Whether an early exist was requested due to a cancelation signal. |
| 45 bool ExitRequested(); | 47 bool ExitRequested(); |
| 46 | 48 |
| 47 // Whether the syncer is in the middle of a sync cycle. | 49 // Whether the syncer is in the middle of a sync cycle. |
| 48 bool IsSyncing() const; | 50 bool IsSyncing() const; |
| 49 | 51 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 | 132 |
| 131 // Whether the syncer is in the middle of a sync attempt. | 133 // Whether the syncer is in the middle of a sync attempt. |
| 132 bool is_syncing_; | 134 bool is_syncing_; |
| 133 | 135 |
| 134 DISALLOW_COPY_AND_ASSIGN(Syncer); | 136 DISALLOW_COPY_AND_ASSIGN(Syncer); |
| 135 }; | 137 }; |
| 136 | 138 |
| 137 } // namespace syncer | 139 } // namespace syncer |
| 138 | 140 |
| 139 #endif // SYNC_ENGINE_SYNCER_H_ | 141 #endif // SYNC_ENGINE_SYNCER_H_ |
| OLD | NEW |