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