| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef SYNC_ENGINE_CLEANUP_DISABLED_TYPES_COMMAND_H_ | |
| 6 #define SYNC_ENGINE_CLEANUP_DISABLED_TYPES_COMMAND_H_ | |
| 7 | |
| 8 #include "base/compiler_specific.h" | |
| 9 #include "sync/engine/syncer_command.h" | |
| 10 | |
| 11 namespace syncer { | |
| 12 | |
| 13 // A syncer command that purges (from memory and disk) entries belonging to | |
| 14 // a ModelType or ServerModelType that the user has not elected to sync. | |
| 15 // | |
| 16 // This is done as part of a session to 1) ensure it does not block the UI, | |
| 17 // and 2) avoid complicated races that could arise between a) deleting | |
| 18 // things b) a sync session trying to use these things c) and the potential | |
| 19 // re-enabling of the data type by the user before some scheduled deletion | |
| 20 // took place. Here, we are safe to perform I/O synchronously and we know it | |
| 21 // is a safe time to delete as we are in the only active session. | |
| 22 // | |
| 23 // The removal from memory is done synchronously, while the disk purge is left | |
| 24 // to an asynchronous SaveChanges operation. However, all the updates for | |
| 25 // meta data fields (such as initial_sync_ended) as well as the actual entry | |
| 26 // deletions will be committed in a single sqlite transaction. Thus it is | |
| 27 // possible that disabled types re-appear (in the sync db) after a reboot, | |
| 28 // but things will remain in a consistent state. This kind of error case is | |
| 29 // cared for in this command by retrying; see ExecuteImpl. | |
| 30 class CleanupDisabledTypesCommand : public SyncerCommand { | |
| 31 public: | |
| 32 CleanupDisabledTypesCommand(); | |
| 33 virtual ~CleanupDisabledTypesCommand(); | |
| 34 | |
| 35 // SyncerCommand implementation. | |
| 36 virtual SyncerError ExecuteImpl(sessions::SyncSession* session) OVERRIDE; | |
| 37 | |
| 38 private: | |
| 39 DISALLOW_COPY_AND_ASSIGN(CleanupDisabledTypesCommand); | |
| 40 }; | |
| 41 | |
| 42 } // namespace syncer | |
| 43 | |
| 44 #endif // SYNC_ENGINE_CLEANUP_DISABLED_TYPES_COMMAND_H_ | |
| OLD | NEW |