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

Side by Side Diff: chrome/browser/sync/engine/model_safe_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 review. Created 9 years, 2 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) 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_ENGINE_MODEL_SAFE_WORKER_H_ 5 #ifndef CHROME_BROWSER_SYNC_ENGINE_MODEL_SAFE_WORKER_H_
6 #define CHROME_BROWSER_SYNC_ENGINE_MODEL_SAFE_WORKER_H_ 6 #define CHROME_BROWSER_SYNC_ENGINE_MODEL_SAFE_WORKER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/callback_old.h" 13 #include "base/callback_old.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "chrome/browser/sync/syncable/model_type.h" 15 #include "chrome/browser/sync/syncable/model_type.h"
16 #include "chrome/browser/sync/sessions/unrecoverable_error_info.h"
16 17
17 namespace base { 18 namespace base {
18 class DictionaryValue; 19 class DictionaryValue;
19 } // namespace 20 } // namespace
20 21
21 namespace browser_sync { 22 namespace browser_sync {
22 23
23 enum ModelSafeGroup { 24 enum ModelSafeGroup {
24 GROUP_PASSIVE = 0, // Models that are just "passively" being synced; e.g. 25 GROUP_PASSIVE = 0, // Models that are just "passively" being synced; e.g.
25 // changes to these models don't need to be pushed to a 26 // changes to these models don't need to be pushed to a
(...skipping 19 matching lines...) Expand all
45 // cause an embedding application model to fall out of sync with the 46 // cause an embedding application model to fall out of sync with the
46 // syncable::Directory due to a race. 47 // syncable::Directory due to a race.
47 class ModelSafeWorker : public base::RefCountedThreadSafe<ModelSafeWorker> { 48 class ModelSafeWorker : public base::RefCountedThreadSafe<ModelSafeWorker> {
48 public: 49 public:
49 ModelSafeWorker(); 50 ModelSafeWorker();
50 virtual ~ModelSafeWorker(); 51 virtual ~ModelSafeWorker();
51 52
52 // Any time the Syncer performs model modifications (e.g employing a 53 // Any time the Syncer performs model modifications (e.g employing a
53 // WriteTransaction), it should be done by this method to ensure it is done 54 // WriteTransaction), it should be done by this method to ensure it is done
54 // from a model-safe thread. 55 // from a model-safe thread.
55 virtual void DoWorkAndWaitUntilDone(Callback0::Type* work); 56 virtual sessions::UnrecoverableErrorInfo DoWorkAndWaitUntilDone(
57 Callback1<sessions::UnrecoverableErrorInfo*>::Type* work);
akalin 2011/10/25 03:20:06 probably easier to provide a typedef for the callb
lipalani1 2011/10/26 00:12:13 Done.
56 58
57 virtual ModelSafeGroup GetModelSafeGroup(); 59 virtual ModelSafeGroup GetModelSafeGroup();
58 60
59 private: 61 private:
60 friend class base::RefCountedThreadSafe<ModelSafeWorker>; 62 friend class base::RefCountedThreadSafe<ModelSafeWorker>;
61 63
62 DISALLOW_COPY_AND_ASSIGN(ModelSafeWorker); 64 DISALLOW_COPY_AND_ASSIGN(ModelSafeWorker);
63 }; 65 };
64 66
65 // A map that details which ModelSafeGroup each syncable::ModelType 67 // A map that details which ModelSafeGroup each syncable::ModelType
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 virtual void GetModelSafeRoutingInfo(ModelSafeRoutingInfo* out) = 0; 104 virtual void GetModelSafeRoutingInfo(ModelSafeRoutingInfo* out) = 0;
103 protected: 105 protected:
104 virtual ~ModelSafeWorkerRegistrar() {} 106 virtual ~ModelSafeWorkerRegistrar() {}
105 private: 107 private:
106 DISALLOW_COPY_AND_ASSIGN(ModelSafeWorkerRegistrar); 108 DISALLOW_COPY_AND_ASSIGN(ModelSafeWorkerRegistrar);
107 }; 109 };
108 110
109 } // namespace browser_sync 111 } // namespace browser_sync
110 112
111 #endif // CHROME_BROWSER_SYNC_ENGINE_MODEL_SAFE_WORKER_H_ 113 #endif // CHROME_BROWSER_SYNC_ENGINE_MODEL_SAFE_WORKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698