Chromium Code Reviews| Index: sync/engine/process_commit_response_command.h |
| diff --git a/sync/engine/process_commit_response_command.h b/sync/engine/process_commit_response_command.h |
| index 8e288de853e29009ff800dda0bf978b084ed1b50..39d622f42c41aa224837b40f1e65806d9de4d9d7 100644 |
| --- a/sync/engine/process_commit_response_command.h |
| +++ b/sync/engine/process_commit_response_command.h |
| @@ -18,14 +18,52 @@ namespace syncable { |
| class Id; |
| class WriteTransaction; |
| class MutableEntry; |
| +class Directory; |
| } |
| namespace browser_sync { |
| +namespace sessions { |
| +class OrderedCommitSet; |
| +} |
| + |
| +// A class that processes the server's response to our commmit attempt. Note |
| +// that some of the preliminary processing is performed in |
| +// PostClientToServerMessage command. |
| +// |
| +// As part of processing the commit response, this command will modify sync |
| +// entries. It can rename items, update their versions, etc. |
| +// |
| +// This command will return a non-SYNCER_OK value if an error occurred while |
| +// processing the response, or if the server's response indicates that it had |
| +// trouble processing the request. |
| +// |
| +// This class, like all SyncerCommands, has a lot more in common with a function |
|
tim (not reviewing)
2012/05/15 22:25:00
Same as with GetCommitIdsCommand. In Chrome code
|
| +// than a class. It expects to be instantiated, have its ExecuteImpl() function |
| +// called, then be destroyed. |
| class ProcessCommitResponseCommand : public ModelChangingSyncerCommand { |
| public: |
| - ProcessCommitResponseCommand(); |
| + // Because it must conform to the interface defined in SyncerCommand, this |
| + // class's ExecuteImpl() function can't receive input parameters or output any |
| + // return values other than a SyncerError. To work around this limitation, we |
| + // pass in parameters to the constructor and save them for use when |
| + // ExecuteImpl() is eventually called. There will be one ExecuteImpl() call |
| + // per instantiation. |
| + // |
| + // The commit_set parameter contains references to all the items which were |
| + // to be committed in this batch. |
| + // |
| + // The commmit_message parameter contains the message that was sent to the |
| + // server. |
| + // |
| + // The commit_response parameter contains the response received from the |
| + // server. This may be uninitialized if we were unable to contact the server |
| + // or a serious error was encountered. |
| + ProcessCommitResponseCommand( |
| + const sessions::OrderedCommitSet& commit_set, |
| + const ClientToServerMessage& commit_message, |
| + const ClientToServerResponse& commit_response); |
| virtual ~ProcessCommitResponseCommand(); |
| protected: |
| @@ -43,7 +81,6 @@ class ProcessCommitResponseCommand : public ModelChangingSyncerCommand { |
| const sync_pb::CommitResponse_EntryResponse& pb_commit_response, |
| const sync_pb::SyncEntity& pb_committed_entry, |
| const syncable::Id& pre_commit_id, |
| - std::set<syncable::Id>* conflicting_new_directory_ids, |
| std::set<syncable::Id>* deleted_folders); |
| // Actually does the work of execute. |
| @@ -93,6 +130,15 @@ class ProcessCommitResponseCommand : public ModelChangingSyncerCommand { |
| const sync_pb::SyncEntity& committed_entry, |
| const CommitResponse_EntryResponse& entry_response); |
| + // Helper to clean up in case of failure. |
| + void ClearSyncingBits( |
| + syncable::Directory *dir, |
| + const std::vector<syncable::Id>& commit_ids); |
| + |
| + const sessions::OrderedCommitSet& commit_set_; |
| + const ClientToServerMessage& commit_message_; |
| + const ClientToServerResponse& commit_response_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(ProcessCommitResponseCommand); |
| }; |