| OLD | NEW |
| 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_ENGINE_IMPL_COMMIT_CONTRIBUTION_H_ | 5 #ifndef COMPONENTS_SYNC_ENGINE_IMPL_COMMIT_CONTRIBUTION_H_ |
| 6 #define COMPONENTS_SYNC_ENGINE_IMPL_COMMIT_CONTRIBUTION_H_ | 6 #define COMPONENTS_SYNC_ENGINE_IMPL_COMMIT_CONTRIBUTION_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include "components/sync/base/syncer_error.h" | 10 #include "components/sync/base/syncer_error.h" |
| 11 #include "components/sync/engine_impl/cycle/status_controller.h" |
| 11 #include "components/sync/protocol/sync.pb.h" | 12 #include "components/sync/protocol/sync.pb.h" |
| 12 #include "components/sync/sessions_impl/status_controller.h" | |
| 13 | 13 |
| 14 namespace syncer { | 14 namespace syncer { |
| 15 | 15 |
| 16 namespace sessions { | |
| 17 class StatusController; | 16 class StatusController; |
| 18 } // namespace sessions | |
| 19 | 17 |
| 20 // This class represents a set of items belonging to a particular data type that | 18 // This class represents a set of items belonging to a particular data type that |
| 21 // have been selected from a CommitContributor and prepared for commit. | 19 // have been selected from a CommitContributor and prepared for commit. |
| 22 // | 20 // |
| 23 // This class handles the bookkeeping related to the commit of these items. | 21 // This class handles the bookkeeping related to the commit of these items. |
| 24 class CommitContribution { | 22 class CommitContribution { |
| 25 public: | 23 public: |
| 26 CommitContribution(); | 24 CommitContribution(); |
| 27 virtual ~CommitContribution() = 0; | 25 virtual ~CommitContribution() = 0; |
| 28 | 26 |
| 29 // Serialize this contribution's entries to the given commit request |msg|. | 27 // Serialize this contribution's entries to the given commit request |msg|. |
| 30 // | 28 // |
| 31 // This function is not const. It may update some state in this contribution | 29 // This function is not const. It may update some state in this contribution |
| 32 // that will be used when processing the associated commit response. This | 30 // that will be used when processing the associated commit response. This |
| 33 // function should not be called more than once. | 31 // function should not be called more than once. |
| 34 virtual void AddToCommitMessage(sync_pb::ClientToServerMessage* msg) = 0; | 32 virtual void AddToCommitMessage(sync_pb::ClientToServerMessage* msg) = 0; |
| 35 | 33 |
| 36 // Updates this contribution's contents in accordance with the provided | 34 // Updates this contribution's contents in accordance with the provided |
| 37 // |response|. | 35 // |response|. |
| 38 // | 36 // |
| 39 // It is not valid to call this function unless AddToCommitMessage() was | 37 // It is not valid to call this function unless AddToCommitMessage() was |
| 40 // called earlier. This function should not be called more than once. | 38 // called earlier. This function should not be called more than once. |
| 41 virtual SyncerError ProcessCommitResponse( | 39 virtual SyncerError ProcessCommitResponse( |
| 42 const sync_pb::ClientToServerResponse& response, | 40 const sync_pb::ClientToServerResponse& response, |
| 43 sessions::StatusController* status) = 0; | 41 StatusController* status) = 0; |
| 44 | 42 |
| 45 // Cleans up any temproary state associated with the commit. Must be called | 43 // Cleans up any temproary state associated with the commit. Must be called |
| 46 // before destruction. | 44 // before destruction. |
| 47 virtual void CleanUp() = 0; | 45 virtual void CleanUp() = 0; |
| 48 | 46 |
| 49 // Returns the number of entries included in this contribution. | 47 // Returns the number of entries included in this contribution. |
| 50 virtual size_t GetNumEntries() const = 0; | 48 virtual size_t GetNumEntries() const = 0; |
| 51 }; | 49 }; |
| 52 | 50 |
| 53 } // namespace syncer | 51 } // namespace syncer |
| 54 | 52 |
| 55 #endif // COMPONENTS_SYNC_ENGINE_IMPL_COMMIT_CONTRIBUTION_H_ | 53 #endif // COMPONENTS_SYNC_ENGINE_IMPL_COMMIT_CONTRIBUTION_H_ |
| OLD | NEW |