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

Side by Side Diff: chrome/browser/sync/glue/browser_thread_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_BROWSER_THREAD_MODEL_WORKER_H_ 5 #ifndef CHROME_BROWSER_SYNC_GLUE_BROWSER_THREAD_MODEL_WORKER_H_
6 #define CHROME_BROWSER_SYNC_GLUE_BROWSER_THREAD_MODEL_WORKER_H_ 6 #define CHROME_BROWSER_SYNC_GLUE_BROWSER_THREAD_MODEL_WORKER_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/callback_forward.h" 10 #include "base/callback_forward.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "content/public/browser/browser_thread.h" 12 #include "content/public/browser/browser_thread.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/syncer_error.h" 14 #include "sync/internal_api/public/util/syncer_error.h"
15 15
16 namespace base { 16 namespace base {
17 class WaitableEvent; 17 class WaitableEvent;
18 } 18 }
19 19
20 namespace browser_sync { 20 namespace browser_sync {
21 21
22 // A csync::ModelSafeWorker for models that accept requests from the 22 // A syncer::ModelSafeWorker for models that accept requests from the
23 // syncapi that need to be fulfilled on a browser thread, for example 23 // syncapi that need to be fulfilled on a browser thread, for example
24 // autofill on the DB thread. TODO(sync): Try to generalize other 24 // autofill on the DB thread. TODO(sync): Try to generalize other
25 // ModelWorkers (e.g. history, etc). 25 // ModelWorkers (e.g. history, etc).
26 class BrowserThreadModelWorker : public csync::ModelSafeWorker { 26 class BrowserThreadModelWorker : public syncer::ModelSafeWorker {
27 public: 27 public:
28 BrowserThreadModelWorker(content::BrowserThread::ID thread, 28 BrowserThreadModelWorker(content::BrowserThread::ID thread,
29 csync::ModelSafeGroup group); 29 syncer::ModelSafeGroup group);
30 30
31 // csync::ModelSafeWorker implementation. Called on the sync thread. 31 // syncer::ModelSafeWorker implementation. Called on the sync thread.
32 virtual csync::SyncerError DoWorkAndWaitUntilDone( 32 virtual syncer::SyncerError DoWorkAndWaitUntilDone(
33 const csync::WorkCallback& work) OVERRIDE; 33 const syncer::WorkCallback& work) OVERRIDE;
34 virtual csync::ModelSafeGroup GetModelSafeGroup() OVERRIDE; 34 virtual syncer::ModelSafeGroup GetModelSafeGroup() OVERRIDE;
35 35
36 protected: 36 protected:
37 virtual ~BrowserThreadModelWorker(); 37 virtual ~BrowserThreadModelWorker();
38 38
39 // Marked pure virtual so subclasses have to override, but there is 39 // Marked pure virtual so subclasses have to override, but there is
40 // an implementation that subclasses should use. This is so that 40 // an implementation that subclasses should use. This is so that
41 // (subclass)::CallDoWorkAndSignalTask shows up in callstacks. 41 // (subclass)::CallDoWorkAndSignalTask shows up in callstacks.
42 virtual void CallDoWorkAndSignalTask( 42 virtual void CallDoWorkAndSignalTask(
43 const csync::WorkCallback& work, 43 const syncer::WorkCallback& work,
44 base::WaitableEvent* done, 44 base::WaitableEvent* done,
45 csync::SyncerError* error) = 0; 45 syncer::SyncerError* error) = 0;
46 46
47 private: 47 private:
48 content::BrowserThread::ID thread_; 48 content::BrowserThread::ID thread_;
49 csync::ModelSafeGroup group_; 49 syncer::ModelSafeGroup group_;
50 50
51 DISALLOW_COPY_AND_ASSIGN(BrowserThreadModelWorker); 51 DISALLOW_COPY_AND_ASSIGN(BrowserThreadModelWorker);
52 }; 52 };
53 53
54 // Subclass BrowserThreadModelWorker so that we can distinguish them 54 // Subclass BrowserThreadModelWorker so that we can distinguish them
55 // from stack traces alone. 55 // from stack traces alone.
56 56
57 class DatabaseModelWorker : public BrowserThreadModelWorker { 57 class DatabaseModelWorker : public BrowserThreadModelWorker {
58 public: 58 public:
59 DatabaseModelWorker(); 59 DatabaseModelWorker();
60 60
61 protected: 61 protected:
62 virtual void CallDoWorkAndSignalTask( 62 virtual void CallDoWorkAndSignalTask(
63 const csync::WorkCallback& work, 63 const syncer::WorkCallback& work,
64 base::WaitableEvent* done, 64 base::WaitableEvent* done,
65 csync::SyncerError* error) OVERRIDE; 65 syncer::SyncerError* error) OVERRIDE;
66 66
67 private: 67 private:
68 virtual ~DatabaseModelWorker(); 68 virtual ~DatabaseModelWorker();
69 }; 69 };
70 70
71 class FileModelWorker : public BrowserThreadModelWorker { 71 class FileModelWorker : public BrowserThreadModelWorker {
72 public: 72 public:
73 FileModelWorker(); 73 FileModelWorker();
74 74
75 protected: 75 protected:
76 virtual void CallDoWorkAndSignalTask( 76 virtual void CallDoWorkAndSignalTask(
77 const csync::WorkCallback& work, 77 const syncer::WorkCallback& work,
78 base::WaitableEvent* done, 78 base::WaitableEvent* done,
79 csync::SyncerError* error) OVERRIDE; 79 syncer::SyncerError* error) OVERRIDE;
80 80
81 private: 81 private:
82 virtual ~FileModelWorker(); 82 virtual ~FileModelWorker();
83 }; 83 };
84 84
85 } // namespace browser_sync 85 } // namespace browser_sync
86 86
87 #endif // CHROME_BROWSER_SYNC_GLUE_BROWSER_THREAD_MODEL_WORKER_H_ 87 #endif // CHROME_BROWSER_SYNC_GLUE_BROWSER_THREAD_MODEL_WORKER_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/bridged_sync_notifier_unittest.cc ('k') | chrome/browser/sync/glue/browser_thread_model_worker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698