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 WEBKIT_FILEAPI_SYNCABLE_LOCAL_FILE_SYNC_CONTEXT_H_ | 5 #ifndef WEBKIT_FILEAPI_SYNCABLE_LOCAL_FILE_SYNC_CONTEXT_H_ |
6 #define WEBKIT_FILEAPI_SYNCABLE_LOCAL_FILE_SYNC_CONTEXT_H_ | 6 #define WEBKIT_FILEAPI_SYNCABLE_LOCAL_FILE_SYNC_CONTEXT_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 // Called when the corresponding LocalFileSyncService exits. | 69 // Called when the corresponding LocalFileSyncService exits. |
70 // This method must be called on UI thread. | 70 // This method must be called on UI thread. |
71 void ShutdownOnUIThread(); | 71 void ShutdownOnUIThread(); |
72 | 72 |
73 // Picks a file for next local sync and returns it after disabling writes | 73 // Picks a file for next local sync and returns it after disabling writes |
74 // for the file. | 74 // for the file. |
75 // This method must be called on UI thread. | 75 // This method must be called on UI thread. |
76 void GetFileForLocalSync(FileSystemContext* file_system_context, | 76 void GetFileForLocalSync(FileSystemContext* file_system_context, |
77 const LocalFileSyncInfoCallback& callback); | 77 const LocalFileSyncInfoCallback& callback); |
78 | 78 |
79 // Notifies the sync context that the local sync has finished (either | 79 // Clears all pending local changes for |url|. |done_callback| is called |
80 // successfully or with an error) for |url|. | 80 // when the changes are cleared. |
81 // This method must be called on UI thread. | 81 // This method must be called on UI thread. |
82 void FinalizeSyncForURL(FileSystemContext* file_system_context, | 82 void ClearChangesForURL(FileSystemContext* file_system_context, |
83 const FileSystemURL& url); | 83 const FileSystemURL& url, |
| 84 const base::Closure& done_callback); |
| 85 |
| 86 // A local or remote sync has been finished (either successfully or |
| 87 // with an error). Clears the internal sync flag and enable writing for |url|. |
| 88 // This method must be called on UI thread. |
| 89 void ClearSyncFlagForURL(const FileSystemURL& url); |
84 | 90 |
85 // Prepares for sync |url| by disabling writes on |url|. | 91 // Prepares for sync |url| by disabling writes on |url|. |
86 // If the target |url| is being written and cannot start sync it | 92 // If the target |url| is being written and cannot start sync it |
87 // returns SYNC_STATUS_WRITING status code via |callback|. | 93 // returns SYNC_STATUS_WRITING status code via |callback|. |
88 // Otherwise it disables writes, marks the |url| syncing and returns | 94 // Otherwise it disables writes, marks the |url| syncing and returns |
89 // the current change set made on |url|. | 95 // the current change set made on |url|. |
90 // This method must be called on UI thread. | 96 // This method must be called on UI thread. |
91 void PrepareForSync(FileSystemContext* file_system_context, | 97 void PrepareForSync(FileSystemContext* file_system_context, |
92 const FileSystemURL& url, | 98 const FileSystemURL& url, |
93 const LocalFileSyncInfoCallback& callback); | 99 const LocalFileSyncInfoCallback& callback); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 SyncStatusCode status, | 207 SyncStatusCode status, |
202 const LocalFileSyncInfo& sync_file_info); | 208 const LocalFileSyncInfo& sync_file_info); |
203 | 209 |
204 // Callback routine for PrepareForSync and GetFileForLocalSync. | 210 // Callback routine for PrepareForSync and GetFileForLocalSync. |
205 void DidGetWritingStatusForSync( | 211 void DidGetWritingStatusForSync( |
206 FileSystemContext* file_system_context, | 212 FileSystemContext* file_system_context, |
207 SyncStatusCode status, | 213 SyncStatusCode status, |
208 const FileSystemURL& url, | 214 const FileSystemURL& url, |
209 const LocalFileSyncInfoCallback& callback); | 215 const LocalFileSyncInfoCallback& callback); |
210 | 216 |
211 // Helper routine for FinalizeSyncForURL. | 217 // Helper routine for ClearSyncFlagForURL. |
212 void EnableWritingOnIOThread(const FileSystemURL& url); | 218 void EnableWritingOnIOThread(const FileSystemURL& url); |
213 | 219 |
214 // Callback routine for ApplyRemoteChange. | 220 // Callback routine for ApplyRemoteChange. |
215 void DidApplyRemoteChange( | 221 void DidApplyRemoteChange( |
216 const FileSystemURL& url, | 222 const FileSystemURL& url, |
217 const SyncStatusCallback& callback_on_ui, | 223 const SyncStatusCallback& callback_on_ui, |
218 base::PlatformFileError file_error); | 224 base::PlatformFileError file_error); |
219 | 225 |
220 void DidGetFileMetadata( | 226 void DidGetFileMetadata( |
221 const SyncFileMetadataCallback& callback, | 227 const SyncFileMetadataCallback& callback, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 ObserverList<LocalOriginChangeObserver> origin_change_observers_; | 266 ObserverList<LocalOriginChangeObserver> origin_change_observers_; |
261 | 267 |
262 int mock_notify_changes_duration_in_sec_; | 268 int mock_notify_changes_duration_in_sec_; |
263 | 269 |
264 DISALLOW_COPY_AND_ASSIGN(LocalFileSyncContext); | 270 DISALLOW_COPY_AND_ASSIGN(LocalFileSyncContext); |
265 }; | 271 }; |
266 | 272 |
267 } // namespace fileapi | 273 } // namespace fileapi |
268 | 274 |
269 #endif // WEBKIT_FILEAPI_SYNCABLE_LOCAL_FILE_SYNC_CONTEXT_H_ | 275 #endif // WEBKIT_FILEAPI_SYNCABLE_LOCAL_FILE_SYNC_CONTEXT_H_ |
OLD | NEW |