| 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 CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_FILE_SYNC_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_FILE_SYNC_SERVICE_H_ |
| 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_FILE_SYNC_SERVICE_H_ | 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_FILE_SYNC_SERVICE_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 PendingChangeQueue::iterator position_in_queue); | 135 PendingChangeQueue::iterator position_in_queue); |
| 136 ~RemoteChange(); | 136 ~RemoteChange(); |
| 137 }; | 137 }; |
| 138 | 138 |
| 139 struct RemoteChangeComparator { | 139 struct RemoteChangeComparator { |
| 140 bool operator()(const RemoteChange& left, const RemoteChange& right); | 140 bool operator()(const RemoteChange& left, const RemoteChange& right); |
| 141 }; | 141 }; |
| 142 | 142 |
| 143 // TODO(tzik): Consider using std::pair<FilePath, FileType> as the key below | 143 // TODO(tzik): Consider using std::pair<FilePath, FileType> as the key below |
| 144 // to support directories and custom conflict handling. | 144 // to support directories and custom conflict handling. |
| 145 typedef std::map<FilePath, RemoteChange> PathToChange; | 145 typedef std::map<FilePath, RemoteChange> PathToChangeMap; |
| 146 typedef std::map<GURL, PathToChange> URLToChange; | 146 typedef std::map<GURL, PathToChangeMap> OriginToChangesMap; |
| 147 | 147 |
| 148 // Task types; used for task token handling. | 148 // Task types; used for task token handling. |
| 149 enum TaskType { | 149 enum TaskType { |
| 150 // No task is holding this token. | 150 // No task is holding this token. |
| 151 TASK_TYPE_NONE, | 151 TASK_TYPE_NONE, |
| 152 | 152 |
| 153 // Token is granted for drive-related async task. | 153 // Token is granted for drive-related async task. |
| 154 TASK_TYPE_DRIVE, | 154 TASK_TYPE_DRIVE, |
| 155 | 155 |
| 156 // Token is granted for async database task. | 156 // Token is granted for async database task. |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 scoped_ptr<DriveMetadataStore> metadata_store_; | 339 scoped_ptr<DriveMetadataStore> metadata_store_; |
| 340 scoped_ptr<DriveFileSyncClient> sync_client_; | 340 scoped_ptr<DriveFileSyncClient> sync_client_; |
| 341 | 341 |
| 342 fileapi::SyncStatusCode last_operation_status_; | 342 fileapi::SyncStatusCode last_operation_status_; |
| 343 RemoteServiceState state_; | 343 RemoteServiceState state_; |
| 344 std::deque<base::Closure> pending_tasks_; | 344 std::deque<base::Closure> pending_tasks_; |
| 345 | 345 |
| 346 int64 largest_fetched_changestamp_; | 346 int64 largest_fetched_changestamp_; |
| 347 | 347 |
| 348 PendingChangeQueue pending_changes_; | 348 PendingChangeQueue pending_changes_; |
| 349 URLToChange url_to_change_; | 349 OriginToChangesMap origin_to_changes_map_; |
| 350 | 350 |
| 351 std::set<GURL> pending_batch_sync_origins_; | 351 std::set<GURL> pending_batch_sync_origins_; |
| 352 | 352 |
| 353 // Absence of |token_| implies a task is running. Incoming tasks should | 353 // Absence of |token_| implies a task is running. Incoming tasks should |
| 354 // wait for the task to finish in |pending_tasks_| if |token_| is null. | 354 // wait for the task to finish in |pending_tasks_| if |token_| is null. |
| 355 // Each task must take TaskToken instance from |token_| and must hold it | 355 // Each task must take TaskToken instance from |token_| and must hold it |
| 356 // until it finished. And the task must return the instance through | 356 // until it finished. And the task must return the instance through |
| 357 // NotifyTaskDone when the task finished. | 357 // NotifyTaskDone when the task finished. |
| 358 scoped_ptr<TaskToken> token_; | 358 scoped_ptr<TaskToken> token_; |
| 359 | 359 |
| 360 base::OneShotTimer<DriveFileSyncService> polling_timer_; | 360 base::OneShotTimer<DriveFileSyncService> polling_timer_; |
| 361 int64 polling_delay_seconds_; | 361 int64 polling_delay_seconds_; |
| 362 bool polling_enabled_; | 362 bool polling_enabled_; |
| 363 | 363 |
| 364 ObserverList<Observer> observers_; | 364 ObserverList<Observer> observers_; |
| 365 | 365 |
| 366 // Use WeakPtrFactory instead of SupportsWeakPtr to revoke the weak pointer | 366 // Use WeakPtrFactory instead of SupportsWeakPtr to revoke the weak pointer |
| 367 // in |token_|. | 367 // in |token_|. |
| 368 base::WeakPtrFactory<DriveFileSyncService> weak_factory_; | 368 base::WeakPtrFactory<DriveFileSyncService> weak_factory_; |
| 369 | 369 |
| 370 DISALLOW_COPY_AND_ASSIGN(DriveFileSyncService); | 370 DISALLOW_COPY_AND_ASSIGN(DriveFileSyncService); |
| 371 }; | 371 }; |
| 372 | 372 |
| 373 } // namespace sync_file_system | 373 } // namespace sync_file_system |
| 374 | 374 |
| 375 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_FILE_SYNC_SERVICE_H_ | 375 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_FILE_SYNC_SERVICE_H_ |
| OLD | NEW |