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

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

Issue 10038041: sync: Loop committing items without downloading updates (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 #ifndef SYNC_ENGINE_PROCESS_COMMIT_RESPONSE_COMMAND_H_ 5 #ifndef SYNC_ENGINE_PROCESS_COMMIT_RESPONSE_COMMAND_H_
6 #define SYNC_ENGINE_PROCESS_COMMIT_RESPONSE_COMMAND_H_ 6 #define SYNC_ENGINE_PROCESS_COMMIT_RESPONSE_COMMAND_H_
7 #pragma once 7 #pragma once
8 8
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "sync/engine/model_changing_syncer_command.h" 14 #include "sync/engine/model_changing_syncer_command.h"
15 #include "sync/engine/syncproto.h" 15 #include "sync/engine/syncproto.h"
16 16
17 namespace syncable { 17 namespace syncable {
18 class Id; 18 class Id;
19 class WriteTransaction; 19 class WriteTransaction;
20 class MutableEntry; 20 class MutableEntry;
21 class Directory;
21 } 22 }
22 23
23 namespace browser_sync { 24 namespace browser_sync {
24 25
26 namespace sessions {
27 class OrderedCommitSet;
28 }
29
25 class ProcessCommitResponseCommand : public ModelChangingSyncerCommand { 30 class ProcessCommitResponseCommand : public ModelChangingSyncerCommand {
26 public: 31 public:
27 32
28 ProcessCommitResponseCommand(); 33 ProcessCommitResponseCommand(
34 const sessions::OrderedCommitSet& commit_set,
35 const ClientToServerMessage& commit_message,
36 const ClientToServerResponse& commit_response);
29 virtual ~ProcessCommitResponseCommand(); 37 virtual ~ProcessCommitResponseCommand();
30 38
31 protected: 39 protected:
32 // ModelChangingSyncerCommand implementation. 40 // ModelChangingSyncerCommand implementation.
33 virtual std::set<ModelSafeGroup> GetGroupsToChange( 41 virtual std::set<ModelSafeGroup> GetGroupsToChange(
34 const sessions::SyncSession& session) const OVERRIDE; 42 const sessions::SyncSession& session) const OVERRIDE;
35 virtual SyncerError ModelNeutralExecuteImpl( 43 virtual SyncerError ModelNeutralExecuteImpl(
36 sessions::SyncSession* session) OVERRIDE; 44 sessions::SyncSession* session) OVERRIDE;
37 virtual SyncerError ModelChangingExecuteImpl( 45 virtual SyncerError ModelChangingExecuteImpl(
38 sessions::SyncSession* session) OVERRIDE; 46 sessions::SyncSession* session) OVERRIDE;
39 47
40 private: 48 private:
41 CommitResponse::ResponseType ProcessSingleCommitResponse( 49 CommitResponse::ResponseType ProcessSingleCommitResponse(
42 syncable::WriteTransaction* trans, 50 syncable::WriteTransaction* trans,
43 const sync_pb::CommitResponse_EntryResponse& pb_commit_response, 51 const sync_pb::CommitResponse_EntryResponse& pb_commit_response,
44 const sync_pb::SyncEntity& pb_committed_entry, 52 const sync_pb::SyncEntity& pb_committed_entry,
45 const syncable::Id& pre_commit_id, 53 const syncable::Id& pre_commit_id,
46 std::set<syncable::Id>* conflicting_new_directory_ids,
47 std::set<syncable::Id>* deleted_folders); 54 std::set<syncable::Id>* deleted_folders);
48 55
49 // Actually does the work of execute. 56 // Actually does the work of execute.
50 SyncerError ProcessCommitResponse(sessions::SyncSession* session); 57 SyncerError ProcessCommitResponse(sessions::SyncSession* session);
51 58
52 void ProcessSuccessfulCommitResponse( 59 void ProcessSuccessfulCommitResponse(
53 const sync_pb::SyncEntity& committed_entry, 60 const sync_pb::SyncEntity& committed_entry,
54 const CommitResponse_EntryResponse& entry_response, 61 const CommitResponse_EntryResponse& entry_response,
55 const syncable::Id& pre_commit_id, syncable::MutableEntry* local_entry, 62 const syncable::Id& pre_commit_id, syncable::MutableEntry* local_entry,
56 bool syncing_was_set, std::set<syncable::Id>* deleted_folders); 63 bool syncing_was_set, std::set<syncable::Id>* deleted_folders);
(...skipping 29 matching lines...) Expand all
86 void OverrideClientFieldsAfterCommit( 93 void OverrideClientFieldsAfterCommit(
87 const sync_pb::SyncEntity& committed_entry, 94 const sync_pb::SyncEntity& committed_entry,
88 const CommitResponse_EntryResponse& entry_response, 95 const CommitResponse_EntryResponse& entry_response,
89 syncable::MutableEntry* local_entry); 96 syncable::MutableEntry* local_entry);
90 97
91 // Helper to extract the final name from the protobufs. 98 // Helper to extract the final name from the protobufs.
92 const std::string& GetResultingPostCommitName( 99 const std::string& GetResultingPostCommitName(
93 const sync_pb::SyncEntity& committed_entry, 100 const sync_pb::SyncEntity& committed_entry,
94 const CommitResponse_EntryResponse& entry_response); 101 const CommitResponse_EntryResponse& entry_response);
95 102
103 // Helper to clean up in case of failure.
104 void ClearSyncingBits(
105 syncable::Directory *dir,
106 const std::vector<syncable::Id>& commit_ids);
107
108 const sessions::OrderedCommitSet& commit_set_;
109 const ClientToServerMessage& commit_message_;
110 const ClientToServerResponse& commit_response_;
111
96 DISALLOW_COPY_AND_ASSIGN(ProcessCommitResponseCommand); 112 DISALLOW_COPY_AND_ASSIGN(ProcessCommitResponseCommand);
97 }; 113 };
98 114
99 } // namespace browser_sync 115 } // namespace browser_sync
100 116
101 #endif // SYNC_ENGINE_PROCESS_COMMIT_RESPONSE_COMMAND_H_ 117 #endif // SYNC_ENGINE_PROCESS_COMMIT_RESPONSE_COMMAND_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698