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

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

Issue 8437002: Move BrowserThread to content namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: A few updates. Created 9 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 | Annotate | Revision Log
OLDNEW
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_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.h" 10 #include "base/callback.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "chrome/browser/sync/engine/model_safe_worker.h" 12 #include "chrome/browser/sync/engine/model_safe_worker.h"
13 #include "chrome/browser/sync/util/unrecoverable_error_info.h" 13 #include "chrome/browser/sync/util/unrecoverable_error_info.h"
14 #include "content/public/browser/browser_thread.h" 14 #include "content/public/browser/browser_thread.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 ModelSafeWorker for models that accept requests from the syncapi that need 22 // A ModelSafeWorker for models that accept requests from the syncapi that need
23 // to be fulfilled on a browser thread, for example autofill on the DB thread. 23 // to be fulfilled on a browser thread, for example autofill on the DB thread.
24 // TODO(sync): Try to generalize other ModelWorkers (e.g. history, etc). 24 // TODO(sync): Try to generalize other ModelWorkers (e.g. history, etc).
25 class BrowserThreadModelWorker : public browser_sync::ModelSafeWorker { 25 class BrowserThreadModelWorker : public browser_sync::ModelSafeWorker {
26 public: 26 public:
27 BrowserThreadModelWorker(BrowserThread::ID thread, ModelSafeGroup group); 27 BrowserThreadModelWorker(content::BrowserThread::ID thread,
28 ModelSafeGroup group);
28 virtual ~BrowserThreadModelWorker(); 29 virtual ~BrowserThreadModelWorker();
29 30
30 // ModelSafeWorker implementation. Called on the sync thread. 31 // ModelSafeWorker implementation. Called on the sync thread.
31 virtual UnrecoverableErrorInfo DoWorkAndWaitUntilDone( 32 virtual UnrecoverableErrorInfo DoWorkAndWaitUntilDone(
32 const WorkCallback& work) OVERRIDE; 33 const WorkCallback& work) OVERRIDE;
33 virtual ModelSafeGroup GetModelSafeGroup() OVERRIDE; 34 virtual ModelSafeGroup GetModelSafeGroup() OVERRIDE;
34 35
35 protected: 36 protected:
36 // Marked pure virtual so subclasses have to override, but there is 37 // Marked pure virtual so subclasses have to override, but there is
37 // an implementation that subclasses should use. This is so that 38 // an implementation that subclasses should use. This is so that
38 // (subclass)::CallDoWorkAndSignalTask shows up in callstacks. 39 // (subclass)::CallDoWorkAndSignalTask shows up in callstacks.
39 virtual void CallDoWorkAndSignalTask( 40 virtual void CallDoWorkAndSignalTask(
40 const WorkCallback& work, 41 const WorkCallback& work,
41 base::WaitableEvent* done, 42 base::WaitableEvent* done,
42 UnrecoverableErrorInfo* error_info) = 0; 43 UnrecoverableErrorInfo* error_info) = 0;
43 44
44 private: 45 private:
45 BrowserThread::ID thread_; 46 content::BrowserThread::ID thread_;
46 ModelSafeGroup group_; 47 ModelSafeGroup group_;
47 48
48 DISALLOW_COPY_AND_ASSIGN(BrowserThreadModelWorker); 49 DISALLOW_COPY_AND_ASSIGN(BrowserThreadModelWorker);
49 }; 50 };
50 51
51 // Subclass BrowserThreadModelWorker so that we can distinguish them 52 // Subclass BrowserThreadModelWorker so that we can distinguish them
52 // from stack traces alone. 53 // from stack traces alone.
53 54
54 class DatabaseModelWorker : public BrowserThreadModelWorker { 55 class DatabaseModelWorker : public BrowserThreadModelWorker {
55 public: 56 public:
(...skipping 15 matching lines...) Expand all
71 protected: 72 protected:
72 virtual void CallDoWorkAndSignalTask( 73 virtual void CallDoWorkAndSignalTask(
73 const WorkCallback& work, 74 const WorkCallback& work,
74 base::WaitableEvent* done, 75 base::WaitableEvent* done,
75 UnrecoverableErrorInfo* error_info) OVERRIDE; 76 UnrecoverableErrorInfo* error_info) OVERRIDE;
76 }; 77 };
77 78
78 } // namespace browser_sync 79 } // namespace browser_sync
79 80
80 #endif // CHROME_BROWSER_SYNC_GLUE_BROWSER_THREAD_MODEL_WORKER_H_ 81 #endif // CHROME_BROWSER_SYNC_GLUE_BROWSER_THREAD_MODEL_WORKER_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/bookmark_model_associator.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