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

Side by Side Diff: chrome/browser/sync/glue/ui_model_worker.h

Issue 10698014: [Sync] Rename csync namespace to syncer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 8 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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"
11 #include "base/synchronization/condition_variable.h" 11 #include "base/synchronization/condition_variable.h"
12 #include "base/synchronization/lock.h" 12 #include "base/synchronization/lock.h"
13 #include "sync/internal_api/public/engine/model_safe_worker.h" 13 #include "sync/internal_api/public/engine/model_safe_worker.h"
14 #include "sync/internal_api/public/util/unrecoverable_error_info.h" 14 #include "sync/internal_api/public/util/unrecoverable_error_info.h"
15 15
16 class MessageLoop; 16 class MessageLoop;
17 17
18 namespace browser_sync { 18 namespace browser_sync {
19 19
20 // A csync::ModelSafeWorker for UI models (e.g. bookmarks) that 20 // A syncer::ModelSafeWorker for UI models (e.g. bookmarks) that
21 // accepts work requests from the syncapi that need to be fulfilled 21 // accepts work requests from the syncapi that need to be fulfilled
22 // from the MessageLoop home to the native model. 22 // from the MessageLoop home to the native model.
23 // 23 //
24 // Lifetime note: Instances of this class will generally be owned by the 24 // Lifetime note: Instances of this class will generally be owned by the
25 // SyncerThread. When the SyncerThread _object_ is destroyed, the 25 // SyncerThread. When the SyncerThread _object_ is destroyed, the
26 // UIModelWorker will be destroyed. The SyncerThread object is destroyed 26 // UIModelWorker will be destroyed. The SyncerThread object is destroyed
27 // after the actual syncer pthread has exited. 27 // after the actual syncer pthread has exited.
28 class UIModelWorker : public csync::ModelSafeWorker { 28 class UIModelWorker : public syncer::ModelSafeWorker {
29 public: 29 public:
30 UIModelWorker(); 30 UIModelWorker();
31 31
32 // Called by the UI thread on shutdown of the sync service. Blocks until 32 // Called by the UI thread on shutdown of the sync service. Blocks until
33 // the UIModelWorker has safely met termination conditions, namely that 33 // the UIModelWorker has safely met termination conditions, namely that
34 // no task scheduled by CallDoWorkFromModelSafeThreadAndWait remains un- 34 // no task scheduled by CallDoWorkFromModelSafeThreadAndWait remains un-
35 // processed and that syncapi will not schedule any further work for us to do. 35 // processed and that syncapi will not schedule any further work for us to do.
36 void Stop(); 36 void Stop();
37 37
38 // csync::ModelSafeWorker implementation. Called on syncapi SyncerThread. 38 // syncer::ModelSafeWorker implementation. Called on syncapi SyncerThread.
39 virtual csync::SyncerError DoWorkAndWaitUntilDone( 39 virtual syncer::SyncerError DoWorkAndWaitUntilDone(
40 const csync::WorkCallback& work) OVERRIDE; 40 const syncer::WorkCallback& work) OVERRIDE;
41 virtual csync::ModelSafeGroup GetModelSafeGroup() OVERRIDE; 41 virtual syncer::ModelSafeGroup GetModelSafeGroup() OVERRIDE;
42 42
43 // Upon receiving this idempotent call, the csync::ModelSafeWorker can 43 // Upon receiving this idempotent call, the syncer::ModelSafeWorker can
44 // assume no work will ever be scheduled again from now on. If it has any work 44 // assume no work will ever be scheduled again from now on. If it has any work
45 // that it has not yet completed, it must make sure to run it as soon as 45 // that it has not yet completed, it must make sure to run it as soon as
46 // possible as the Syncer is trying to shut down. Called from the CoreThread. 46 // possible as the Syncer is trying to shut down. Called from the CoreThread.
47 void OnSyncerShutdownComplete(); 47 void OnSyncerShutdownComplete();
48 48
49 // Callback from |pending_work_| to notify us that it has been run. 49 // Callback from |pending_work_| to notify us that it has been run.
50 // Called on ui loop. 50 // Called on ui loop.
51 void OnTaskCompleted() { pending_work_.Reset(); } 51 void OnTaskCompleted() { pending_work_.Reset(); }
52 52
53 private: 53 private:
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 // SyncerThread has terminated. We only care about (1) when we are in Stop(), 96 // SyncerThread has terminated. We only care about (1) when we are in Stop(),
97 // because we have to manually Run() the task. 97 // because we have to manually Run() the task.
98 base::ConditionVariable syncapi_event_; 98 base::ConditionVariable syncapi_event_;
99 99
100 DISALLOW_COPY_AND_ASSIGN(UIModelWorker); 100 DISALLOW_COPY_AND_ASSIGN(UIModelWorker);
101 }; 101 };
102 102
103 } // namespace browser_sync 103 } // namespace browser_sync
104 104
105 #endif // CHROME_BROWSER_SYNC_GLUE_UI_MODEL_WORKER_H_ 105 #endif // CHROME_BROWSER_SYNC_GLUE_UI_MODEL_WORKER_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/ui_data_type_controller_unittest.cc ('k') | chrome/browser/sync/glue/ui_model_worker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698