model_type_processor_proxy.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // Copyright 2016 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. #ifndef COMPONENTS_SYNC_ENGINE_MODEL_TYPE_PROCESSOR_PROXY_H_
  5. #define COMPONENTS_SYNC_ENGINE_MODEL_TYPE_PROCESSOR_PROXY_H_
  6. #include <memory>
  7. #include "base/memory/ref_counted.h"
  8. #include "base/memory/weak_ptr.h"
  9. #include "base/task/sequenced_task_runner.h"
  10. #include "components/sync/engine/model_type_processor.h"
  11. namespace syncer {
  12. class ModelTypeProcessorProxy : public ModelTypeProcessor {
  13. public:
  14. ModelTypeProcessorProxy(
  15. const base::WeakPtr<ModelTypeProcessor>& processor,
  16. const scoped_refptr<base::SequencedTaskRunner>& task_runner);
  17. ~ModelTypeProcessorProxy() override;
  18. void ConnectSync(std::unique_ptr<CommitQueue> worker) override;
  19. void DisconnectSync() override;
  20. void GetLocalChanges(size_t max_entries,
  21. GetLocalChangesCallback callback) override;
  22. void OnCommitCompleted(
  23. const sync_pb::ModelTypeState& type_state,
  24. const CommitResponseDataList& committed_response_list,
  25. const FailedCommitResponseDataList& error_response_list) override;
  26. void OnCommitFailed(SyncCommitError commit_error) override;
  27. void OnUpdateReceived(const sync_pb::ModelTypeState& type_state,
  28. UpdateResponseDataList updates) override;
  29. private:
  30. base::WeakPtr<ModelTypeProcessor> processor_;
  31. scoped_refptr<base::SequencedTaskRunner> task_runner_;
  32. };
  33. } // namespace syncer
  34. #endif // COMPONENTS_SYNC_ENGINE_MODEL_TYPE_PROCESSOR_PROXY_H_