| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 // to SyncShare() may take an unbounded amount of time, as SyncerCommands | 72 // to SyncShare() may take an unbounded amount of time, as SyncerCommands |
| 73 // may block on network i/o, on lock contention, or on tasks posted to | 73 // may block on network i/o, on lock contention, or on tasks posted to |
| 74 // other threads. | 74 // other threads. |
| 75 class Syncer { | 75 class Syncer { |
| 76 public: | 76 public: |
| 77 typedef std::vector<int64> UnsyncedMetaHandles; | 77 typedef std::vector<int64> UnsyncedMetaHandles; |
| 78 | 78 |
| 79 // The constructor may be called from a thread that is not the Syncer's | 79 // The constructor may be called from a thread that is not the Syncer's |
| 80 // dedicated thread, to allow some flexibility in the setup. | 80 // dedicated thread, to allow some flexibility in the setup. |
| 81 Syncer(); | 81 Syncer(); |
| 82 ~Syncer(); | 82 virtual ~Syncer(); |
| 83 | 83 |
| 84 // Called by other threads to tell the syncer to stop what it's doing | 84 // Called by other threads to tell the syncer to stop what it's doing |
| 85 // and return early from SyncShare, if possible. | 85 // and return early from SyncShare, if possible. |
| 86 bool ExitRequested(); | 86 bool ExitRequested(); |
| 87 void RequestEarlyExit(); | 87 void RequestEarlyExit(); |
| 88 | 88 |
| 89 // Cause one sync cycle to occur. Like a good parent, it is the caller's | 89 // Cause one sync cycle to occur. Like a good parent, it is the caller's |
| 90 // responsibility to clean up after the syncer when it finishes a sync share | 90 // responsibility to clean up after the syncer when it finishes a sync share |
| 91 // operation and honor server mandated throttles. | 91 // operation and honor server mandated throttles. |
| 92 void SyncShare(sessions::SyncSession* session); | 92 virtual void SyncShare(sessions::SyncSession* session); |
| 93 | 93 |
| 94 // Limit the batch size of commit operations to a specified number of items. | 94 // Limit the batch size of commit operations to a specified number of items. |
| 95 void set_max_commit_batch_size(int x) { max_commit_batch_size_ = x; } | 95 void set_max_commit_batch_size(int x) { max_commit_batch_size_ = x; } |
| 96 | 96 |
| 97 private: | 97 private: |
| 98 void RequestNudge(int milliseconds); | 98 void RequestNudge(int milliseconds); |
| 99 | 99 |
| 100 // Implements the PROCESS_CLIENT_COMMAND syncer step. | 100 // Implements the PROCESS_CLIENT_COMMAND syncer step. |
| 101 void ProcessClientCommand(sessions::SyncSession *session); | 101 void ProcessClientCommand(sessions::SyncSession *session); |
| 102 | 102 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 } | 167 } |
| 168 return false; | 168 return false; |
| 169 } | 169 } |
| 170 // Utility function declarations. | 170 // Utility function declarations. |
| 171 void CopyServerFields(syncable::Entry* src, syncable::MutableEntry* dest); | 171 void CopyServerFields(syncable::Entry* src, syncable::MutableEntry* dest); |
| 172 void ClearServerData(syncable::MutableEntry* entry); | 172 void ClearServerData(syncable::MutableEntry* entry); |
| 173 | 173 |
| 174 } // namespace browser_sync | 174 } // namespace browser_sync |
| 175 | 175 |
| 176 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCER_H_ | 176 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCER_H_ |
| 177 |
| OLD | NEW |