Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(213)

Side by Side Diff: chrome/browser/sync/engine/post_commit_message_command.cc

Issue 9699057: [Sync] Move 'sync' target to sync/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address Tim's comments Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 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 #include "chrome/browser/sync/engine/post_commit_message_command.h"
6
7 #include <vector>
8
9 #include "base/location.h"
10 #include "chrome/browser/sync/engine/syncer_proto_util.h"
11 #include "chrome/browser/sync/engine/syncproto.h"
12 #include "chrome/browser/sync/sessions/sync_session.h"
13
14 using std::vector;
15
16 namespace browser_sync {
17
18 PostCommitMessageCommand::PostCommitMessageCommand() {}
19 PostCommitMessageCommand::~PostCommitMessageCommand() {}
20
21 SyncerError PostCommitMessageCommand::ExecuteImpl(
22 sessions::SyncSession* session) {
23 if (session->status_controller().commit_ids().empty())
24 return SYNCER_OK; // Nothing to commit.
25 ClientToServerResponse response;
26 syncable::Directory* dir = session->context()->directory();
27 sessions::StatusController* status = session->mutable_status_controller();
28 SyncerError result = SyncerProtoUtil::PostClientToServerMessage(
29 status->commit_message(), &response, session);
30 if (result != SYNCER_OK) {
31 // None of our changes got through. Clear the SYNCING bit which was
32 // set to true during BuildCommitCommand, and which may still be true.
33 // Not to be confused with IS_UNSYNCED, this bit is used to detect local
34 // changes to items that happen during the server Commit operation.
35 syncable::WriteTransaction trans(FROM_HERE, syncable::SYNCER, dir);
36 const vector<syncable::Id>& commit_ids = status->commit_ids();
37 for (size_t i = 0; i < commit_ids.size(); i++) {
38 syncable::MutableEntry entry(&trans, syncable::GET_BY_ID, commit_ids[i]);
39 entry.Put(syncable::SYNCING, false);
40 }
41 return result;
42 }
43
44 status->set_items_committed();
45 status->mutable_commit_response()->CopyFrom(response);
46 return SYNCER_OK;
47 }
48
49 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/engine/post_commit_message_command.h ('k') | chrome/browser/sync/engine/process_commit_response_command.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698