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

Side by Side Diff: chrome/browser/sync/chrome_sync_client.cc

Issue 2471183003: Do not observe MessageLoop destruction from ModelSafeWorker. (Closed)
Patch Set: CR maxbogue #23 Created 4 years, 1 month 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "chrome/browser/sync/chrome_sync_client.h" 5 #include "chrome/browser/sync/chrome_sync_client.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 return ProfileSyncServiceFactory::GetForProfile(profile_) 434 return ProfileSyncServiceFactory::GetForProfile(profile_)
435 ->GetDeviceInfoSyncBridge() 435 ->GetDeviceInfoSyncBridge()
436 ->AsWeakPtr(); 436 ->AsWeakPtr();
437 default: 437 default:
438 NOTREACHED(); 438 NOTREACHED();
439 return base::WeakPtr<syncer::ModelTypeSyncBridge>(); 439 return base::WeakPtr<syncer::ModelTypeSyncBridge>();
440 } 440 }
441 } 441 }
442 442
443 scoped_refptr<syncer::ModelSafeWorker> 443 scoped_refptr<syncer::ModelSafeWorker>
444 ChromeSyncClient::CreateModelWorkerForGroup( 444 ChromeSyncClient::CreateModelWorkerForGroup(syncer::ModelSafeGroup group) {
445 syncer::ModelSafeGroup group,
446 syncer::WorkerLoopDestructionObserver* observer) {
447 DCHECK_CURRENTLY_ON(BrowserThread::UI); 445 DCHECK_CURRENTLY_ON(BrowserThread::UI);
448 switch (group) { 446 switch (group) {
449 case syncer::GROUP_DB: 447 case syncer::GROUP_DB:
450 return new syncer::BrowserThreadModelWorker( 448 return new syncer::BrowserThreadModelWorker(
451 BrowserThread::GetTaskRunnerForThread(BrowserThread::DB), 449 BrowserThread::GetTaskRunnerForThread(BrowserThread::DB),
452 syncer::GROUP_DB, observer); 450 syncer::GROUP_DB);
453 case syncer::GROUP_FILE: 451 case syncer::GROUP_FILE:
454 return new syncer::BrowserThreadModelWorker( 452 return new syncer::BrowserThreadModelWorker(
455 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE), 453 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE),
456 syncer::GROUP_FILE, observer); 454 syncer::GROUP_FILE);
457 case syncer::GROUP_UI: 455 case syncer::GROUP_UI:
458 return new syncer::UIModelWorker( 456 return new syncer::UIModelWorker(
459 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI), observer); 457 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI));
460 case syncer::GROUP_PASSIVE: 458 case syncer::GROUP_PASSIVE:
461 return new syncer::PassiveModelWorker(observer); 459 return new syncer::PassiveModelWorker();
462 case syncer::GROUP_HISTORY: { 460 case syncer::GROUP_HISTORY: {
463 history::HistoryService* history_service = GetHistoryService(); 461 history::HistoryService* history_service = GetHistoryService();
464 if (!history_service) 462 if (!history_service)
465 return nullptr; 463 return nullptr;
466 return new HistoryModelWorker( 464 return new HistoryModelWorker(
467 history_service->AsWeakPtr(), 465 history_service->AsWeakPtr(),
468 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI), observer); 466 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI));
469 } 467 }
470 case syncer::GROUP_PASSWORD: { 468 case syncer::GROUP_PASSWORD: {
471 if (!password_store_.get()) 469 if (!password_store_.get())
472 return nullptr; 470 return nullptr;
473 return new PasswordModelWorker(password_store_, observer); 471 return new PasswordModelWorker(password_store_);
474 } 472 }
475 default: 473 default:
476 return nullptr; 474 return nullptr;
477 } 475 }
478 } 476 }
479 477
480 syncer::SyncApiComponentFactory* 478 syncer::SyncApiComponentFactory*
481 ChromeSyncClient::GetSyncApiComponentFactory() { 479 ChromeSyncClient::GetSyncApiComponentFactory() {
482 return component_factory_.get(); 480 return component_factory_.get();
483 } 481 }
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 sync_service->RegisterDataTypeController( 626 sync_service->RegisterDataTypeController(
629 base::MakeUnique<SupervisedUserSyncDataTypeController>( 627 base::MakeUnique<SupervisedUserSyncDataTypeController>(
630 syncer::SUPERVISED_USER_SETTINGS, error_callback, this, profile_)); 628 syncer::SUPERVISED_USER_SETTINGS, error_callback, this, profile_));
631 sync_service->RegisterDataTypeController( 629 sync_service->RegisterDataTypeController(
632 base::MakeUnique<SupervisedUserSyncDataTypeController>( 630 base::MakeUnique<SupervisedUserSyncDataTypeController>(
633 syncer::SUPERVISED_USER_WHITELISTS, error_callback, this, profile_)); 631 syncer::SUPERVISED_USER_WHITELISTS, error_callback, this, profile_));
634 #endif 632 #endif
635 } 633 }
636 634
637 } // namespace browser_sync 635 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/chrome_sync_client.h ('k') | components/browser_sync/profile_sync_test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698