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 // A class to schedule syncer tasks intelligently. | 5 // A class to schedule syncer tasks intelligently. |
6 #ifndef SYNC_ENGINE_SYNC_SCHEDULER_H_ | 6 #ifndef SYNC_ENGINE_SYNC_SCHEDULER_H_ |
7 #define SYNC_ENGINE_SYNC_SCHEDULER_H_ | 7 #define SYNC_ENGINE_SYNC_SCHEDULER_H_ |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 namespace tracked_objects { | 31 namespace tracked_objects { |
32 class Location; | 32 class Location; |
33 } // namespace tracked_objects | 33 } // namespace tracked_objects |
34 | 34 |
35 namespace syncer { | 35 namespace syncer { |
36 | 36 |
37 struct ServerConnectionEvent; | 37 struct ServerConnectionEvent; |
38 | 38 |
39 struct ConfigurationParams { | 39 struct ConfigurationParams { |
40 enum KeystoreKeyStatus { | |
41 KEYSTORE_KEY_UNNECESSARY, | |
42 KEYSTORE_KEY_NEEDED | |
43 }; | |
44 ConfigurationParams(); | 40 ConfigurationParams(); |
45 ConfigurationParams( | 41 ConfigurationParams( |
46 const sync_pb::GetUpdatesCallerInfo::GetUpdatesSource& source, | 42 const sync_pb::GetUpdatesCallerInfo::GetUpdatesSource& source, |
47 const syncer::ModelTypeSet& types_to_download, | 43 const syncer::ModelTypeSet& types_to_download, |
48 const syncer::ModelSafeRoutingInfo& routing_info, | 44 const syncer::ModelSafeRoutingInfo& routing_info, |
49 KeystoreKeyStatus keystore_key_status, | |
50 const base::Closure& ready_task); | 45 const base::Closure& ready_task); |
51 ~ConfigurationParams(); | 46 ~ConfigurationParams(); |
52 | 47 |
53 // Source for the configuration. | 48 // Source for the configuration. |
54 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source; | 49 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source; |
55 // The types that should be downloaded. | 50 // The types that should be downloaded. |
56 syncer::ModelTypeSet types_to_download; | 51 syncer::ModelTypeSet types_to_download; |
57 // The new routing info (superset of types to be downloaded). | 52 // The new routing info (superset of types to be downloaded). |
58 ModelSafeRoutingInfo routing_info; | 53 ModelSafeRoutingInfo routing_info; |
59 // Whether we need to perform a GetKey command. | |
60 KeystoreKeyStatus keystore_key_status; | |
61 // Callback to invoke on configuration completion. | 54 // Callback to invoke on configuration completion. |
62 base::Closure ready_task; | 55 base::Closure ready_task; |
63 }; | 56 }; |
64 | 57 |
65 class SyncScheduler : public sessions::SyncSession::Delegate { | 58 class SyncScheduler : public sessions::SyncSession::Delegate { |
66 public: | 59 public: |
67 enum Mode { | 60 enum Mode { |
68 // In this mode, the thread only performs configuration tasks. This is | 61 // In this mode, the thread only performs configuration tasks. This is |
69 // designed to make the case where we want to download updates for a | 62 // designed to make the case where we want to download updates for a |
70 // specific type only, and not continue syncing until we are moved into | 63 // specific type only, and not continue syncing until we are moved into |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 scoped_ptr<Syncer> syncer_; | 405 scoped_ptr<Syncer> syncer_; |
413 | 406 |
414 sessions::SyncSessionContext *session_context_; | 407 sessions::SyncSessionContext *session_context_; |
415 | 408 |
416 DISALLOW_COPY_AND_ASSIGN(SyncScheduler); | 409 DISALLOW_COPY_AND_ASSIGN(SyncScheduler); |
417 }; | 410 }; |
418 | 411 |
419 } // namespace syncer | 412 } // namespace syncer |
420 | 413 |
421 #endif // SYNC_ENGINE_SYNC_SCHEDULER_H_ | 414 #endif // SYNC_ENGINE_SYNC_SCHEDULER_H_ |
OLD | NEW |