| Index: sync/engine/process_commit_response_command.cc
|
| diff --git a/sync/engine/process_commit_response_command.cc b/sync/engine/process_commit_response_command.cc
|
| index 97f403f795f7f8750e0b77625cb489ee8b120135..1cb06bd4ae160ff82b7a5aa08302af78924c2bd5 100644
|
| --- a/sync/engine/process_commit_response_command.cc
|
| +++ b/sync/engine/process_commit_response_command.cc
|
| @@ -30,7 +30,6 @@ using sync_pb::CommitResponse;
|
|
|
| namespace syncer {
|
|
|
| -using sessions::OrderedCommitSet;
|
| using sessions::StatusController;
|
| using sessions::SyncSession;
|
| using syncable::ModelNeutralWriteTransaction;
|
| @@ -51,93 +50,6 @@ using syncable::SERVER_VERSION;
|
| using syncable::SYNCER;
|
| using syncable::SYNCING;
|
|
|
| -ProcessCommitResponseCommand::ProcessCommitResponseCommand(
|
| - const sessions::OrderedCommitSet& commit_set,
|
| - const sync_pb::ClientToServerMessage& commit_message,
|
| - const sync_pb::ClientToServerResponse& commit_response)
|
| - : commit_set_(commit_set),
|
| - commit_message_(commit_message),
|
| - commit_response_(commit_response) {
|
| -}
|
| -
|
| -ProcessCommitResponseCommand::~ProcessCommitResponseCommand() {}
|
| -
|
| -SyncerError ProcessCommitResponseCommand::ExecuteImpl(SyncSession* session) {
|
| - syncable::Directory* dir = session->context()->directory();
|
| - StatusController* status = session->mutable_status_controller();
|
| - const CommitResponse& cr = commit_response_.commit();
|
| - const sync_pb::CommitMessage& commit_message = commit_message_.commit();
|
| -
|
| - int transient_error_commits = 0;
|
| - int conflicting_commits = 0;
|
| - int error_commits = 0;
|
| - int successes = 0;
|
| -
|
| - set<syncable::Id> deleted_folders;
|
| -
|
| - { // Scope for ModelNeutralWriteTransaction.
|
| - ModelNeutralWriteTransaction trans(FROM_HERE, SYNCER, dir);
|
| - for (size_t i = 0; i < commit_set_.Size(); i++) {
|
| - CommitResponse::ResponseType response_type = ProcessSingleCommitResponse(
|
| - &trans,
|
| - cr.entryresponse(i),
|
| - commit_message.entries(i),
|
| - commit_set_.GetCommitHandleAt(i),
|
| - &deleted_folders);
|
| - switch (response_type) {
|
| - case CommitResponse::INVALID_MESSAGE:
|
| - ++error_commits;
|
| - break;
|
| - case CommitResponse::CONFLICT:
|
| - ++conflicting_commits;
|
| - status->increment_num_server_conflicts();
|
| - break;
|
| - case CommitResponse::SUCCESS:
|
| - // TODO(sync): worry about sync_rate_ rate calc?
|
| - ++successes;
|
| - if (commit_set_.GetModelTypeAt(i) == BOOKMARKS)
|
| - status->increment_num_successful_bookmark_commits();
|
| - status->increment_num_successful_commits();
|
| - break;
|
| - case CommitResponse::OVER_QUOTA:
|
| - // We handle over quota like a retry, which is same as transient.
|
| - case CommitResponse::RETRY:
|
| - case CommitResponse::TRANSIENT_ERROR:
|
| - ++transient_error_commits;
|
| - break;
|
| - default:
|
| - LOG(FATAL) << "Bad return from ProcessSingleCommitResponse";
|
| - }
|
| - }
|
| -
|
| - MarkDeletedChildrenSynced(dir, &trans, &deleted_folders);
|
| - }
|
| -
|
| - int commit_count = static_cast<int>(commit_set_.Size());
|
| - if (commit_count == successes) {
|
| - return SYNCER_OK;
|
| - } else if (error_commits > 0) {
|
| - return SERVER_RETURN_UNKNOWN_ERROR;
|
| - } else if (transient_error_commits > 0) {
|
| - return SERVER_RETURN_TRANSIENT_ERROR;
|
| - } else if (conflicting_commits > 0) {
|
| - // This means that the server already has an item with this version, but
|
| - // we haven't seen that update yet.
|
| - //
|
| - // A well-behaved client should respond to this by proceeding to the
|
| - // download updates phase, fetching the conflicting items, then attempting
|
| - // to resolve the conflict. That's not what this client does.
|
| - //
|
| - // We don't currently have any code to support that exceptional control
|
| - // flow. Instead, we abort the current sync cycle and start a new one. The
|
| - // end result is the same.
|
| - return SERVER_RETURN_CONFLICT;
|
| - } else {
|
| - LOG(FATAL) << "Inconsistent counts when processing commit response";
|
| - return SYNCER_OK;
|
| - }
|
| -}
|
| -
|
| void LogServerError(const sync_pb::CommitResponse_EntryResponse& res) {
|
| if (res.has_error_message())
|
| LOG(WARNING) << " " << res.error_message();
|
|
|