forwarding_model_type_processor.cc 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // Copyright 2019 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. #include "components/sync/engine/forwarding_model_type_processor.h"
  5. #include <utility>
  6. #include "base/callback.h"
  7. #include "components/sync/engine/commit_queue.h"
  8. namespace syncer {
  9. ForwardingModelTypeProcessor::ForwardingModelTypeProcessor(
  10. ModelTypeProcessor* processor)
  11. : processor_(processor) {
  12. DCHECK(processor_);
  13. }
  14. ForwardingModelTypeProcessor::~ForwardingModelTypeProcessor() = default;
  15. void ForwardingModelTypeProcessor::ConnectSync(
  16. std::unique_ptr<CommitQueue> worker) {
  17. processor_->ConnectSync(std::move(worker));
  18. }
  19. void ForwardingModelTypeProcessor::DisconnectSync() {
  20. processor_->DisconnectSync();
  21. }
  22. void ForwardingModelTypeProcessor::GetLocalChanges(
  23. size_t max_entries,
  24. GetLocalChangesCallback callback) {
  25. processor_->GetLocalChanges(max_entries, std::move(callback));
  26. }
  27. void ForwardingModelTypeProcessor::OnCommitCompleted(
  28. const sync_pb::ModelTypeState& type_state,
  29. const CommitResponseDataList& committed_response_list,
  30. const FailedCommitResponseDataList& error_response_list) {
  31. processor_->OnCommitCompleted(type_state, committed_response_list,
  32. error_response_list);
  33. }
  34. void ForwardingModelTypeProcessor::OnCommitFailed(
  35. SyncCommitError commit_error) {
  36. processor_->OnCommitFailed(commit_error);
  37. }
  38. void ForwardingModelTypeProcessor::OnUpdateReceived(
  39. const sync_pb::ModelTypeState& type_state,
  40. UpdateResponseDataList updates) {
  41. processor_->OnUpdateReceived(type_state, std::move(updates));
  42. }
  43. } // namespace syncer