Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(500)

Side by Side Diff: chrome/browser/sync_file_system/drive_backend/sync_engine.h

Issue 1873683002: Convert //chrome/browser/sync_file_system from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <memory>
8 #include <set> 9 #include <set>
9 #include <string> 10 #include <string>
10 11
11 #include "base/macros.h" 12 #include "base/macros.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "base/observer_list.h" 14 #include "base/observer_list.h"
15 #include "chrome/browser/sync_file_system/drive_backend/callback_tracker.h" 15 #include "chrome/browser/sync_file_system/drive_backend/callback_tracker.h"
16 #include "chrome/browser/sync_file_system/local_change_processor.h" 16 #include "chrome/browser/sync_file_system/local_change_processor.h"
17 #include "chrome/browser/sync_file_system/remote_file_sync_service.h" 17 #include "chrome/browser/sync_file_system/remote_file_sync_service.h"
18 #include "chrome/browser/sync_file_system/sync_action.h" 18 #include "chrome/browser/sync_file_system/sync_action.h"
19 #include "chrome/browser/sync_file_system/sync_direction.h" 19 #include "chrome/browser/sync_file_system/sync_direction.h"
20 #include "components/drive/drive_notification_observer.h" 20 #include "components/drive/drive_notification_observer.h"
21 #include "components/drive/service/drive_service_interface.h" 21 #include "components/drive/service/drive_service_interface.h"
22 #include "components/signin/core/browser/signin_manager_base.h" 22 #include "components/signin/core/browser/signin_manager_base.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 public drive::DriveServiceObserver, 64 public drive::DriveServiceObserver,
65 public net::NetworkChangeNotifier::NetworkChangeObserver, 65 public net::NetworkChangeNotifier::NetworkChangeObserver,
66 public SigninManagerBase::Observer { 66 public SigninManagerBase::Observer {
67 public: 67 public:
68 typedef RemoteFileSyncService::Observer SyncServiceObserver; 68 typedef RemoteFileSyncService::Observer SyncServiceObserver;
69 69
70 class DriveServiceFactory { 70 class DriveServiceFactory {
71 public: 71 public:
72 DriveServiceFactory() {} 72 DriveServiceFactory() {}
73 virtual ~DriveServiceFactory() {} 73 virtual ~DriveServiceFactory() {}
74 virtual scoped_ptr<drive::DriveServiceInterface> CreateDriveService( 74 virtual std::unique_ptr<drive::DriveServiceInterface> CreateDriveService(
75 OAuth2TokenService* oauth2_token_service, 75 OAuth2TokenService* oauth2_token_service,
76 net::URLRequestContextGetter* url_request_context_getter, 76 net::URLRequestContextGetter* url_request_context_getter,
77 base::SequencedTaskRunner* blocking_task_runner); 77 base::SequencedTaskRunner* blocking_task_runner);
78 78
79 private: 79 private:
80 DISALLOW_COPY_AND_ASSIGN(DriveServiceFactory); 80 DISALLOW_COPY_AND_ASSIGN(DriveServiceFactory);
81 }; 81 };
82 82
83 static scoped_ptr<SyncEngine> CreateForBrowserContext( 83 static std::unique_ptr<SyncEngine> CreateForBrowserContext(
84 content::BrowserContext* context, 84 content::BrowserContext* context,
85 TaskLogger* task_logger); 85 TaskLogger* task_logger);
86 static void AppendDependsOnFactories( 86 static void AppendDependsOnFactories(
87 std::set<BrowserContextKeyedServiceFactory*>* factories); 87 std::set<BrowserContextKeyedServiceFactory*>* factories);
88 88
89 ~SyncEngine() override; 89 ~SyncEngine() override;
90 void Reset(); 90 void Reset();
91 91
92 // Can be called more than once. 92 // Can be called more than once.
93 void Initialize(); 93 void Initialize();
94 94
95 void InitializeForTesting( 95 void InitializeForTesting(
96 scoped_ptr<drive::DriveServiceInterface> drive_service, 96 std::unique_ptr<drive::DriveServiceInterface> drive_service,
97 scoped_ptr<drive::DriveUploaderInterface> drive_uploader, 97 std::unique_ptr<drive::DriveUploaderInterface> drive_uploader,
98 scoped_ptr<SyncWorkerInterface> sync_worker); 98 std::unique_ptr<SyncWorkerInterface> sync_worker);
99 void InitializeInternal( 99 void InitializeInternal(
100 scoped_ptr<drive::DriveServiceInterface> drive_service, 100 std::unique_ptr<drive::DriveServiceInterface> drive_service,
101 scoped_ptr<drive::DriveUploaderInterface> drive_uploader, 101 std::unique_ptr<drive::DriveUploaderInterface> drive_uploader,
102 scoped_ptr<SyncWorkerInterface> sync_worker); 102 std::unique_ptr<SyncWorkerInterface> sync_worker);
103 103
104 // RemoteFileSyncService overrides. 104 // RemoteFileSyncService overrides.
105 void AddServiceObserver(SyncServiceObserver* observer) override; 105 void AddServiceObserver(SyncServiceObserver* observer) override;
106 void AddFileStatusObserver(FileStatusObserver* observer) override; 106 void AddFileStatusObserver(FileStatusObserver* observer) override;
107 void RegisterOrigin(const GURL& origin, 107 void RegisterOrigin(const GURL& origin,
108 const SyncStatusCallback& callback) override; 108 const SyncStatusCallback& callback) override;
109 void EnableOrigin(const GURL& origin, 109 void EnableOrigin(const GURL& origin,
110 const SyncStatusCallback& callback) override; 110 const SyncStatusCallback& callback) override;
111 void DisableOrigin(const GURL& origin, 111 void DisableOrigin(const GURL& origin,
112 const SyncStatusCallback& callback) override; 112 const SyncStatusCallback& callback) override;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 const scoped_refptr<base::SequencedTaskRunner>& worker_task_runner, 161 const scoped_refptr<base::SequencedTaskRunner>& worker_task_runner,
162 const scoped_refptr<base::SequencedTaskRunner>& drive_task_runner, 162 const scoped_refptr<base::SequencedTaskRunner>& drive_task_runner,
163 const scoped_refptr<base::SequencedWorkerPool>& worker_pool, 163 const scoped_refptr<base::SequencedWorkerPool>& worker_pool,
164 const base::FilePath& sync_file_system_dir, 164 const base::FilePath& sync_file_system_dir,
165 TaskLogger* task_logger, 165 TaskLogger* task_logger,
166 drive::DriveNotificationManager* notification_manager, 166 drive::DriveNotificationManager* notification_manager,
167 ExtensionServiceInterface* extension_service, 167 ExtensionServiceInterface* extension_service,
168 SigninManagerBase* signin_manager, 168 SigninManagerBase* signin_manager,
169 OAuth2TokenService* token_service, 169 OAuth2TokenService* token_service,
170 net::URLRequestContextGetter* request_context, 170 net::URLRequestContextGetter* request_context,
171 scoped_ptr<DriveServiceFactory> drive_service_factory, 171 std::unique_ptr<DriveServiceFactory> drive_service_factory,
172 leveldb::Env* env_override); 172 leveldb::Env* env_override);
173 173
174 // Called by WorkerObserver. 174 // Called by WorkerObserver.
175 void OnPendingFileListUpdated(int item_count); 175 void OnPendingFileListUpdated(int item_count);
176 void OnFileStatusChanged(const storage::FileSystemURL& url, 176 void OnFileStatusChanged(const storage::FileSystemURL& url,
177 SyncFileType file_type, 177 SyncFileType file_type,
178 SyncFileStatus file_status, 178 SyncFileStatus file_status,
179 SyncAction sync_action, 179 SyncAction sync_action,
180 SyncDirection direction); 180 SyncDirection direction);
181 void UpdateServiceState(RemoteServiceState state, 181 void UpdateServiceState(RemoteServiceState state,
(...skipping 13 matching lines...) Expand all
195 // The owner of the SyncEngine is responsible for their lifetime. 195 // The owner of the SyncEngine is responsible for their lifetime.
196 // I.e. the owner should declare the dependency explicitly by calling 196 // I.e. the owner should declare the dependency explicitly by calling
197 // KeyedService::DependsOn(). 197 // KeyedService::DependsOn().
198 drive::DriveNotificationManager* notification_manager_; 198 drive::DriveNotificationManager* notification_manager_;
199 ExtensionServiceInterface* extension_service_; 199 ExtensionServiceInterface* extension_service_;
200 SigninManagerBase* signin_manager_; 200 SigninManagerBase* signin_manager_;
201 OAuth2TokenService* token_service_; 201 OAuth2TokenService* token_service_;
202 202
203 scoped_refptr<net::URLRequestContextGetter> request_context_; 203 scoped_refptr<net::URLRequestContextGetter> request_context_;
204 204
205 scoped_ptr<DriveServiceFactory> drive_service_factory_; 205 std::unique_ptr<DriveServiceFactory> drive_service_factory_;
206 206
207 scoped_ptr<drive::DriveServiceInterface> drive_service_; 207 std::unique_ptr<drive::DriveServiceInterface> drive_service_;
208 scoped_ptr<DriveServiceWrapper> drive_service_wrapper_; 208 std::unique_ptr<DriveServiceWrapper> drive_service_wrapper_;
209 scoped_ptr<drive::DriveUploaderInterface> drive_uploader_; 209 std::unique_ptr<drive::DriveUploaderInterface> drive_uploader_;
210 scoped_ptr<DriveUploaderWrapper> drive_uploader_wrapper_; 210 std::unique_ptr<DriveUploaderWrapper> drive_uploader_wrapper_;
211 211
212 RemoteChangeProcessor* remote_change_processor_; // Not owned. 212 RemoteChangeProcessor* remote_change_processor_; // Not owned.
213 scoped_ptr<RemoteChangeProcessorWrapper> remote_change_processor_wrapper_; 213 std::unique_ptr<RemoteChangeProcessorWrapper>
214 remote_change_processor_wrapper_;
214 // Delete this on worker. 215 // Delete this on worker.
215 scoped_ptr<RemoteChangeProcessorOnWorker> remote_change_processor_on_worker_; 216 std::unique_ptr<RemoteChangeProcessorOnWorker>
217 remote_change_processor_on_worker_;
216 218
217 RemoteServiceState service_state_; 219 RemoteServiceState service_state_;
218 bool has_refresh_token_; 220 bool has_refresh_token_;
219 bool network_available_; 221 bool network_available_;
220 bool sync_enabled_; 222 bool sync_enabled_;
221 223
222 // Delete them on worker. 224 // Delete them on worker.
223 scoped_ptr<WorkerObserver> worker_observer_; 225 std::unique_ptr<WorkerObserver> worker_observer_;
224 scoped_ptr<SyncWorkerInterface> sync_worker_; 226 std::unique_ptr<SyncWorkerInterface> sync_worker_;
225 227
226 base::ObserverList<SyncServiceObserver> service_observers_; 228 base::ObserverList<SyncServiceObserver> service_observers_;
227 base::ObserverList<FileStatusObserver> file_status_observers_; 229 base::ObserverList<FileStatusObserver> file_status_observers_;
228 leveldb::Env* env_override_; 230 leveldb::Env* env_override_;
229 231
230 CallbackTracker callback_tracker_; 232 CallbackTracker callback_tracker_;
231 233
232 base::WeakPtrFactory<SyncEngine> weak_ptr_factory_; 234 base::WeakPtrFactory<SyncEngine> weak_ptr_factory_;
233 DISALLOW_COPY_AND_ASSIGN(SyncEngine); 235 DISALLOW_COPY_AND_ASSIGN(SyncEngine);
234 }; 236 };
235 237
236 } // namespace drive_backend 238 } // namespace drive_backend
237 } // namespace sync_file_system 239 } // namespace sync_file_system
238 240
239 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_ENGINE_H_ 241 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_ENGINE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698