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

Side by Side Diff: components/password_manager/sync/browser/password_model_worker.cc

Issue 2942773002: Task Scheduler API migration: change BrowserThreadModelWorker to SequencedModelWorker (Closed)
Patch Set: Updated more comments to reflect thread -> sequence migration. Created 3 years, 6 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 (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "components/password_manager/sync/browser/password_model_worker.h" 5 #include "components/password_manager/sync/browser/password_model_worker.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "components/password_manager/core/browser/password_store.h" 9 #include "components/password_manager/core/browser/password_store.h"
10 10
11 namespace browser_sync { 11 namespace browser_sync {
12 12
13 PasswordModelWorker::PasswordModelWorker( 13 PasswordModelWorker::PasswordModelWorker(
14 const scoped_refptr<password_manager::PasswordStore>& password_store) 14 const scoped_refptr<password_manager::PasswordStore>& password_store)
15 : password_store_(password_store) { 15 : password_store_(password_store) {
16 DCHECK(password_store.get()); 16 DCHECK(password_store.get());
17 } 17 }
18 18
19 syncer::ModelSafeGroup PasswordModelWorker::GetModelSafeGroup() { 19 syncer::ModelSafeGroup PasswordModelWorker::GetModelSafeGroup() {
20 return syncer::GROUP_PASSWORD; 20 return syncer::GROUP_PASSWORD;
21 } 21 }
22 22
23 bool PasswordModelWorker::IsOnModelThread() { 23 bool PasswordModelWorker::IsOnModelSequence() {
24 // Ideally PasswordStore would expose a way to check whether this is the 24 // Ideally PasswordStore would expose a way to check whether this is the
25 // thread it does work on. Since it doesn't, just return true to bypass a 25 // thread it does work on. Since it doesn't, just return true to bypass a
26 // CHECK in the sync code. 26 // CHECK in the sync code.
27 return true; 27 return true;
28 } 28 }
29 29
30 PasswordModelWorker::~PasswordModelWorker() {} 30 PasswordModelWorker::~PasswordModelWorker() {}
31 31
32 void PasswordModelWorker::ScheduleWork(base::OnceClosure work) { 32 void PasswordModelWorker::ScheduleWork(base::OnceClosure work) {
33 base::AutoLock lock(password_store_lock_); 33 base::AutoLock lock(password_store_lock_);
34 if (password_store_) { 34 if (password_store_) {
35 password_store_->ScheduleTask( 35 password_store_->ScheduleTask(
36 base::Bind([](base::OnceClosure work) { std::move(work).Run(); }, 36 base::Bind([](base::OnceClosure work) { std::move(work).Run(); },
37 base::Passed(std::move(work)))); 37 base::Passed(std::move(work))));
38 } 38 }
39 } 39 }
40 40
41 void PasswordModelWorker::RequestStop() { 41 void PasswordModelWorker::RequestStop() {
42 ModelSafeWorker::RequestStop(); 42 ModelSafeWorker::RequestStop();
43 43
44 base::AutoLock lock(password_store_lock_); 44 base::AutoLock lock(password_store_lock_);
45 password_store_ = NULL; 45 password_store_ = NULL;
46 } 46 }
47 47
48 } // namespace browser_sync 48 } // namespace browser_sync
OLDNEW
« no previous file with comments | « components/password_manager/sync/browser/password_model_worker.h ('k') | components/sync/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698