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

Side by Side Diff: chrome/browser/sync_file_system/local/local_file_sync_context.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_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 <memory>
10 #include <set> 11 #include <set>
11 #include <string> 12 #include <string>
12 #include <vector> 13 #include <vector>
13 14
14 #include "base/callback.h" 15 #include "base/callback.h"
15 #include "base/files/file.h" 16 #include "base/files/file.h"
16 #include "base/files/file_path.h" 17 #include "base/files/file_path.h"
17 #include "base/logging.h" 18 #include "base/logging.h"
18 #include "base/macros.h" 19 #include "base/macros.h"
19 #include "base/memory/ref_counted.h" 20 #include "base/memory/ref_counted.h"
20 #include "base/memory/scoped_ptr.h"
21 #include "base/memory/weak_ptr.h" 21 #include "base/memory/weak_ptr.h"
22 #include "base/observer_list.h" 22 #include "base/observer_list.h"
23 #include "base/timer/timer.h" 23 #include "base/timer/timer.h"
24 #include "chrome/browser/sync_file_system/local/local_file_sync_status.h" 24 #include "chrome/browser/sync_file_system/local/local_file_sync_status.h"
25 #include "chrome/browser/sync_file_system/sync_callbacks.h" 25 #include "chrome/browser/sync_file_system/sync_callbacks.h"
26 #include "chrome/browser/sync_file_system/sync_status_code.h" 26 #include "chrome/browser/sync_file_system/sync_status_code.h"
27 #include "url/gurl.h" 27 #include "url/gurl.h"
28 28
29 namespace base { 29 namespace base {
30 class SingleThreadTaskRunner; 30 class SingleThreadTaskRunner;
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 const std::vector<base::Closure>& callbacks); 233 const std::vector<base::Closure>& callbacks);
234 234
235 // Helper routines for MaybeInitializeFileSystemContext. 235 // Helper routines for MaybeInitializeFileSystemContext.
236 void InitializeFileSystemContextOnIOThread( 236 void InitializeFileSystemContextOnIOThread(
237 const GURL& source_url, 237 const GURL& source_url,
238 storage::FileSystemContext* file_system_context, 238 storage::FileSystemContext* file_system_context,
239 const GURL& /* root */, 239 const GURL& /* root */,
240 const std::string& /* name */, 240 const std::string& /* name */,
241 base::File::Error error); 241 base::File::Error error);
242 SyncStatusCode InitializeChangeTrackerOnFileThread( 242 SyncStatusCode InitializeChangeTrackerOnFileThread(
243 scoped_ptr<LocalFileChangeTracker>* tracker_ptr, 243 std::unique_ptr<LocalFileChangeTracker>* tracker_ptr,
244 storage::FileSystemContext* file_system_context, 244 storage::FileSystemContext* file_system_context,
245 std::set<GURL>* origins_with_changes); 245 std::set<GURL>* origins_with_changes);
246 void DidInitializeChangeTrackerOnIOThread( 246 void DidInitializeChangeTrackerOnIOThread(
247 scoped_ptr<LocalFileChangeTracker>* tracker_ptr, 247 std::unique_ptr<LocalFileChangeTracker>* tracker_ptr,
248 const GURL& source_url, 248 const GURL& source_url,
249 storage::FileSystemContext* file_system_context, 249 storage::FileSystemContext* file_system_context,
250 std::set<GURL>* origins_with_changes, 250 std::set<GURL>* origins_with_changes,
251 SyncStatusCode status); 251 SyncStatusCode status);
252 void DidInitialize(const GURL& source_url, 252 void DidInitialize(const GURL& source_url,
253 storage::FileSystemContext* file_system_context, 253 storage::FileSystemContext* file_system_context,
254 SyncStatusCode status); 254 SyncStatusCode status);
255 255
256 // Helper routines for GetFileForLocalSync. 256 // Helper routines for GetFileForLocalSync.
257 scoped_ptr<FileSystemURLQueue> GetNextURLsForSyncOnFileThread( 257 std::unique_ptr<FileSystemURLQueue> GetNextURLsForSyncOnFileThread(
258 storage::FileSystemContext* file_system_context); 258 storage::FileSystemContext* file_system_context);
259 void TryPrepareForLocalSync(storage::FileSystemContext* file_system_context, 259 void TryPrepareForLocalSync(storage::FileSystemContext* file_system_context,
260 const LocalFileSyncInfoCallback& callback, 260 const LocalFileSyncInfoCallback& callback,
261 scoped_ptr<FileSystemURLQueue> urls); 261 std::unique_ptr<FileSystemURLQueue> urls);
262 void DidTryPrepareForLocalSync( 262 void DidTryPrepareForLocalSync(
263 storage::FileSystemContext* file_system_context, 263 storage::FileSystemContext* file_system_context,
264 scoped_ptr<FileSystemURLQueue> remaining_urls, 264 std::unique_ptr<FileSystemURLQueue> remaining_urls,
265 const LocalFileSyncInfoCallback& callback, 265 const LocalFileSyncInfoCallback& callback,
266 SyncStatusCode status, 266 SyncStatusCode status,
267 const LocalFileSyncInfo& sync_file_info, 267 const LocalFileSyncInfo& sync_file_info,
268 storage::ScopedFile snapshot); 268 storage::ScopedFile snapshot);
269 void PromoteDemotedChangesForURL( 269 void PromoteDemotedChangesForURL(
270 storage::FileSystemContext* file_system_context, 270 storage::FileSystemContext* file_system_context,
271 const storage::FileSystemURL& url); 271 const storage::FileSystemURL& url);
272 void PromoteDemotedChangesForURLs( 272 void PromoteDemotedChangesForURLs(
273 storage::FileSystemContext* file_system_context, 273 storage::FileSystemContext* file_system_context,
274 scoped_ptr<FileSystemURLQueue> url); 274 std::unique_ptr<FileSystemURLQueue> url);
275 275
276 // Callback routine for PrepareForSync and GetFileForLocalSync. 276 // Callback routine for PrepareForSync and GetFileForLocalSync.
277 void DidGetWritingStatusForSync( 277 void DidGetWritingStatusForSync(
278 storage::FileSystemContext* file_system_context, 278 storage::FileSystemContext* file_system_context,
279 SyncStatusCode status, 279 SyncStatusCode status,
280 const storage::FileSystemURL& url, 280 const storage::FileSystemURL& url,
281 SyncMode sync_mode, 281 SyncMode sync_mode,
282 const LocalFileSyncInfoCallback& callback); 282 const LocalFileSyncInfoCallback& callback);
283 283
284 // Helper routine for sync/writing flag handling. 284 // Helper routine for sync/writing flag handling.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 leveldb::Env* env_override_; 331 leveldb::Env* env_override_;
332 332
333 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; 333 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_;
334 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; 334 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
335 335
336 // Indicates if the sync service is shutdown. 336 // Indicates if the sync service is shutdown.
337 bool shutdown_on_ui_; // Updated and referred only on UI thread. 337 bool shutdown_on_ui_; // Updated and referred only on UI thread.
338 bool shutdown_on_io_; // Updated and referred only on IO thread. 338 bool shutdown_on_io_; // Updated and referred only on IO thread.
339 339
340 // OperationRunner. This must be accessed only on IO thread. 340 // OperationRunner. This must be accessed only on IO thread.
341 scoped_ptr<SyncableFileOperationRunner> operation_runner_; 341 std::unique_ptr<SyncableFileOperationRunner> operation_runner_;
342 342
343 // Keeps track of writing/syncing status. 343 // Keeps track of writing/syncing status.
344 // This must be accessed only on IO thread. 344 // This must be accessed only on IO thread.
345 scoped_ptr<LocalFileSyncStatus> sync_status_; 345 std::unique_ptr<LocalFileSyncStatus> sync_status_;
346 346
347 // Pointers to file system contexts that have been initialized for 347 // Pointers to file system contexts that have been initialized for
348 // synchronization (i.e. that own this instance). 348 // synchronization (i.e. that own this instance).
349 // This must be accessed only on UI thread. 349 // This must be accessed only on UI thread.
350 std::set<storage::FileSystemContext*> file_system_contexts_; 350 std::set<storage::FileSystemContext*> file_system_contexts_;
351 351
352 // Accessed only on UI thread. 352 // Accessed only on UI thread.
353 std::map<storage::FileSystemContext*, StatusCallbackQueue> 353 std::map<storage::FileSystemContext*, StatusCallbackQueue>
354 pending_initialize_callbacks_; 354 pending_initialize_callbacks_;
355 355
356 // A URL and associated callback waiting for sync is enabled. 356 // A URL and associated callback waiting for sync is enabled.
357 // Accessed only on IO thread. 357 // Accessed only on IO thread.
358 storage::FileSystemURL url_waiting_sync_on_io_; 358 storage::FileSystemURL url_waiting_sync_on_io_;
359 base::Closure url_syncable_callback_; 359 base::Closure url_syncable_callback_;
360 360
361 // Used only on IO thread for available changes notifications. 361 // Used only on IO thread for available changes notifications.
362 base::Time last_notified_changes_; 362 base::Time last_notified_changes_;
363 scoped_ptr<base::OneShotTimer> timer_on_io_; 363 std::unique_ptr<base::OneShotTimer> timer_on_io_;
364 std::vector<base::Closure> pending_completion_callbacks_; 364 std::vector<base::Closure> pending_completion_callbacks_;
365 std::set<GURL> origins_with_pending_changes_; 365 std::set<GURL> origins_with_pending_changes_;
366 366
367 // Populated while root directory deletion is being handled for 367 // Populated while root directory deletion is being handled for
368 // ApplyRemoteChange(). Modified only on IO thread. 368 // ApplyRemoteChange(). Modified only on IO thread.
369 scoped_ptr<RootDeleteHelper> root_delete_helper_; 369 std::unique_ptr<RootDeleteHelper> root_delete_helper_;
370 370
371 base::ObserverList<LocalOriginChangeObserver> origin_change_observers_; 371 base::ObserverList<LocalOriginChangeObserver> origin_change_observers_;
372 372
373 int mock_notify_changes_duration_in_sec_; 373 int mock_notify_changes_duration_in_sec_;
374 374
375 DISALLOW_COPY_AND_ASSIGN(LocalFileSyncContext); 375 DISALLOW_COPY_AND_ASSIGN(LocalFileSyncContext);
376 }; 376 };
377 377
378 } // namespace sync_file_system 378 } // namespace sync_file_system
379 379
380 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_LOCAL_FILE_SYNC_CONTEXT_H_ 380 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_LOCAL_FILE_SYNC_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698