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

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

Issue 194065: Initial commit of sync engine code to browser/sync.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Fixes to gtest include path, reverted syncapi. Created 11 years, 3 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
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2006-2009 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 "chrome/browser/sync/engine/syncer_proto_util.h"
10 #include "chrome/browser/sync/engine/syncer_session.h"
11 #include "chrome/browser/sync/engine/syncproto.h"
12 #include "chrome/browser/sync/syncable/directory_manager.h"
13 #include "chrome/browser/sync/util/sync_types.h"
14
15 using std::vector;
16
17 namespace browser_sync {
18
19 PostCommitMessageCommand::PostCommitMessageCommand() {}
20 PostCommitMessageCommand::~PostCommitMessageCommand() {}
21
22 void PostCommitMessageCommand::ExecuteImpl(SyncerSession *session) {
idana 2009/09/10 05:44:37 "SyncerSession *session" -> "SyncerSession* sessio
23 if (session->commit_ids_empty())
24 return; // nothing to commit
25 ClientToServerResponse response;
26 syncable::ScopedDirLookup dir(session->dirman(), session->account_name());
27 if (!dir.good())
28 return;
29 if (!SyncerProtoUtil::PostClientToServerMessage(session->commit_message(),
30 &response, session)) {
31 // None of our changes got through, let's clear sync flags and wait for
32 // another list update.
33 SyncerStatus status(session);
34 status.increment_consecutive_problem_commits();
35 status.increment_consecutive_errors();
36 syncable::WriteTransaction trans(dir, syncable::SYNCER, __FILE__, __LINE__);
37 // TODO(sync): why set this flag, it seems like a bad side-effect?
38 const vector<syncable::Id>& commit_ids = session->commit_ids();
39 for (size_t i = 0; i < commit_ids.size(); i++) {
40 syncable::MutableEntry entry(&trans, syncable::GET_BY_ID, commit_ids[i]);
41 entry.Put(syncable::SYNCING, false);
42 }
43 return;
44 } else {
45 session->set_item_committed();
46 }
47 session->set_commit_response(response);
48 }
49
50 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698