| OLD | NEW |
| 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 #ifndef COMPONENTS_PASSWORD_MANAGER_SYNC_BROWSER_PASSWORD_MODEL_WORKER_H_ | 5 #ifndef COMPONENTS_PASSWORD_MANAGER_SYNC_BROWSER_PASSWORD_MODEL_WORKER_H_ |
| 6 #define COMPONENTS_PASSWORD_MANAGER_SYNC_BROWSER_PASSWORD_MODEL_WORKER_H_ | 6 #define COMPONENTS_PASSWORD_MANAGER_SYNC_BROWSER_PASSWORD_MODEL_WORKER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "components/sync/engine/model_safe_worker.h" | 10 #include "components/sync/engine/model_safe_worker.h" |
| 11 | 11 |
| 12 namespace password_manager { | 12 namespace password_manager { |
| 13 class PasswordStore; | 13 class PasswordStore; |
| 14 } | 14 } |
| 15 | 15 |
| 16 namespace browser_sync { | 16 namespace browser_sync { |
| 17 | 17 |
| 18 // A syncer::ModelSafeWorker for password models that accepts requests | 18 // A syncer::ModelSafeWorker for password models that accepts requests |
| 19 // from the syncapi that need to be fulfilled on the password thread, | 19 // from the syncapi that need to be fulfilled on the password thread, |
| 20 // which is the DB thread on Linux and Windows. | 20 // which is the DB thread on Linux and Windows. |
| 21 class PasswordModelWorker : public syncer::ModelSafeWorker { | 21 class PasswordModelWorker : public syncer::ModelSafeWorker { |
| 22 public: | 22 public: |
| 23 PasswordModelWorker( | 23 PasswordModelWorker( |
| 24 const scoped_refptr<password_manager::PasswordStore>& password_store); | 24 const scoped_refptr<password_manager::PasswordStore>& password_store); |
| 25 | 25 |
| 26 // syncer::ModelSafeWorker implementation. Called on syncapi SyncerThread. | 26 // syncer::ModelSafeWorker implementation. |
| 27 syncer::ModelSafeGroup GetModelSafeGroup() override; | 27 syncer::ModelSafeGroup GetModelSafeGroup() override; |
| 28 bool IsOnModelThread() override; |
| 28 void RequestStop() override; | 29 void RequestStop() override; |
| 29 | 30 |
| 30 protected: | 31 protected: |
| 31 syncer::SyncerError DoWorkAndWaitUntilDoneImpl( | 32 syncer::SyncerError DoWorkAndWaitUntilDoneImpl( |
| 32 const syncer::WorkCallback& work) override; | 33 const syncer::WorkCallback& work) override; |
| 33 | 34 |
| 34 private: | 35 private: |
| 35 ~PasswordModelWorker() override; | 36 ~PasswordModelWorker() override; |
| 36 | 37 |
| 37 // |password_store_| is used on password thread but released on UI thread. | 38 // |password_store_| is used on password thread but released on UI thread. |
| 38 // Protected by |password_store_lock_|. | 39 // Protected by |password_store_lock_|. |
| 39 base::Lock password_store_lock_; | 40 base::Lock password_store_lock_; |
| 40 scoped_refptr<password_manager::PasswordStore> password_store_; | 41 scoped_refptr<password_manager::PasswordStore> password_store_; |
| 41 DISALLOW_COPY_AND_ASSIGN(PasswordModelWorker); | 42 DISALLOW_COPY_AND_ASSIGN(PasswordModelWorker); |
| 42 }; | 43 }; |
| 43 | 44 |
| 44 } // namespace browser_sync | 45 } // namespace browser_sync |
| 45 | 46 |
| 46 #endif // COMPONENTS_PASSWORD_MANAGER_SYNC_BROWSER_PASSWORD_MODEL_WORKER_H_ | 47 #endif // COMPONENTS_PASSWORD_MANAGER_SYNC_BROWSER_PASSWORD_MODEL_WORKER_H_ |
| OLD | NEW |