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