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

Side by Side Diff: sync/engine/process_commit_response_command.cc

Issue 10916174: Implement a bag of chips for sync. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Follow review Created 8 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "sync/engine/process_commit_response_command.h" 5 #include "sync/engine/process_commit_response_command.h"
6 6
7 #include <cstddef> 7 #include <cstddef>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 const sessions::OrderedCommitSet& commit_set, 55 const sessions::OrderedCommitSet& commit_set,
56 const sync_pb::ClientToServerMessage& commit_message, 56 const sync_pb::ClientToServerMessage& commit_message,
57 const sync_pb::ClientToServerResponse& commit_response) 57 const sync_pb::ClientToServerResponse& commit_response)
58 : commit_set_(commit_set), 58 : commit_set_(commit_set),
59 commit_message_(commit_message), 59 commit_message_(commit_message),
60 commit_response_(commit_response) { 60 commit_response_(commit_response) {
61 } 61 }
62 62
63 ProcessCommitResponseCommand::~ProcessCommitResponseCommand() {} 63 ProcessCommitResponseCommand::~ProcessCommitResponseCommand() {}
64 64
65 SyncerError ProcessCommitResponseCommand::ExecuteImpl(SyncSession* session) {
tim (not reviewing) 2012/09/10 17:52:55 mm, I understand how you got here, but lets not ov
66 syncable::Directory* dir = session->context()->directory();
67 const sync_pb::ClientToServerResponse& response =
68 session->status_controller().updates_response();
69
70 // Persist a bag of chips if it has been sent by the server.
71 SyncerProtoUtil::PersistBagOfChips(dir, response);
72
73 return ModelChangingSyncerCommand::ExecuteImpl(session);
74 }
75
65 std::set<ModelSafeGroup> ProcessCommitResponseCommand::GetGroupsToChange( 76 std::set<ModelSafeGroup> ProcessCommitResponseCommand::GetGroupsToChange(
66 const sessions::SyncSession& session) const { 77 const sessions::SyncSession& session) const {
67 std::set<ModelSafeGroup> groups_with_commits; 78 std::set<ModelSafeGroup> groups_with_commits;
68 79
69 syncable::Directory* dir = session.context()->directory(); 80 syncable::Directory* dir = session.context()->directory();
70 syncable::ReadTransaction trans(FROM_HERE, dir); 81 syncable::ReadTransaction trans(FROM_HERE, dir);
71 for (size_t i = 0; i < commit_set_.Size(); ++i) { 82 for (size_t i = 0; i < commit_set_.Size(); ++i) {
72 groups_with_commits.insert( 83 groups_with_commits.insert(
73 GetGroupForModelType(commit_set_.GetModelTypeAt(i), 84 GetGroupForModelType(commit_set_.GetModelTypeAt(i),
74 session.routing_info())); 85 session.routing_info()));
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 // been recursively deleted. 483 // been recursively deleted.
473 // TODO(nick): Here, commit_message.deleted() would be more correct than 484 // TODO(nick): Here, commit_message.deleted() would be more correct than
474 // local_entry->Get(IS_DEL). For example, an item could be renamed, and then 485 // local_entry->Get(IS_DEL). For example, an item could be renamed, and then
475 // deleted during the commit of the rename. Unit test & fix. 486 // deleted during the commit of the rename. Unit test & fix.
476 if (local_entry->Get(IS_DIR) && local_entry->Get(IS_DEL)) { 487 if (local_entry->Get(IS_DIR) && local_entry->Get(IS_DEL)) {
477 deleted_folders->insert(local_entry->Get(ID)); 488 deleted_folders->insert(local_entry->Get(ID));
478 } 489 }
479 } 490 }
480 491
481 } // namespace syncer 492 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/engine/process_commit_response_command.h ('k') | sync/engine/process_commit_response_command_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698