12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- // Copyright 2018 The Chromium Authors. All rights reserved.
- // Use of this source code is governed by a BSD-style license that can be
- // found in the LICENSE file.
- #ifndef COMPONENTS_SYNC_DRIVER_NON_UI_SYNCABLE_SERVICE_BASED_MODEL_TYPE_CONTROLLER_H_
- #define COMPONENTS_SYNC_DRIVER_NON_UI_SYNCABLE_SERVICE_BASED_MODEL_TYPE_CONTROLLER_H_
- #include "base/callback_forward.h"
- #include "base/memory/scoped_refptr.h"
- #include "base/memory/weak_ptr.h"
- #include "base/task/sequenced_task_runner.h"
- #include "components/sync/base/model_type.h"
- #include "components/sync/driver/model_type_controller.h"
- #include "components/sync/model/model_type_store.h"
- namespace syncer {
- class SyncableService;
- // Controller responsible for integrating legacy data type implementations
- // (SyncableService) within the new sync architecture (USS), for types living
- // outside the UI thread.
- // This requires interacting with the SyncableService in a model thread that is
- // not the UI thread, including the construction and destruction of objects
- // (most notably SyncableServiceBasedBridge) in the model thread as specified
- // in the constructor.
- class NonUiSyncableServiceBasedModelTypeController
- : public ModelTypeController {
- public:
- using SyncableServiceProvider =
- base::OnceCallback<base::WeakPtr<syncer::SyncableService>()>;
- // |syncable_service_provider| and |store_factory| will be run on the backend
- // sequence, i.e. |task_runner|.
- // |allow_transport_mode| will sync the data in both full-sync mode and in
- // transport-only mode.
- NonUiSyncableServiceBasedModelTypeController(
- ModelType type,
- OnceModelTypeStoreFactory store_factory,
- SyncableServiceProvider syncable_service_provider,
- const base::RepeatingClosure& dump_stack,
- scoped_refptr<base::SequencedTaskRunner> task_runner,
- bool allow_transport_mode = false);
- NonUiSyncableServiceBasedModelTypeController(
- const NonUiSyncableServiceBasedModelTypeController&) = delete;
- NonUiSyncableServiceBasedModelTypeController& operator=(
- const NonUiSyncableServiceBasedModelTypeController&) = delete;
- ~NonUiSyncableServiceBasedModelTypeController() override;
- };
- } // namespace syncer
- #endif // COMPONENTS_SYNC_DRIVER_NON_UI_SYNCABLE_SERVICE_BASED_MODEL_TYPE_CONTROLLER_H_
|