Chromium Code Reviews| Index: chrome/browser/sync/glue/sync_backend_registrar.cc |
| diff --git a/chrome/browser/sync/glue/sync_backend_registrar.cc b/chrome/browser/sync/glue/sync_backend_registrar.cc |
| index 5edf2b7e2435ffaebb9dbc77625e84b15a746f35..5b7b74fb39a66045c9abe0bb0cd61537eb22e0cc 100644 |
| --- a/chrome/browser/sync/glue/sync_backend_registrar.cc |
| +++ b/chrome/browser/sync/glue/sync_backend_registrar.cc |
| @@ -5,6 +5,7 @@ |
| #include "chrome/browser/sync/glue/sync_backend_registrar.h" |
| #include <algorithm> |
| +#include <cstddef> |
| #include "base/compiler_specific.h" |
| #include "base/logging.h" |
| @@ -206,18 +207,32 @@ void SyncBackendRegistrar::DeactivateDataType(syncable::ModelType type) { |
| DCHECK(!GetProcessorUnsafe(type)); |
| } |
| -ChangeProcessor* SyncBackendRegistrar::GetProcessor( |
| - syncable::ModelType type) { |
| - base::AutoLock lock(lock_); |
| - ChangeProcessor* processor = GetProcessorUnsafe(type); |
| - if (!processor) { |
| - return NULL; |
| - } |
| - // We can only check if |processor| exists, as otherwise the type is |
| - // mapped to GROUP_PASSIVE. |
| - CHECK(IsCurrentThreadSafeForModel(type)); |
| - CHECK(processor->IsRunning()); |
| - return processor; |
| +bool SyncBackendRegistrar::IsTypeActivatedForTest( |
| + syncable::ModelType type) const { |
| + return GetProcessor(type) != NULL; |
| +} |
| + |
| +void SyncBackendRegistrar::OnChangesApplied( |
| + syncable::ModelType model_type, |
| + const sync_api::BaseTransaction* trans, |
| + const sync_api::ImmutableChangeRecordList& changes) { |
| + ChangeProcessor* processor = GetProcessor(model_type); |
| + if (!processor) |
| + return; |
| + |
| + processor->ApplyChangesFromSyncModel(trans, changes); |
| +} |
| + |
| +void SyncBackendRegistrar::OnChangesComplete( |
| + syncable::ModelType model_type) { |
| + ChangeProcessor* processor = GetProcessor(model_type); |
| + if (!processor) |
| + return; |
| + |
| + // This call just notifies the processor that it can commit; it |
| + // already buffered any changes it plans to makes so needs no |
| + // further information. |
| + processor->CommitChangesFromSyncModel(); |
| } |
| void SyncBackendRegistrar::GetWorkers( |
| @@ -237,8 +252,22 @@ void SyncBackendRegistrar::GetModelSafeRoutingInfo( |
| out->swap(copy); |
| } |
| +ChangeProcessor* SyncBackendRegistrar::GetProcessor( |
| + syncable::ModelType type) const { |
| + base::AutoLock lock(lock_); |
| + ChangeProcessor* processor = GetProcessorUnsafe(type); |
| + if (!processor) { |
| + return NULL; |
|
tim (not reviewing)
2011/09/20 16:04:59
nit / consistency - I'm seeing braceless single-li
akalin
2011/09/20 21:14:42
Done.
|
| + } |
| + // We can only check if |processor| exists, as otherwise the type is |
| + // mapped to GROUP_PASSIVE. |
| + CHECK(IsCurrentThreadSafeForModel(type)); |
| + CHECK(processor->IsRunning()); |
| + return processor; |
| +} |
| + |
| ChangeProcessor* SyncBackendRegistrar::GetProcessorUnsafe( |
| - syncable::ModelType type) { |
| + syncable::ModelType type) const { |
| lock_.AssertAcquired(); |
| std::map<syncable::ModelType, ChangeProcessor*>::const_iterator it = |
| processors_.find(type); |