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