OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/condition_variable.h" | 10 #include "base/condition_variable.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 }; | 60 }; |
61 | 61 |
62 // Called by the UI thread on shutdown of the sync service. Blocks until | 62 // Called by the UI thread on shutdown of the sync service. Blocks until |
63 // the UIModelWorker has safely met termination conditions, namely that | 63 // the UIModelWorker has safely met termination conditions, namely that |
64 // no task scheduled by CallDoWorkFromModelSafeThreadAndWait remains un- | 64 // no task scheduled by CallDoWorkFromModelSafeThreadAndWait remains un- |
65 // processed and that syncapi will not schedule any further work for us to do. | 65 // processed and that syncapi will not schedule any further work for us to do. |
66 void Stop(); | 66 void Stop(); |
67 | 67 |
68 // ModelSafeWorker implementation. Called on syncapi SyncerThread. | 68 // ModelSafeWorker implementation. Called on syncapi SyncerThread. |
69 virtual void DoWorkAndWaitUntilDone(Callback0::Type* work); | 69 virtual void DoWorkAndWaitUntilDone(Callback0::Type* work); |
70 virtual ModelSafeGroup GetModelSafeGroup() { return GROUP_UI; } | 70 virtual ModelSafeGroup GetModelSafeGroup(); |
71 virtual bool CurrentThreadIsWorkThread(); | 71 virtual bool CurrentThreadIsWorkThread(); |
72 | 72 |
73 // Upon receiving this idempotent call, the ModelSafeWorker can | 73 // Upon receiving this idempotent call, the ModelSafeWorker can |
74 // assume no work will ever be scheduled again from now on. If it has any work | 74 // assume no work will ever be scheduled again from now on. If it has any work |
75 // that it has not yet completed, it must make sure to run it as soon as | 75 // that it has not yet completed, it must make sure to run it as soon as |
76 // possible as the Syncer is trying to shut down. Called from the CoreThread. | 76 // possible as the Syncer is trying to shut down. Called from the CoreThread. |
77 void OnSyncerShutdownComplete(); | 77 void OnSyncerShutdownComplete(); |
78 | 78 |
79 // Callback from |pending_work_| to notify us that it has been run. | 79 // Callback from |pending_work_| to notify us that it has been run. |
80 // Called on |ui_loop_|. | 80 // Called on |ui_loop_|. |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 // SyncerThread has terminated. We only care about (1) when we are in Stop(), | 127 // SyncerThread has terminated. We only care about (1) when we are in Stop(), |
128 // because we have to manually Run() the task. | 128 // because we have to manually Run() the task. |
129 ConditionVariable syncapi_event_; | 129 ConditionVariable syncapi_event_; |
130 | 130 |
131 DISALLOW_COPY_AND_ASSIGN(UIModelWorker); | 131 DISALLOW_COPY_AND_ASSIGN(UIModelWorker); |
132 }; | 132 }; |
133 | 133 |
134 } // namespace browser_sync | 134 } // namespace browser_sync |
135 | 135 |
136 #endif // CHROME_BROWSER_SYNC_GLUE_UI_MODEL_WORKER_H_ | 136 #endif // CHROME_BROWSER_SYNC_GLUE_UI_MODEL_WORKER_H_ |
OLD | NEW |