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

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

Issue 2466313003: Remove ModelSafeWorker::work_done_or_stopped(). (Closed)
Patch Set: CR zea #11 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 (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/callback_forward.h" 8 #include "base/callback_forward.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "components/sync/engine/model_safe_worker.h" 12 #include "components/sync/engine/model_safe_worker.h"
13 13
14 namespace base {
15 class WaitableEvent;
16 }
17
18 namespace password_manager { 14 namespace password_manager {
19 class PasswordStore; 15 class PasswordStore;
20 } 16 }
21 17
22 namespace browser_sync { 18 namespace browser_sync {
23 19
24 // A syncer::ModelSafeWorker for password models that accepts requests 20 // A syncer::ModelSafeWorker for password models that accepts requests
25 // from the syncapi that need to be fulfilled on the password thread, 21 // from the syncapi that need to be fulfilled on the password thread,
26 // which is the DB thread on Linux and Windows. 22 // which is the DB thread on Linux and Windows.
27 class PasswordModelWorker : public syncer::ModelSafeWorker { 23 class PasswordModelWorker : public syncer::ModelSafeWorker {
28 public: 24 public:
29 PasswordModelWorker( 25 PasswordModelWorker(
30 const scoped_refptr<password_manager::PasswordStore>& password_store, 26 const scoped_refptr<password_manager::PasswordStore>& password_store,
31 syncer::WorkerLoopDestructionObserver* observer); 27 syncer::WorkerLoopDestructionObserver* observer);
32 28
33 // syncer::ModelSafeWorker implementation. Called on syncapi SyncerThread. 29 // syncer::ModelSafeWorker implementation. Called on syncapi SyncerThread.
34 void RegisterForLoopDestruction() override; 30 void RegisterForLoopDestruction() override;
35 syncer::ModelSafeGroup GetModelSafeGroup() override; 31 syncer::ModelSafeGroup GetModelSafeGroup() override;
36 void RequestStop() override; 32 void RequestStop() override;
37 33
38 protected: 34 protected:
39 syncer::SyncerError DoWorkAndWaitUntilDoneImpl( 35 syncer::SyncerError DoWorkAndWaitUntilDoneImpl(
40 const syncer::WorkCallback& work) override; 36 const syncer::WorkCallback& work) override;
41 37
42 private: 38 private:
43 ~PasswordModelWorker() override; 39 ~PasswordModelWorker() override;
44 40
45 void CallDoWorkAndSignalTask(const syncer::WorkCallback& work,
46 base::WaitableEvent* done,
47 syncer::SyncerError* error);
48
49 // Called on password thread to add PasswordModelWorker as destruction 41 // Called on password thread to add PasswordModelWorker as destruction
50 // observer. 42 // observer.
51 void RegisterForPasswordLoopDestruction(); 43 void RegisterForPasswordLoopDestruction();
52 44
53 // |password_store_| is used on password thread but released on UI thread. 45 // |password_store_| is used on password thread but released on UI thread.
54 // Protected by |password_store_lock_|. 46 // Protected by |password_store_lock_|.
55 base::Lock password_store_lock_; 47 base::Lock password_store_lock_;
56 scoped_refptr<password_manager::PasswordStore> password_store_; 48 scoped_refptr<password_manager::PasswordStore> password_store_;
57 DISALLOW_COPY_AND_ASSIGN(PasswordModelWorker); 49 DISALLOW_COPY_AND_ASSIGN(PasswordModelWorker);
58 }; 50 };
59 51
60 } // namespace browser_sync 52 } // namespace browser_sync
61 53
62 #endif // COMPONENTS_PASSWORD_MANAGER_SYNC_BROWSER_PASSWORD_MODEL_WORKER_H_ 54 #endif // COMPONENTS_PASSWORD_MANAGER_SYNC_BROWSER_PASSWORD_MODEL_WORKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698