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