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

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

Issue 2672493002: [Sync] Switch bots to run integ tests for autofill as USS. (Closed)
Patch Set: Updated for Gang's comment. Created 3 years, 10 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_MODEL_TYPE_CONTROLLER_H_ 5 #ifndef COMPONENTS_SYNC_DRIVER_MODEL_TYPE_CONTROLLER_H_
6 #define COMPONENTS_SYNC_DRIVER_MODEL_TYPE_CONTROLLER_H_ 6 #define COMPONENTS_SYNC_DRIVER_MODEL_TYPE_CONTROLLER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
11 #include "base/callback.h"
11 #include "base/macros.h" 12 #include "base/macros.h"
12 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
13 #include "base/single_thread_task_runner.h" 14 #include "base/single_thread_task_runner.h"
14 #include "components/sync/base/model_type.h" 15 #include "components/sync/base/model_type.h"
15 #include "components/sync/base/sync_prefs.h" 16 #include "components/sync/base/sync_prefs.h"
16 #include "components/sync/driver/data_type_controller.h" 17 #include "components/sync/driver/data_type_controller.h"
17 #include "components/sync/model/model_error.h" 18 #include "components/sync/model/model_error.h"
18 #include "components/sync/model/sync_error.h" 19 #include "components/sync/model/sync_error.h"
19 20
20 namespace syncer { 21 namespace syncer {
21 22
23 class ModelTypeSyncBridge;
22 class SyncClient; 24 class SyncClient;
23 struct ActivationContext; 25 struct ActivationContext;
24 26
25 // DataTypeController implementation for Unified Sync and Storage model types. 27 // DataTypeController implementation for Unified Sync and Storage model types.
26 class ModelTypeController : public DataTypeController { 28 class ModelTypeController : public DataTypeController {
27 public: 29 public:
30 using BridgeProvider = base::Callback<base::WeakPtr<ModelTypeSyncBridge>()>;
31 using BridgeTask = base::Callback<void(ModelTypeSyncBridge*)>;
32
28 ModelTypeController( 33 ModelTypeController(
29 ModelType type, 34 ModelType type,
30 SyncClient* sync_client, 35 SyncClient* sync_client,
31 const scoped_refptr<base::SingleThreadTaskRunner>& model_thread); 36 const scoped_refptr<base::SingleThreadTaskRunner>& model_thread);
32 ~ModelTypeController() override; 37 ~ModelTypeController() override;
33 38
34 // DataTypeController implementation. 39 // DataTypeController implementation.
35 bool ShouldLoadModelBeforeConfigure() const override; 40 bool ShouldLoadModelBeforeConfigure() const override;
36 void BeforeLoadModels(ModelTypeConfigurer* configurer) override; 41 void BeforeLoadModels(ModelTypeConfigurer* configurer) override;
37 void LoadModels(const ModelLoadCallback& model_load_callback) override; 42 void LoadModels(const ModelLoadCallback& model_load_callback) override;
(...skipping 16 matching lines...) Expand all
54 // are loaded this function should be called to let the base class 59 // are loaded this function should be called to let the base class
55 // implementation know that it is safe to continue with the activation. 60 // implementation know that it is safe to continue with the activation.
56 // The error indicates whether the loading completed successfully. 61 // The error indicates whether the loading completed successfully.
57 void LoadModelsDone(ConfigureResult result, const SyncError& error); 62 void LoadModelsDone(ConfigureResult result, const SyncError& error);
58 63
59 // The function will do the real work when OnProcessorStarted got called. This 64 // The function will do the real work when OnProcessorStarted got called. This
60 // is called on the UI thread. 65 // is called on the UI thread.
61 void OnProcessorStarted( 66 void OnProcessorStarted(
62 std::unique_ptr<ActivationContext> activation_context); 67 std::unique_ptr<ActivationContext> activation_context);
63 68
69 // Bridge accessor that can be overridden. This will be called on the UI
70 // thread, but the callback will only be run on the model thread.
71 virtual BridgeProvider GetBridgeProvider();
72
73 // Post the given task that requires the bridge object to run to the model
74 // thread, where the bridge lives.
75 void PostBridgeTask(const tracked_objects::Location& location,
76 const BridgeTask& task);
77
64 // The sync client, which provides access to this type's ModelTypeSyncBridge. 78 // The sync client, which provides access to this type's ModelTypeSyncBridge.
65 SyncClient* const sync_client_; 79 SyncClient* const sync_client_;
66 80
67 // The thread the model type lives on. 81 // The thread the model type lives on.
68 scoped_refptr<base::SingleThreadTaskRunner> model_thread_; 82 scoped_refptr<base::SingleThreadTaskRunner> model_thread_;
69 83
70 // Sync prefs. Used for determinig if DisableSync should be called during call 84 // Sync prefs. Used for determinig if DisableSync should be called during call
71 // to Stop(). 85 // to Stop().
72 SyncPrefs sync_prefs_; 86 SyncPrefs sync_prefs_;
73 87
(...skipping 12 matching lines...) Expand all
86 // something the first time after the type is enabled. 100 // something the first time after the type is enabled.
87 // TODO(crbug.com/647505): Remove this once the DTM handles things better. 101 // TODO(crbug.com/647505): Remove this once the DTM handles things better.
88 bool activated_ = false; 102 bool activated_ = false;
89 103
90 DISALLOW_COPY_AND_ASSIGN(ModelTypeController); 104 DISALLOW_COPY_AND_ASSIGN(ModelTypeController);
91 }; 105 };
92 106
93 } // namespace syncer 107 } // namespace syncer
94 108
95 #endif // COMPONENTS_SYNC_DRIVER_MODEL_TYPE_CONTROLLER_H_ 109 #endif // COMPONENTS_SYNC_DRIVER_MODEL_TYPE_CONTROLLER_H_
OLDNEW
« no previous file with comments | « components/browser_sync/profile_sync_components_factory_impl.cc ('k') | components/sync/driver/model_type_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698