Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Side by Side Diff: components/sync/driver/change_processor.h

Issue 2289143003: [Sync] Convert DTCs to be not RefCounted and NonThreadSafe. (Closed)
Patch Set: Rebase. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <memory>
11
10 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "components/sync/api/data_type_error_handler.h"
11 #include "components/sync/core/base_transaction.h" 14 #include "components/sync/core/base_transaction.h"
12 #include "components/sync/core/change_record.h" 15 #include "components/sync/core/change_record.h"
13 #include "components/sync/core/user_share.h" 16 #include "components/sync/core/user_share.h"
14 17
15 namespace syncer { 18 namespace syncer {
16 class DataTypeErrorHandler;
17 class UnrecoverableErrorHandler; 19 class UnrecoverableErrorHandler;
18 } // namespace syncer 20 } // namespace syncer
19 21
20 namespace sync_driver { 22 namespace sync_driver {
21 23
22 class ModelAssociator; 24 class ModelAssociator;
23 25
24 // An interface used to apply changes from the sync model to the browser's 26 // 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. 27 // native model. This does not currently distinguish between model data types.
26 class ChangeProcessor { 28 class ChangeProcessor {
27 public: 29 public:
28 explicit ChangeProcessor(syncer::DataTypeErrorHandler* error_handler); 30 explicit ChangeProcessor(
31 std::unique_ptr<syncer::DataTypeErrorHandler> error_handler);
29 virtual ~ChangeProcessor(); 32 virtual ~ChangeProcessor();
30 33
31 // Call when the processor should accept changes from either provided model 34 // 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 35 // 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 36 // expected to be initialized and loaded. You must have set a valid
34 // ModelAssociator and UnrecoverableErrorHandler before using this method, and 37 // ModelAssociator and UnrecoverableErrorHandler before using this method, and
35 // the two models should be associated w.r.t the ModelAssociator provided. 38 // the two models should be associated w.r.t the ModelAssociator provided.
36 void Start(syncer::UserShare* share_handle); 39 void Start(syncer::UserShare* share_handle);
37 40
38 // Changes have been applied to the backend model and are ready to be 41 // Changes have been applied to the backend model and are ready to be
(...skipping 14 matching lines...) Expand all
53 56
54 protected: 57 protected:
55 // These methods are invoked by Start() and Stop() to do 58 // These methods are invoked by Start() and Stop() to do
56 // implementation-specific work. 59 // implementation-specific work.
57 virtual void StartImpl() = 0; 60 virtual void StartImpl() = 0;
58 61
59 syncer::DataTypeErrorHandler* error_handler() const; 62 syncer::DataTypeErrorHandler* error_handler() const;
60 virtual syncer::UserShare* share_handle() const; 63 virtual syncer::UserShare* share_handle() const;
61 64
62 private: 65 private:
63 syncer::DataTypeErrorHandler* error_handler_; // Guaranteed to outlive us. 66 std::unique_ptr<syncer::DataTypeErrorHandler> error_handler_;
64 67
65 // The sync model we are processing changes from. 68 // The sync model we are processing changes from.
66 syncer::UserShare* share_handle_; 69 syncer::UserShare* share_handle_;
67 70
68 DISALLOW_COPY_AND_ASSIGN(ChangeProcessor); 71 DISALLOW_COPY_AND_ASSIGN(ChangeProcessor);
69 }; 72 };
70 73
71 } // namespace sync_driver 74 } // namespace sync_driver
72 75
73 #endif // COMPONENTS_SYNC_DRIVER_CHANGE_PROCESSOR_H_ 76 #endif // COMPONENTS_SYNC_DRIVER_CHANGE_PROCESSOR_H_
OLDNEW
« no previous file with comments | « components/sync/device_info/device_info_service_unittest.cc ('k') | components/sync/driver/change_processor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698