Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 void DoWorkAndWaitUntilDone( |
|
akalin
2011/10/24 23:20:49
It doesn't make sense to do the base class first a
lipalani1
2011/10/25 02:29:46
Done.
| |
| 57 Callback1<sessions::UnrecoverableErrorInfo*>::Type* work, | |
|
akalin
2011/10/24 23:20:49
the callbacktype should be ErrorInfo(void) (i.e.,
lipalani1
2011/10/25 02:29:46
As discussed we have to pass the pointer because i
akalin
2011/10/25 03:20:06
Actually, it's only CallDoWorkAndSignalTask (e.g.)
| |
| 58 sessions::UnrecoverableErrorInfo* error_info); | |
|
akalin
2011/10/24 23:20:49
make this return the ErrorInfo class directly
lipalani1
2011/10/25 02:29:46
Done.
| |
| 56 | 59 |
| 57 virtual ModelSafeGroup GetModelSafeGroup(); | 60 virtual ModelSafeGroup GetModelSafeGroup(); |
| 58 | 61 |
| 59 private: | 62 private: |
| 60 friend class base::RefCountedThreadSafe<ModelSafeWorker>; | 63 friend class base::RefCountedThreadSafe<ModelSafeWorker>; |
| 61 | 64 |
| 62 DISALLOW_COPY_AND_ASSIGN(ModelSafeWorker); | 65 DISALLOW_COPY_AND_ASSIGN(ModelSafeWorker); |
| 63 }; | 66 }; |
| 64 | 67 |
| 65 // A map that details which ModelSafeGroup each syncable::ModelType | 68 // A map that details which ModelSafeGroup each syncable::ModelType |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 102 virtual void GetModelSafeRoutingInfo(ModelSafeRoutingInfo* out) = 0; | 105 virtual void GetModelSafeRoutingInfo(ModelSafeRoutingInfo* out) = 0; |
| 103 protected: | 106 protected: |
| 104 virtual ~ModelSafeWorkerRegistrar() {} | 107 virtual ~ModelSafeWorkerRegistrar() {} |
| 105 private: | 108 private: |
| 106 DISALLOW_COPY_AND_ASSIGN(ModelSafeWorkerRegistrar); | 109 DISALLOW_COPY_AND_ASSIGN(ModelSafeWorkerRegistrar); |
| 107 }; | 110 }; |
| 108 | 111 |
| 109 } // namespace browser_sync | 112 } // namespace browser_sync |
| 110 | 113 |
| 111 #endif // CHROME_BROWSER_SYNC_ENGINE_MODEL_SAFE_WORKER_H_ | 114 #endif // CHROME_BROWSER_SYNC_ENGINE_MODEL_SAFE_WORKER_H_ |
| OLD | NEW |