Chromium Code Reviews| 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_DRIVE_BACKEND_SYNC_ENGINE_H_ | 5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_ENGINE_H_ |
| 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_ENGINE_H_ | 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_ENGINE_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 55 public: | 55 public: |
| 56 typedef Observer SyncServiceObserver; | 56 typedef Observer SyncServiceObserver; |
| 57 | 57 |
| 58 static scoped_ptr<SyncEngine> CreateForBrowserContext( | 58 static scoped_ptr<SyncEngine> CreateForBrowserContext( |
| 59 content::BrowserContext* context); | 59 content::BrowserContext* context); |
| 60 static void AppendDependsOnFactories( | 60 static void AppendDependsOnFactories( |
| 61 std::set<BrowserContextKeyedServiceFactory*>* factories); | 61 std::set<BrowserContextKeyedServiceFactory*>* factories); |
| 62 | 62 |
| 63 virtual ~SyncEngine(); | 63 virtual ~SyncEngine(); |
| 64 | 64 |
| 65 void Initialize( | 65 void Initialize(const base::FilePath& base_dir, |
| 66 const base::FilePath& base_dir, | 66 leveldb::Env* env_override); |
| 67 base::SequencedTaskRunner* task_runner, | |
| 68 leveldb::Env* env_override); | |
| 69 | 67 |
| 70 // RemoteFileSyncService overrides. | 68 // RemoteFileSyncService overrides. |
| 71 virtual void AddServiceObserver(SyncServiceObserver* observer) OVERRIDE; | 69 virtual void AddServiceObserver(SyncServiceObserver* observer) OVERRIDE; |
| 72 virtual void AddFileStatusObserver(FileStatusObserver* observer) OVERRIDE; | 70 virtual void AddFileStatusObserver(FileStatusObserver* observer) OVERRIDE; |
| 73 virtual void RegisterOrigin( | 71 virtual void RegisterOrigin( |
| 74 const GURL& origin, | 72 const GURL& origin, |
| 75 const SyncStatusCallback& callback) OVERRIDE; | 73 const SyncStatusCallback& callback) OVERRIDE; |
| 76 virtual void EnableOrigin( | 74 virtual void EnableOrigin( |
| 77 const GURL& origin, | 75 const GURL& origin, |
| 78 const SyncStatusCallback& callback) OVERRIDE; | 76 const SyncStatusCallback& callback) OVERRIDE; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 140 void UpdateSyncEnabled(bool enabled); | 138 void UpdateSyncEnabled(bool enabled); |
| 141 | 139 |
| 142 private: | 140 private: |
| 143 friend class DriveBackendSyncTest; | 141 friend class DriveBackendSyncTest; |
| 144 friend class SyncEngineTest; | 142 friend class SyncEngineTest; |
| 145 // TODO(peria): Remove friendship with SyncWorker | 143 // TODO(peria): Remove friendship with SyncWorker |
| 146 friend class SyncWorker; | 144 friend class SyncWorker; |
| 147 | 145 |
| 148 SyncEngine(scoped_ptr<drive::DriveServiceInterface> drive_service, | 146 SyncEngine(scoped_ptr<drive::DriveServiceInterface> drive_service, |
| 149 scoped_ptr<drive::DriveUploaderInterface> drive_uploader, | 147 scoped_ptr<drive::DriveUploaderInterface> drive_uploader, |
| 148 base::SequencedTaskRunner* task_runner, | |
|
tzik
2014/04/17 17:48:32
s/task_runner/file_task_runner/?
peria
2014/04/18 05:19:36
rename it worker_task_runner.
| |
| 150 drive::DriveNotificationManager* notification_manager, | 149 drive::DriveNotificationManager* notification_manager, |
| 151 ExtensionServiceInterface* extension_service, | 150 ExtensionServiceInterface* extension_service, |
| 152 SigninManagerBase* signin_manager); | 151 SigninManagerBase* signin_manager); |
| 153 | 152 |
| 154 void DidProcessRemoteChange(RemoteToLocalSyncer* syncer); | 153 void DidProcessRemoteChange(RemoteToLocalSyncer* syncer); |
| 155 void DidApplyLocalChange(LocalToRemoteSyncer* syncer, | 154 void DidApplyLocalChange(LocalToRemoteSyncer* syncer, |
| 156 SyncStatusCode status); | 155 SyncStatusCode status); |
| 157 void UpdateServiceState(const std::string& description); | 156 void UpdateServiceState(const std::string& description); |
| 158 void UpdateRegisteredApps(); | 157 void UpdateRegisteredApps(); |
| 159 void NotifyLastOperationStatus(); | 158 void NotifyLastOperationStatus(); |
| 160 | 159 |
| 161 scoped_ptr<drive::DriveServiceInterface> drive_service_; | 160 scoped_ptr<drive::DriveServiceInterface> drive_service_; |
| 162 scoped_ptr<drive::DriveUploaderInterface> drive_uploader_; | 161 scoped_ptr<drive::DriveUploaderInterface> drive_uploader_; |
| 163 | 162 |
| 164 // These external services are not owned by SyncEngine. | 163 // These external services are not owned by SyncEngine. |
| 165 // The owner of the SyncEngine is responsible for their lifetime. | 164 // The owner of the SyncEngine is responsible for their lifetime. |
| 166 // I.e. the owner should declare the dependency explicitly by calling | 165 // I.e. the owner should declare the dependency explicitly by calling |
| 167 // KeyedService::DependsOn(). | 166 // KeyedService::DependsOn(). |
| 168 drive::DriveNotificationManager* notification_manager_; | 167 drive::DriveNotificationManager* notification_manager_; |
| 169 ExtensionServiceInterface* extension_service_; | 168 ExtensionServiceInterface* extension_service_; |
| 170 SigninManagerBase* signin_manager_; | 169 SigninManagerBase* signin_manager_; |
| 171 | 170 |
| 172 ObserverList<SyncServiceObserver> service_observers_; | 171 ObserverList<SyncServiceObserver> service_observers_; |
| 173 ObserverList<FileStatusObserver> file_status_observers_; | 172 ObserverList<FileStatusObserver> file_status_observers_; |
| 174 | 173 |
| 175 scoped_ptr<SyncWorker> sync_worker_; | 174 scoped_ptr<SyncWorker> sync_worker_; |
| 175 scoped_refptr<base::SequencedTaskRunner> worker_task_runner_; | |
| 176 | 176 |
| 177 base::WeakPtrFactory<SyncEngine> weak_ptr_factory_; | 177 base::WeakPtrFactory<SyncEngine> weak_ptr_factory_; |
| 178 DISALLOW_COPY_AND_ASSIGN(SyncEngine); | 178 DISALLOW_COPY_AND_ASSIGN(SyncEngine); |
| 179 }; | 179 }; |
| 180 | 180 |
| 181 } // namespace drive_backend | 181 } // namespace drive_backend |
| 182 } // namespace sync_file_system | 182 } // namespace sync_file_system |
| 183 | 183 |
| 184 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_ENGINE_H_ | 184 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_ENGINE_H_ |
| OLD | NEW |