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 COMPONENTS_SYNC_DRIVER_CHANGE_PROCESSOR_H_ | 5 #ifndef COMPONENTS_SYNC_DRIVER_CHANGE_PROCESSOR_H_ |
6 #define COMPONENTS_SYNC_DRIVER_CHANGE_PROCESSOR_H_ | 6 #define COMPONENTS_SYNC_DRIVER_CHANGE_PROCESSOR_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "components/sync_driver/data_type_error_handler.h" | |
12 #include "sync/internal_api/public/base_transaction.h" | 11 #include "sync/internal_api/public/base_transaction.h" |
13 #include "sync/internal_api/public/change_record.h" | 12 #include "sync/internal_api/public/change_record.h" |
13 #include "sync/internal_api/public/data_type_error_handler.h" | |
pavely
2016/05/11 18:29:04
You don't need this include, you already forward d
maxbogue
2016/05/11 19:03:02
Done.
| |
14 #include "sync/internal_api/public/user_share.h" | 14 #include "sync/internal_api/public/user_share.h" |
15 | 15 |
16 namespace syncer { | 16 namespace syncer { |
17 class DataTypeErrorHandler; | |
17 class UnrecoverableErrorHandler; | 18 class UnrecoverableErrorHandler; |
18 } // namespace syncer | 19 } // namespace syncer |
19 | 20 |
20 namespace sync_driver { | 21 namespace sync_driver { |
21 | 22 |
22 class ModelAssociator; | 23 class ModelAssociator; |
23 | 24 |
24 // An interface used to apply changes from the sync model to the browser's | 25 // An interface used to apply changes from the sync model to the browser's |
25 // native model. This does not currently distinguish between model data types. | 26 // native model. This does not currently distinguish between model data types. |
26 class ChangeProcessor { | 27 class ChangeProcessor { |
27 public: | 28 public: |
28 explicit ChangeProcessor(DataTypeErrorHandler* error_handler); | 29 explicit ChangeProcessor(syncer::DataTypeErrorHandler* error_handler); |
29 virtual ~ChangeProcessor(); | 30 virtual ~ChangeProcessor(); |
30 | 31 |
31 // Call when the processor should accept changes from either provided model | 32 // Call when the processor should accept changes from either provided model |
32 // and apply them to the other. Both the native model and sync_api are | 33 // and apply them to the other. Both the native model and sync_api are |
33 // expected to be initialized and loaded. You must have set a valid | 34 // expected to be initialized and loaded. You must have set a valid |
34 // ModelAssociator and UnrecoverableErrorHandler before using this method, and | 35 // ModelAssociator and UnrecoverableErrorHandler before using this method, and |
35 // the two models should be associated w.r.t the ModelAssociator provided. | 36 // the two models should be associated w.r.t the ModelAssociator provided. |
36 void Start(syncer::UserShare* share_handle); | 37 void Start(syncer::UserShare* share_handle); |
37 | 38 |
38 // Changes have been applied to the backend model and are ready to be | 39 // Changes have been applied to the backend model and are ready to be |
(...skipping 10 matching lines...) Expand all Loading... | |
49 // This function is called once the transactional lock is released and it is | 50 // This function is called once the transactional lock is released and it is |
50 // safe to perform inter-thread or slow I/O operations. Note that not all | 51 // safe to perform inter-thread or slow I/O operations. Note that not all |
51 // datatypes need this, so we provide an empty default version. | 52 // datatypes need this, so we provide an empty default version. |
52 virtual void CommitChangesFromSyncModel(); | 53 virtual void CommitChangesFromSyncModel(); |
53 | 54 |
54 protected: | 55 protected: |
55 // These methods are invoked by Start() and Stop() to do | 56 // These methods are invoked by Start() and Stop() to do |
56 // implementation-specific work. | 57 // implementation-specific work. |
57 virtual void StartImpl() = 0; | 58 virtual void StartImpl() = 0; |
58 | 59 |
59 DataTypeErrorHandler* error_handler() const; | 60 syncer::DataTypeErrorHandler* error_handler() const; |
60 virtual syncer::UserShare* share_handle() const; | 61 virtual syncer::UserShare* share_handle() const; |
61 | 62 |
62 private: | 63 private: |
63 DataTypeErrorHandler* error_handler_; // Guaranteed to outlive us. | 64 syncer::DataTypeErrorHandler* error_handler_; // Guaranteed to outlive us. |
64 | 65 |
65 // The sync model we are processing changes from. | 66 // The sync model we are processing changes from. |
66 syncer::UserShare* share_handle_; | 67 syncer::UserShare* share_handle_; |
67 | 68 |
68 DISALLOW_COPY_AND_ASSIGN(ChangeProcessor); | 69 DISALLOW_COPY_AND_ASSIGN(ChangeProcessor); |
69 }; | 70 }; |
70 | 71 |
71 } // namespace sync_driver | 72 } // namespace sync_driver |
72 | 73 |
73 #endif // COMPONENTS_SYNC_DRIVER_CHANGE_PROCESSOR_H_ | 74 #endif // COMPONENTS_SYNC_DRIVER_CHANGE_PROCESSOR_H_ |
OLD | NEW |