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

Side by Side Diff: components/sync_driver/glue/sync_backend_registrar.cc

Issue 1907683003: Convert //components/sync_driver from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Build fix, address feedback 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 #include "components/sync_driver/glue/sync_backend_registrar.h" 5 #include "components/sync_driver/glue/sync_backend_registrar.h"
6 6
7 #include <cstddef> 7 #include <cstddef>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
13 #include "components/sync_driver/change_processor.h" 13 #include "components/sync_driver/change_processor.h"
14 #include "components/sync_driver/sync_client.h" 14 #include "components/sync_driver/sync_client.h"
15 #include "sync/internal_api/public/user_share.h" 15 #include "sync/internal_api/public/user_share.h"
16 16
17 namespace browser_sync { 17 namespace browser_sync {
18 18
19 SyncBackendRegistrar::SyncBackendRegistrar( 19 SyncBackendRegistrar::SyncBackendRegistrar(
20 const std::string& name, 20 const std::string& name,
21 sync_driver::SyncClient* sync_client, 21 sync_driver::SyncClient* sync_client,
22 scoped_ptr<base::Thread> sync_thread, 22 std::unique_ptr<base::Thread> sync_thread,
23 const scoped_refptr<base::SingleThreadTaskRunner>& ui_thread, 23 const scoped_refptr<base::SingleThreadTaskRunner>& ui_thread,
24 const scoped_refptr<base::SingleThreadTaskRunner>& db_thread, 24 const scoped_refptr<base::SingleThreadTaskRunner>& db_thread,
25 const scoped_refptr<base::SingleThreadTaskRunner>& file_thread) 25 const scoped_refptr<base::SingleThreadTaskRunner>& file_thread)
26 : name_(name), 26 : name_(name),
27 sync_client_(sync_client), 27 sync_client_(sync_client),
28 ui_thread_(ui_thread), 28 ui_thread_(ui_thread),
29 db_thread_(db_thread), 29 db_thread_(db_thread),
30 file_thread_(file_thread) { 30 file_thread_(file_thread) {
31 DCHECK(ui_thread_->BelongsToCurrentThread()); 31 DCHECK(ui_thread_->BelongsToCurrentThread());
32 DCHECK(sync_client_); 32 DCHECK(sync_client_);
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 } 331 }
332 332
333 if (last_worker) { 333 if (last_worker) {
334 // Self-destruction after last worker. 334 // Self-destruction after last worker.
335 DVLOG(1) << "Destroy registrar on loop of " 335 DVLOG(1) << "Destroy registrar on loop of "
336 << ModelSafeGroupToString(group); 336 << ModelSafeGroupToString(group);
337 delete this; 337 delete this;
338 } 338 }
339 } 339 }
340 340
341 scoped_ptr<base::Thread> SyncBackendRegistrar::ReleaseSyncThread() { 341 std::unique_ptr<base::Thread> SyncBackendRegistrar::ReleaseSyncThread() {
342 return std::move(sync_thread_); 342 return std::move(sync_thread_);
343 } 343 }
344 344
345 void SyncBackendRegistrar::Shutdown() { 345 void SyncBackendRegistrar::Shutdown() {
346 // All data types should have been deactivated by now. 346 // All data types should have been deactivated by now.
347 DCHECK(processors_.empty()); 347 DCHECK(processors_.empty());
348 348
349 // Unregister worker from observing loop destruction. 349 // Unregister worker from observing loop destruction.
350 base::AutoLock al(lock_); 350 base::AutoLock al(lock_);
351 for (WorkerMap::iterator it = workers_.begin(); it != workers_.end(); ++it) { 351 for (WorkerMap::iterator it = workers_.begin(); it != workers_.end(); ++it) {
352 it->second->UnregisterForLoopDestruction( 352 it->second->UnregisterForLoopDestruction(
353 base::Bind(&SyncBackendRegistrar::OnWorkerUnregistrationDone, 353 base::Bind(&SyncBackendRegistrar::OnWorkerUnregistrationDone,
354 base::Unretained(this))); 354 base::Unretained(this)));
355 } 355 }
356 } 356 }
357 357
358 base::Thread* SyncBackendRegistrar::sync_thread() { 358 base::Thread* SyncBackendRegistrar::sync_thread() {
359 return sync_thread_.get(); 359 return sync_thread_.get();
360 } 360 }
361 361
362 syncer::ModelSafeGroup SyncBackendRegistrar::GetInitialGroupForType( 362 syncer::ModelSafeGroup SyncBackendRegistrar::GetInitialGroupForType(
363 syncer::ModelType type) const { 363 syncer::ModelType type) const {
364 if (non_blocking_types_.Has(type)) 364 if (non_blocking_types_.Has(type))
365 return syncer::GROUP_NON_BLOCKING; 365 return syncer::GROUP_NON_BLOCKING;
366 else 366 else
367 return syncer::GROUP_PASSIVE; 367 return syncer::GROUP_PASSIVE;
368 } 368 }
369 369
370 } // namespace browser_sync 370 } // namespace browser_sync
OLDNEW
« no previous file with comments | « components/sync_driver/glue/sync_backend_registrar.h ('k') | components/sync_driver/glue/sync_backend_registrar_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698