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