| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 SYNC_ENGINE_MODEL_CHANGING_SYNCER_COMMAND_H_ | 5 #ifndef SYNC_ENGINE_MODEL_CHANGING_SYNCER_COMMAND_H_ |
| 6 #define SYNC_ENGINE_MODEL_CHANGING_SYNCER_COMMAND_H_ | 6 #define SYNC_ENGINE_MODEL_CHANGING_SYNCER_COMMAND_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "sync/engine/syncer_command.h" | 9 #include "sync/engine/syncer_command.h" |
| 10 #include "sync/internal_api/public/engine/model_safe_worker.h" | 10 #include "sync/internal_api/public/engine/model_safe_worker.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 // SyncerCommand whenever the operation might change any client-visible | 23 // SyncerCommand whenever the operation might change any client-visible |
| 24 // fields on any syncable::Entry. If the operation involves creating a | 24 // fields on any syncable::Entry. If the operation involves creating a |
| 25 // WriteTransaction, this is a sign that ModelChangingSyncerCommand is likely | 25 // WriteTransaction, this is a sign that ModelChangingSyncerCommand is likely |
| 26 // necessary. | 26 // necessary. |
| 27 class ModelChangingSyncerCommand : public SyncerCommand { | 27 class ModelChangingSyncerCommand : public SyncerCommand { |
| 28 public: | 28 public: |
| 29 ModelChangingSyncerCommand() : work_session_(NULL) { } | 29 ModelChangingSyncerCommand() : work_session_(NULL) { } |
| 30 virtual ~ModelChangingSyncerCommand() { } | 30 virtual ~ModelChangingSyncerCommand() { } |
| 31 | 31 |
| 32 // SyncerCommand implementation. Sets work_session to session. | 32 // SyncerCommand implementation. Sets work_session to session. |
| 33 virtual syncer::SyncerError ExecuteImpl( | 33 virtual SyncerError ExecuteImpl(sessions::SyncSession* session) OVERRIDE; |
| 34 sessions::SyncSession* session) OVERRIDE; | |
| 35 | 34 |
| 36 // Wrapper so implementations don't worry about storing work_session. | 35 // Wrapper so implementations don't worry about storing work_session. |
| 37 SyncerError StartChangingModel() { | 36 SyncerError StartChangingModel() { |
| 38 return ModelChangingExecuteImpl(work_session_); | 37 return ModelChangingExecuteImpl(work_session_); |
| 39 } | 38 } |
| 40 | 39 |
| 41 std::set<ModelSafeGroup> GetGroupsToChangeForTest( | 40 std::set<ModelSafeGroup> GetGroupsToChangeForTest( |
| 42 const sessions::SyncSession& session) const { | 41 const sessions::SyncSession& session) const { |
| 43 return GetGroupsToChange(session); | 42 return GetGroupsToChange(session); |
| 44 } | 43 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 67 // Implementations will implement ModelChangingExecuteImpl and not | 66 // Implementations will implement ModelChangingExecuteImpl and not |
| 68 // worry about storing the session or setting it. They are given work_session. | 67 // worry about storing the session or setting it. They are given work_session. |
| 69 sessions::SyncSession* work_session_; | 68 sessions::SyncSession* work_session_; |
| 70 | 69 |
| 71 DISALLOW_COPY_AND_ASSIGN(ModelChangingSyncerCommand); | 70 DISALLOW_COPY_AND_ASSIGN(ModelChangingSyncerCommand); |
| 72 }; | 71 }; |
| 73 | 72 |
| 74 } // namespace syncer | 73 } // namespace syncer |
| 75 | 74 |
| 76 #endif // SYNC_ENGINE_MODEL_CHANGING_SYNCER_COMMAND_H_ | 75 #endif // SYNC_ENGINE_MODEL_CHANGING_SYNCER_COMMAND_H_ |
| OLD | NEW |