OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 // A class representing an attempt to synchronize the local syncable data | 5 // A class representing an attempt to synchronize the local syncable data |
6 // store with a sync server. A SyncSession instance is passed as a stateful | 6 // store with a sync server. A SyncSession instance is passed as a stateful |
7 // bundle to and from various SyncerCommands with the goal of converging the | 7 // bundle to and from various SyncerCommands with the goal of converging the |
8 // client view of data with that of the server. The commands twiddle with | 8 // client view of data with that of the server. The commands twiddle with |
9 // session status in response to events and hiccups along the way, set and | 9 // session status in response to events and hiccups along the way, set and |
10 // query session progress with regards to conflict resolution and applying | 10 // query session progress with regards to conflict resolution and applying |
11 // server updates, and access the SyncSessionContext for the current session | 11 // server updates, and access the SyncSessionContext for the current session |
12 // via SyncSession instances. | 12 // via SyncSession instances. |
13 | 13 |
14 #ifndef SYNC_SESSIONS_SYNC_SESSION_H_ | 14 #ifndef SYNC_SESSIONS_SYNC_SESSION_H_ |
15 #define SYNC_SESSIONS_SYNC_SESSION_H_ | 15 #define SYNC_SESSIONS_SYNC_SESSION_H_ |
16 | 16 |
17 #include <map> | 17 #include <map> |
18 #include <set> | 18 #include <set> |
19 #include <string> | 19 #include <string> |
20 #include <utility> | 20 #include <utility> |
21 #include <vector> | 21 #include <vector> |
22 | 22 |
23 #include "base/basictypes.h" | 23 #include "base/basictypes.h" |
24 #include "base/memory/scoped_ptr.h" | 24 #include "base/memory/scoped_ptr.h" |
25 #include "base/time.h" | 25 #include "base/time.h" |
| 26 #include "sync/base/sync_export.h" |
26 #include "sync/internal_api/public/base/model_type.h" | 27 #include "sync/internal_api/public/base/model_type.h" |
27 #include "sync/internal_api/public/engine/model_safe_worker.h" | 28 #include "sync/internal_api/public/engine/model_safe_worker.h" |
28 #include "sync/internal_api/public/sessions/sync_session_snapshot.h" | 29 #include "sync/internal_api/public/sessions/sync_session_snapshot.h" |
29 #include "sync/sessions/ordered_commit_set.h" | 30 #include "sync/sessions/ordered_commit_set.h" |
30 #include "sync/sessions/status_controller.h" | 31 #include "sync/sessions/status_controller.h" |
31 #include "sync/sessions/sync_session_context.h" | 32 #include "sync/sessions/sync_session_context.h" |
32 #include "sync/util/extensions_activity_monitor.h" | 33 #include "sync/util/extensions_activity_monitor.h" |
33 | 34 |
34 namespace syncer { | 35 namespace syncer { |
35 class ModelSafeWorker; | 36 class ModelSafeWorker; |
36 | 37 |
37 namespace syncable { | 38 namespace syncable { |
38 class WriteTransaction; | 39 class WriteTransaction; |
39 } | 40 } |
40 | 41 |
41 namespace sessions { | 42 namespace sessions { |
42 | 43 |
43 class SyncSession { | 44 class SYNC_EXPORT_PRIVATE SyncSession { |
44 public: | 45 public: |
45 // The Delegate services events that occur during the session requiring an | 46 // The Delegate services events that occur during the session requiring an |
46 // explicit (and session-global) action, as opposed to events that are simply | 47 // explicit (and session-global) action, as opposed to events that are simply |
47 // recorded in per-session state. | 48 // recorded in per-session state. |
48 class Delegate { | 49 class SYNC_EXPORT_PRIVATE Delegate { |
49 public: | 50 public: |
50 // The client was throttled and should cease-and-desist syncing activity | 51 // The client was throttled and should cease-and-desist syncing activity |
51 // until the specified time. | 52 // until the specified time. |
52 virtual void OnSilencedUntil(const base::TimeTicks& silenced_until) = 0; | 53 virtual void OnSilencedUntil(const base::TimeTicks& silenced_until) = 0; |
53 | 54 |
54 // Silenced intervals can be out of phase with individual sessions, so the | 55 // Silenced intervals can be out of phase with individual sessions, so the |
55 // delegate is the only thing that can give an authoritative answer for | 56 // delegate is the only thing that can give an authoritative answer for |
56 // "is syncing silenced right now". This shouldn't be necessary very often | 57 // "is syncing silenced right now". This shouldn't be necessary very often |
57 // as the delegate ensures no session is started if syncing is silenced. | 58 // as the delegate ensures no session is started if syncing is silenced. |
58 // ** Note ** This will return true if silencing commenced during this | 59 // ** Note ** This will return true if silencing commenced during this |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 | 213 |
213 private: | 214 private: |
214 SyncSession* session_; | 215 SyncSession* session_; |
215 DISALLOW_COPY_AND_ASSIGN(ScopedSetSessionWriteTransaction); | 216 DISALLOW_COPY_AND_ASSIGN(ScopedSetSessionWriteTransaction); |
216 }; | 217 }; |
217 | 218 |
218 } // namespace sessions | 219 } // namespace sessions |
219 } // namespace syncer | 220 } // namespace syncer |
220 | 221 |
221 #endif // SYNC_SESSIONS_SYNC_SESSION_H_ | 222 #endif // SYNC_SESSIONS_SYNC_SESSION_H_ |
OLD | NEW |