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

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

Issue 8366030: Introduce the plumbing necessary to report Unrecoverable error from model safe workers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: For try jobs. 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 "content/browser/browser_thread.h" 14 #include "content/browser/browser_thread.h"
14 15
15 namespace base { 16 namespace base {
16 class WaitableEvent; 17 class WaitableEvent;
17 } 18 }
18 19
19 namespace browser_sync { 20 namespace browser_sync {
20 21
21 // 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
22 // 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.
23 // TODO(sync): Try to generalize other ModelWorkers (e.g. history, etc). 24 // TODO(sync): Try to generalize other ModelWorkers (e.g. history, etc).
24 class BrowserThreadModelWorker : public browser_sync::ModelSafeWorker { 25 class BrowserThreadModelWorker : public browser_sync::ModelSafeWorker {
25 public: 26 public:
26 BrowserThreadModelWorker(BrowserThread::ID thread, ModelSafeGroup group); 27 BrowserThreadModelWorker(BrowserThread::ID thread, ModelSafeGroup group);
27 virtual ~BrowserThreadModelWorker(); 28 virtual ~BrowserThreadModelWorker();
28 29
29 // ModelSafeWorker implementation. Called on the sync thread. 30 // ModelSafeWorker implementation. Called on the sync thread.
30 virtual void DoWorkAndWaitUntilDone(Callback0::Type* work); 31 virtual UnrecoverableErrorInfo DoWorkAndWaitUntilDone(
31 virtual ModelSafeGroup GetModelSafeGroup(); 32 const WorkCallback& work) OVERRIDE;
33 virtual ModelSafeGroup GetModelSafeGroup() OVERRIDE;
32 34
33 protected: 35 protected:
34 // Marked pure virtual so subclasses have to override, but there is 36 // Marked pure virtual so subclasses have to override, but there is
35 // an implementation that subclasses should use. This is so that 37 // an implementation that subclasses should use. This is so that
36 // (subclass)::CallDoWorkAndSignalTask shows up in callstacks. 38 // (subclass)::CallDoWorkAndSignalTask shows up in callstacks.
37 virtual void CallDoWorkAndSignalTask( 39 virtual void CallDoWorkAndSignalTask(
38 Callback0::Type* work, base::WaitableEvent* done) = 0; 40 const WorkCallback& work,
41 base::WaitableEvent* done,
42 UnrecoverableErrorInfo* error_info) = 0;
39 43
40 private: 44 private:
41 BrowserThread::ID thread_; 45 BrowserThread::ID thread_;
42 ModelSafeGroup group_; 46 ModelSafeGroup group_;
43 47
44 DISALLOW_COPY_AND_ASSIGN(BrowserThreadModelWorker); 48 DISALLOW_COPY_AND_ASSIGN(BrowserThreadModelWorker);
45 }; 49 };
46 50
47 // Subclass BrowserThreadModelWorker so that we can distinguish them 51 // Subclass BrowserThreadModelWorker so that we can distinguish them
48 // from stack traces alone. 52 // from stack traces alone.
49 53
50 class DatabaseModelWorker : public BrowserThreadModelWorker { 54 class DatabaseModelWorker : public BrowserThreadModelWorker {
51 public: 55 public:
52 DatabaseModelWorker(); 56 DatabaseModelWorker();
53 virtual ~DatabaseModelWorker(); 57 virtual ~DatabaseModelWorker();
54 58
55 protected: 59 protected:
56 virtual void CallDoWorkAndSignalTask( 60 virtual void CallDoWorkAndSignalTask(
57 Callback0::Type* work, base::WaitableEvent* done) OVERRIDE; 61 const WorkCallback& work,
62 base::WaitableEvent* done,
63 UnrecoverableErrorInfo* error_info) OVERRIDE;
58 }; 64 };
59 65
60 class FileModelWorker : public BrowserThreadModelWorker { 66 class FileModelWorker : public BrowserThreadModelWorker {
61 public: 67 public:
62 FileModelWorker(); 68 FileModelWorker();
63 virtual ~FileModelWorker(); 69 virtual ~FileModelWorker();
64 70
65 protected: 71 protected:
66 virtual void CallDoWorkAndSignalTask( 72 virtual void CallDoWorkAndSignalTask(
67 Callback0::Type* work, base::WaitableEvent* done) OVERRIDE; 73 const WorkCallback& work,
74 base::WaitableEvent* done,
75 UnrecoverableErrorInfo* error_info) OVERRIDE;
68 }; 76 };
69 77
70 } // namespace browser_sync 78 } // namespace browser_sync
71 79
72 #endif // CHROME_BROWSER_SYNC_GLUE_BROWSER_THREAD_MODEL_WORKER_H_ 80 #endif // CHROME_BROWSER_SYNC_GLUE_BROWSER_THREAD_MODEL_WORKER_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/engine/model_safe_worker.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