| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_SYNC_ENGINE_SYNCER_H_ | 5 #ifndef CHROME_BROWSER_SYNC_ENGINE_SYNCER_H_ |
| 6 #define CHROME_BROWSER_SYNC_ENGINE_SYNCER_H_ | 6 #define CHROME_BROWSER_SYNC_ENGINE_SYNCER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 // the SyncerStep enum. | 67 // the SyncerStep enum. |
| 68 // | 68 // |
| 69 // A Syncer instance expects to run on a dedicated thread. Calls | 69 // A Syncer instance expects to run on a dedicated thread. Calls |
| 70 // to SyncShare() may take an unbounded amount of time, as SyncerCommands | 70 // to SyncShare() may take an unbounded amount of time, as SyncerCommands |
| 71 // may block on network i/o, on lock contention, or on tasks posted to | 71 // may block on network i/o, on lock contention, or on tasks posted to |
| 72 // other threads. | 72 // other threads. |
| 73 class Syncer { | 73 class Syncer { |
| 74 public: | 74 public: |
| 75 typedef std::vector<int64> UnsyncedMetaHandles; | 75 typedef std::vector<int64> UnsyncedMetaHandles; |
| 76 | 76 |
| 77 // The constructor may be called from a thread that is not the Syncer's | |
| 78 // dedicated thread, to allow some flexibility in the setup. | |
| 79 Syncer(); | 77 Syncer(); |
| 80 virtual ~Syncer(); | 78 virtual ~Syncer(); |
| 81 | 79 |
| 82 // Called by other threads to tell the syncer to stop what it's doing | 80 // Called by other threads to tell the syncer to stop what it's doing |
| 83 // and return early from SyncShare, if possible. | 81 // and return early from SyncShare, if possible. |
| 84 bool ExitRequested(); | 82 bool ExitRequested(); |
| 85 void RequestEarlyExit(); | 83 void RequestEarlyExit(); |
| 86 | 84 |
| 87 // Like SyncShare() above, but |first_step| and |last_step| are provided to | 85 // Runs a sync cycle from |first_step| to |last_step|. |
| 88 // perform a partial sync cycle, stopping after |last_step| is performed. | |
| 89 virtual void SyncShare(sessions::SyncSession* session, | 86 virtual void SyncShare(sessions::SyncSession* session, |
| 90 SyncerStep first_step, | 87 SyncerStep first_step, |
| 91 SyncerStep last_step); | 88 SyncerStep last_step); |
| 92 | 89 |
| 93 private: | 90 private: |
| 94 // Implements the PROCESS_CLIENT_COMMAND syncer step. | 91 // Implements the PROCESS_CLIENT_COMMAND syncer step. |
| 95 void ProcessClientCommand(sessions::SyncSession* session); | 92 void ProcessClientCommand(sessions::SyncSession* session); |
| 96 | 93 |
| 97 bool early_exit_requested_; | 94 bool early_exit_requested_; |
| 98 base::Lock early_exit_requested_lock_; | 95 base::Lock early_exit_requested_lock_; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 }; | 128 }; |
| 132 | 129 |
| 133 // Utility function declarations. | 130 // Utility function declarations. |
| 134 void CopyServerFields(syncable::Entry* src, syncable::MutableEntry* dest); | 131 void CopyServerFields(syncable::Entry* src, syncable::MutableEntry* dest); |
| 135 void ClearServerData(syncable::MutableEntry* entry); | 132 void ClearServerData(syncable::MutableEntry* entry); |
| 136 | 133 |
| 137 } // namespace browser_sync | 134 } // namespace browser_sync |
| 138 | 135 |
| 139 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCER_H_ | 136 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCER_H_ |
| 140 | 137 |
| OLD | NEW |