OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_FILE_SYSTEM_LOCAL_LOCAL_FILE_SYNC_CONTEXT_H_ | 5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_LOCAL_FILE_SYNC_CONTEXT_H_ |
6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_LOCAL_FILE_SYNC_CONTEXT_H_ | 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 } | 209 } |
210 | 210 |
211 protected: | 211 protected: |
212 // LocalFileSyncStatus::Observer overrides. They are called on IO thread. | 212 // LocalFileSyncStatus::Observer overrides. They are called on IO thread. |
213 virtual void OnSyncEnabled(const fileapi::FileSystemURL& url) OVERRIDE; | 213 virtual void OnSyncEnabled(const fileapi::FileSystemURL& url) OVERRIDE; |
214 virtual void OnWriteEnabled(const fileapi::FileSystemURL& url) OVERRIDE; | 214 virtual void OnWriteEnabled(const fileapi::FileSystemURL& url) OVERRIDE; |
215 | 215 |
216 private: | 216 private: |
217 typedef base::Callback<void(base::File::Error result)> StatusCallback; | 217 typedef base::Callback<void(base::File::Error result)> StatusCallback; |
218 typedef std::deque<SyncStatusCallback> StatusCallbackQueue; | 218 typedef std::deque<SyncStatusCallback> StatusCallbackQueue; |
| 219 typedef std::deque<fileapi::FileSystemURL> FileSystemURLQueue; |
219 friend class base::RefCountedThreadSafe<LocalFileSyncContext>; | 220 friend class base::RefCountedThreadSafe<LocalFileSyncContext>; |
220 friend class CannedSyncableFileSystem; | 221 friend class CannedSyncableFileSystem; |
221 | 222 |
222 virtual ~LocalFileSyncContext(); | 223 virtual ~LocalFileSyncContext(); |
223 | 224 |
224 void ShutdownOnIOThread(); | 225 void ShutdownOnIOThread(); |
225 | 226 |
226 // Starts a timer to eventually call NotifyAvailableChangesOnIOThread. | 227 // Starts a timer to eventually call NotifyAvailableChangesOnIOThread. |
227 // The caller is expected to update origins_with_pending_changes_ before | 228 // The caller is expected to update origins_with_pending_changes_ before |
228 // calling this. | 229 // calling this. |
(...skipping 21 matching lines...) Expand all Loading... |
250 const GURL& source_url, | 251 const GURL& source_url, |
251 fileapi::FileSystemContext* file_system_context, | 252 fileapi::FileSystemContext* file_system_context, |
252 std::set<GURL>* origins_with_changes, | 253 std::set<GURL>* origins_with_changes, |
253 SyncStatusCode status); | 254 SyncStatusCode status); |
254 void DidInitialize( | 255 void DidInitialize( |
255 const GURL& source_url, | 256 const GURL& source_url, |
256 fileapi::FileSystemContext* file_system_context, | 257 fileapi::FileSystemContext* file_system_context, |
257 SyncStatusCode status); | 258 SyncStatusCode status); |
258 | 259 |
259 // Helper routines for GetFileForLocalSync. | 260 // Helper routines for GetFileForLocalSync. |
260 void GetNextURLsForSyncOnFileThread( | 261 scoped_ptr<FileSystemURLQueue> GetNextURLsForSyncOnFileThread( |
261 fileapi::FileSystemContext* file_system_context, | 262 fileapi::FileSystemContext* file_system_context); |
262 std::deque<fileapi::FileSystemURL>* urls); | |
263 void TryPrepareForLocalSync( | 263 void TryPrepareForLocalSync( |
264 fileapi::FileSystemContext* file_system_context, | 264 fileapi::FileSystemContext* file_system_context, |
265 std::deque<fileapi::FileSystemURL>* urls, | 265 const LocalFileSyncInfoCallback& callback, |
266 const LocalFileSyncInfoCallback& callback); | 266 scoped_ptr<FileSystemURLQueue> urls); |
267 void DidTryPrepareForLocalSync( | 267 void DidTryPrepareForLocalSync( |
268 fileapi::FileSystemContext* file_system_context, | 268 fileapi::FileSystemContext* file_system_context, |
269 std::deque<fileapi::FileSystemURL>* remaining_urls, | 269 scoped_ptr<FileSystemURLQueue> remaining_urls, |
270 const LocalFileSyncInfoCallback& callback, | 270 const LocalFileSyncInfoCallback& callback, |
271 SyncStatusCode status, | 271 SyncStatusCode status, |
272 const LocalFileSyncInfo& sync_file_info, | 272 const LocalFileSyncInfo& sync_file_info, |
273 webkit_blob::ScopedFile snapshot); | 273 webkit_blob::ScopedFile snapshot); |
274 | 274 |
275 // Callback routine for PrepareForSync and GetFileForLocalSync. | 275 // Callback routine for PrepareForSync and GetFileForLocalSync. |
276 void DidGetWritingStatusForSync( | 276 void DidGetWritingStatusForSync( |
277 fileapi::FileSystemContext* file_system_context, | 277 fileapi::FileSystemContext* file_system_context, |
278 SyncStatusCode status, | 278 SyncStatusCode status, |
279 const fileapi::FileSystemURL& url, | 279 const fileapi::FileSystemURL& url, |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 ObserverList<LocalOriginChangeObserver> origin_change_observers_; | 372 ObserverList<LocalOriginChangeObserver> origin_change_observers_; |
373 | 373 |
374 int mock_notify_changes_duration_in_sec_; | 374 int mock_notify_changes_duration_in_sec_; |
375 | 375 |
376 DISALLOW_COPY_AND_ASSIGN(LocalFileSyncContext); | 376 DISALLOW_COPY_AND_ASSIGN(LocalFileSyncContext); |
377 }; | 377 }; |
378 | 378 |
379 } // namespace sync_file_system | 379 } // namespace sync_file_system |
380 | 380 |
381 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_LOCAL_FILE_SYNC_CONTEXT_H_ | 381 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_LOCAL_FILE_SYNC_CONTEXT_H_ |
OLD | NEW |