OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_INTERNAL_API_PUBLIC_MODEL_TYPE_PROCESSOR_H_ | 5 #ifndef COMPONENTS_SYNC_CORE_MODEL_TYPE_PROCESSOR_H_ |
6 #define SYNC_INTERNAL_API_PUBLIC_MODEL_TYPE_PROCESSOR_H_ | 6 #define COMPONENTS_SYNC_CORE_MODEL_TYPE_PROCESSOR_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "sync/base/sync_export.h" | 10 #include "components/sync/base/sync_export.h" |
11 #include "sync/internal_api/public/non_blocking_sync_common.h" | 11 #include "components/sync/core/non_blocking_sync_common.h" |
12 #include "sync/protocol/data_type_state.pb.h" | 12 #include "components/sync/protocol/data_type_state.pb.h" |
13 | 13 |
14 namespace syncer_v2 { | 14 namespace syncer_v2 { |
15 class CommitQueue; | 15 class CommitQueue; |
16 | 16 |
17 // Interface used by sync backend to issue requests to a synced data type. | 17 // Interface used by sync backend to issue requests to a synced data type. |
18 class SYNC_EXPORT ModelTypeProcessor { | 18 class SYNC_EXPORT ModelTypeProcessor { |
19 public: | 19 public: |
20 ModelTypeProcessor(); | 20 ModelTypeProcessor(); |
21 virtual ~ModelTypeProcessor(); | 21 virtual ~ModelTypeProcessor(); |
22 | 22 |
23 // Connect this processor to the sync engine via |commit_queue|. Once called, | 23 // Connect this processor to the sync engine via |commit_queue|. Once called, |
24 // the processor will send any pending and future commits via this channel. | 24 // the processor will send any pending and future commits via this channel. |
25 // This can only be called multiple times if the processor is disconnected | 25 // This can only be called multiple times if the processor is disconnected |
26 // (via the DataTypeController) in between. | 26 // (via the DataTypeController) in between. |
27 virtual void ConnectSync(std::unique_ptr<CommitQueue> commit_queue) = 0; | 27 virtual void ConnectSync(std::unique_ptr<CommitQueue> commit_queue) = 0; |
28 | 28 |
29 // Disconnect this processor from the sync engine. Change metadata will | 29 // Disconnect this processor from the sync engine. Change metadata will |
30 // continue being processed and persisted, but no commits can be made until | 30 // continue being processed and persisted, but no commits can be made until |
31 // the next time sync is connected. | 31 // the next time sync is connected. |
32 virtual void DisconnectSync() = 0; | 32 virtual void DisconnectSync() = 0; |
33 | 33 |
34 // Informs this object that some of its commit requests have been | 34 // Informs this object that some of its commit requests have been |
35 // successfully serviced. | 35 // successfully serviced. |
36 virtual void OnCommitCompleted( | 36 virtual void OnCommitCompleted( |
37 const sync_pb::DataTypeState& type_state, | 37 const sync_pb::DataTypeState& type_state, |
38 const CommitResponseDataList& response_list) = 0; | 38 const CommitResponseDataList& response_list) = 0; |
39 | 39 |
40 // Informs this object that there are some incoming updates is should | 40 // Informs this object that there are some incoming updates is should |
41 // handle. | 41 // handle. |
42 virtual void OnUpdateReceived( | 42 virtual void OnUpdateReceived(const sync_pb::DataTypeState& type_state, |
43 const sync_pb::DataTypeState& type_state, | 43 const UpdateResponseDataList& updates) = 0; |
44 const UpdateResponseDataList& updates) = 0; | |
45 }; | 44 }; |
46 | 45 |
47 } // namespace syncer_v2 | 46 } // namespace syncer_v2 |
48 | 47 |
49 #endif // SYNC_INTERNAL_API_PUBLIC_MODEL_TYPE_PROCESSOR_H_ | 48 #endif // COMPONENTS_SYNC_CORE_MODEL_TYPE_PROCESSOR_H_ |
OLD | NEW |