OLD | NEW |
| (Empty) |
1 // Copyright 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_SYNCABLE_DIRECTORY_CHANGE_DELEGATE_H_ | |
6 #define SYNC_SYNCABLE_DIRECTORY_CHANGE_DELEGATE_H_ | |
7 | |
8 #include <stdint.h> | |
9 | |
10 #include <vector> | |
11 | |
12 #include "sync/base/sync_export.h" | |
13 #include "sync/internal_api/public/base/model_type.h" | |
14 #include "sync/syncable/write_transaction_info.h" | |
15 | |
16 namespace syncer { | |
17 namespace syncable { | |
18 | |
19 // This is an interface for listening to directory change events, triggered by | |
20 // the releasing of the syncable transaction. The delegate performs work to | |
21 // 1. Calculate changes, depending on the source of the transaction | |
22 // (HandleCalculateChangesChangeEventFromSyncer/Syncapi). | |
23 // 2. Perform final work while the transaction is held | |
24 // (HandleTransactionEndingChangeEvent). | |
25 // 3. Perform any work that should be done after the transaction is released. | |
26 // (HandleTransactionCompleteChangeEvent). | |
27 // | |
28 // Note that these methods may be called on *any* thread. | |
29 class SYNC_EXPORT DirectoryChangeDelegate { | |
30 public: | |
31 // Returns the handles of changed entries in |entry_changed|. | |
32 virtual void HandleCalculateChangesChangeEventFromSyncApi( | |
33 const ImmutableWriteTransactionInfo& write_transaction_info, | |
34 BaseTransaction* trans, | |
35 std::vector<int64_t>* entries_changed) = 0; | |
36 // Returns the handles of changed entries in |entry_changed|. | |
37 virtual void HandleCalculateChangesChangeEventFromSyncer( | |
38 const ImmutableWriteTransactionInfo& write_transaction_info, | |
39 BaseTransaction* trans, | |
40 std::vector<int64_t>* entries_changed) = 0; | |
41 // Must return the set of all ModelTypes that were modified in the | |
42 // transaction. | |
43 virtual ModelTypeSet HandleTransactionEndingChangeEvent( | |
44 const ImmutableWriteTransactionInfo& write_transaction_info, | |
45 BaseTransaction* trans) = 0; | |
46 virtual void HandleTransactionCompleteChangeEvent( | |
47 ModelTypeSet models_with_changes) = 0; | |
48 protected: | |
49 virtual ~DirectoryChangeDelegate() {} | |
50 }; | |
51 | |
52 } // namespace syncable | |
53 } // namespace syncer | |
54 | |
55 #endif // SYNC_SYNCABLE_DIRECTORY_CHANGE_DELEGATE_H_ | |
OLD | NEW |