OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_SYNC_GLUE_UI_MODEL_WORKER_H_ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_UI_MODEL_WORKER_H_ |
6 #define CHROME_BROWSER_SYNC_GLUE_UI_MODEL_WORKER_H_ | 6 #define CHROME_BROWSER_SYNC_GLUE_UI_MODEL_WORKER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 UIModelWorker(); | 30 UIModelWorker(); |
31 virtual ~UIModelWorker(); | 31 virtual ~UIModelWorker(); |
32 | 32 |
33 // Called by the UI thread on shutdown of the sync service. Blocks until | 33 // Called by the UI thread on shutdown of the sync service. Blocks until |
34 // the UIModelWorker has safely met termination conditions, namely that | 34 // the UIModelWorker has safely met termination conditions, namely that |
35 // no task scheduled by CallDoWorkFromModelSafeThreadAndWait remains un- | 35 // no task scheduled by CallDoWorkFromModelSafeThreadAndWait remains un- |
36 // processed and that syncapi will not schedule any further work for us to do. | 36 // processed and that syncapi will not schedule any further work for us to do. |
37 void Stop(); | 37 void Stop(); |
38 | 38 |
39 // ModelSafeWorker implementation. Called on syncapi SyncerThread. | 39 // ModelSafeWorker implementation. Called on syncapi SyncerThread. |
40 virtual UnrecoverableErrorInfo DoWorkAndWaitUntilDone( | 40 virtual SyncerError DoWorkAndWaitUntilDone( |
41 const WorkCallback& work) OVERRIDE; | 41 const WorkCallback& work) OVERRIDE; |
42 virtual ModelSafeGroup GetModelSafeGroup() OVERRIDE; | 42 virtual ModelSafeGroup GetModelSafeGroup() OVERRIDE; |
43 | 43 |
44 // Upon receiving this idempotent call, the ModelSafeWorker can | 44 // Upon receiving this idempotent call, the ModelSafeWorker can |
45 // assume no work will ever be scheduled again from now on. If it has any work | 45 // assume no work will ever be scheduled again from now on. If it has any work |
46 // that it has not yet completed, it must make sure to run it as soon as | 46 // that it has not yet completed, it must make sure to run it as soon as |
47 // possible as the Syncer is trying to shut down. Called from the CoreThread. | 47 // possible as the Syncer is trying to shut down. Called from the CoreThread. |
48 void OnSyncerShutdownComplete(); | 48 void OnSyncerShutdownComplete(); |
49 | 49 |
50 // Callback from |pending_work_| to notify us that it has been run. | 50 // Callback from |pending_work_| to notify us that it has been run. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 // SyncerThread has terminated. We only care about (1) when we are in Stop(), | 95 // SyncerThread has terminated. We only care about (1) when we are in Stop(), |
96 // because we have to manually Run() the task. | 96 // because we have to manually Run() the task. |
97 base::ConditionVariable syncapi_event_; | 97 base::ConditionVariable syncapi_event_; |
98 | 98 |
99 DISALLOW_COPY_AND_ASSIGN(UIModelWorker); | 99 DISALLOW_COPY_AND_ASSIGN(UIModelWorker); |
100 }; | 100 }; |
101 | 101 |
102 } // namespace browser_sync | 102 } // namespace browser_sync |
103 | 103 |
104 #endif // CHROME_BROWSER_SYNC_GLUE_UI_MODEL_WORKER_H_ | 104 #endif // CHROME_BROWSER_SYNC_GLUE_UI_MODEL_WORKER_H_ |
OLD | NEW |