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

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

Issue 10735041: Remove syncproto.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address most comments Created 8 years, 5 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 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "sync/engine/model_changing_syncer_command.h" 13 #include "sync/engine/model_changing_syncer_command.h"
14 #include "sync/engine/syncproto.h" 14 #include "sync/protocol/sync.pb.h"
15 15
16 namespace syncer { 16 namespace syncer {
17 17
18 namespace sessions { 18 namespace sessions {
19 class OrderedCommitSet; 19 class OrderedCommitSet;
20 } 20 }
21 21
22 namespace syncable { 22 namespace syncable {
23 class Id; 23 class Id;
24 class WriteTransaction; 24 class WriteTransaction;
(...skipping 20 matching lines...) Expand all
45 // to be committed in this batch. 45 // to be committed in this batch.
46 // 46 //
47 // The commmit_message parameter contains the message that was sent to the 47 // The commmit_message parameter contains the message that was sent to the
48 // server. 48 // server.
49 // 49 //
50 // The commit_response parameter contains the response received from the 50 // The commit_response parameter contains the response received from the
51 // server. This may be uninitialized if we were unable to contact the server 51 // server. This may be uninitialized if we were unable to contact the server
52 // or a serious error was encountered. 52 // or a serious error was encountered.
53 ProcessCommitResponseCommand( 53 ProcessCommitResponseCommand(
54 const sessions::OrderedCommitSet& commit_set, 54 const sessions::OrderedCommitSet& commit_set,
55 const ClientToServerMessage& commit_message, 55 const sync_pb::ClientToServerMessage& commit_message,
56 const ClientToServerResponse& commit_response); 56 const sync_pb::ClientToServerResponse& commit_response);
57 virtual ~ProcessCommitResponseCommand(); 57 virtual ~ProcessCommitResponseCommand();
58 58
59 protected: 59 protected:
60 // ModelChangingSyncerCommand implementation. 60 // ModelChangingSyncerCommand implementation.
61 virtual std::set<ModelSafeGroup> GetGroupsToChange( 61 virtual std::set<ModelSafeGroup> GetGroupsToChange(
62 const sessions::SyncSession& session) const OVERRIDE; 62 const sessions::SyncSession& session) const OVERRIDE;
63 virtual SyncerError ModelChangingExecuteImpl( 63 virtual SyncerError ModelChangingExecuteImpl(
64 sessions::SyncSession* session) OVERRIDE; 64 sessions::SyncSession* session) OVERRIDE;
65 65
66 private: 66 private:
67 CommitResponse::ResponseType ProcessSingleCommitResponse( 67 sync_pb::CommitResponse::ResponseType ProcessSingleCommitResponse(
68 syncable::WriteTransaction* trans, 68 syncable::WriteTransaction* trans,
69 const sync_pb::CommitResponse_EntryResponse& pb_commit_response, 69 const sync_pb::CommitResponse_EntryResponse& pb_commit_response,
70 const sync_pb::SyncEntity& pb_committed_entry, 70 const sync_pb::SyncEntity& pb_committed_entry,
71 const syncable::Id& pre_commit_id, 71 const syncable::Id& pre_commit_id,
72 std::set<syncable::Id>* deleted_folders); 72 std::set<syncable::Id>* deleted_folders);
73 73
74 // Actually does the work of execute. 74 // Actually does the work of execute.
75 SyncerError ProcessCommitResponse(sessions::SyncSession* session); 75 SyncerError ProcessCommitResponse(sessions::SyncSession* session);
76 76
77 void ProcessSuccessfulCommitResponse( 77 void ProcessSuccessfulCommitResponse(
78 const sync_pb::SyncEntity& committed_entry, 78 const sync_pb::SyncEntity& committed_entry,
79 const CommitResponse_EntryResponse& entry_response, 79 const sync_pb::CommitResponse_EntryResponse& entry_response,
80 const syncable::Id& pre_commit_id, syncable::MutableEntry* local_entry, 80 const syncable::Id& pre_commit_id, syncable::MutableEntry* local_entry,
81 bool syncing_was_set, std::set<syncable::Id>* deleted_folders); 81 bool syncing_was_set, std::set<syncable::Id>* deleted_folders);
82 82
83 // Update the BASE_VERSION and SERVER_VERSION, post-commit. 83 // Update the BASE_VERSION and SERVER_VERSION, post-commit.
84 // Helper for ProcessSuccessfulCommitResponse. 84 // Helper for ProcessSuccessfulCommitResponse.
85 bool UpdateVersionAfterCommit( 85 bool UpdateVersionAfterCommit(
86 const sync_pb::SyncEntity& committed_entry, 86 const sync_pb::SyncEntity& committed_entry,
87 const CommitResponse_EntryResponse& entry_response, 87 const sync_pb::CommitResponse_EntryResponse& entry_response,
88 const syncable::Id& pre_commit_id, 88 const syncable::Id& pre_commit_id,
89 syncable::MutableEntry* local_entry); 89 syncable::MutableEntry* local_entry);
90 90
91 // If the server generated an ID for us during a commit, apply the new ID. 91 // If the server generated an ID for us during a commit, apply the new ID.
92 // Helper for ProcessSuccessfulCommitResponse. 92 // Helper for ProcessSuccessfulCommitResponse.
93 bool ChangeIdAfterCommit( 93 bool ChangeIdAfterCommit(
94 const CommitResponse_EntryResponse& entry_response, 94 const sync_pb::CommitResponse_EntryResponse& entry_response,
95 const syncable::Id& pre_commit_id, 95 const syncable::Id& pre_commit_id,
96 syncable::MutableEntry* local_entry); 96 syncable::MutableEntry* local_entry);
97 97
98 // Update the SERVER_ fields to reflect the server state after committing. 98 // Update the SERVER_ fields to reflect the server state after committing.
99 // Helper for ProcessSuccessfulCommitResponse. 99 // Helper for ProcessSuccessfulCommitResponse.
100 void UpdateServerFieldsAfterCommit( 100 void UpdateServerFieldsAfterCommit(
101 const sync_pb::SyncEntity& committed_entry, 101 const sync_pb::SyncEntity& committed_entry,
102 const CommitResponse_EntryResponse& entry_response, 102 const sync_pb::CommitResponse_EntryResponse& entry_response,
103 syncable::MutableEntry* local_entry); 103 syncable::MutableEntry* local_entry);
104 104
105 // The server can override some values during a commit; the overridden values 105 // The server can override some values during a commit; the overridden values
106 // are returned as fields in the CommitResponse_EntryResponse. This method 106 // are returned as fields in the CommitResponse_EntryResponse. This method
107 // stores the fields back in the client-visible (i.e. not the SERVER_* fields) 107 // stores the fields back in the client-visible (i.e. not the SERVER_* fields)
108 // fields of the entry. This should only be done if the item did not change 108 // fields of the entry. This should only be done if the item did not change
109 // locally while the commit was in flight. 109 // locally while the commit was in flight.
110 // Helper for ProcessSuccessfulCommitResponse. 110 // Helper for ProcessSuccessfulCommitResponse.
111 void OverrideClientFieldsAfterCommit( 111 void OverrideClientFieldsAfterCommit(
112 const sync_pb::SyncEntity& committed_entry, 112 const sync_pb::SyncEntity& committed_entry,
113 const CommitResponse_EntryResponse& entry_response, 113 const sync_pb::CommitResponse_EntryResponse& entry_response,
114 syncable::MutableEntry* local_entry); 114 syncable::MutableEntry* local_entry);
115 115
116 // Helper to extract the final name from the protobufs. 116 // Helper to extract the final name from the protobufs.
117 const std::string& GetResultingPostCommitName( 117 const std::string& GetResultingPostCommitName(
118 const sync_pb::SyncEntity& committed_entry, 118 const sync_pb::SyncEntity& committed_entry,
119 const CommitResponse_EntryResponse& entry_response); 119 const sync_pb::CommitResponse_EntryResponse& entry_response);
120 120
121 // Helper to clean up in case of failure. 121 // Helper to clean up in case of failure.
122 void ClearSyncingBits( 122 void ClearSyncingBits(
123 syncable::Directory *dir, 123 syncable::Directory *dir,
124 const std::vector<syncable::Id>& commit_ids); 124 const std::vector<syncable::Id>& commit_ids);
125 125
126 const sessions::OrderedCommitSet& commit_set_; 126 const sessions::OrderedCommitSet& commit_set_;
127 const ClientToServerMessage& commit_message_; 127 const sync_pb::ClientToServerMessage& commit_message_;
128 const ClientToServerResponse& commit_response_; 128 const sync_pb::ClientToServerResponse& commit_response_;
129 129
130 DISALLOW_COPY_AND_ASSIGN(ProcessCommitResponseCommand); 130 DISALLOW_COPY_AND_ASSIGN(ProcessCommitResponseCommand);
131 }; 131 };
132 132
133 } // namespace syncer 133 } // namespace syncer
134 134
135 #endif // SYNC_ENGINE_PROCESS_COMMIT_RESPONSE_COMMAND_H_ 135 #endif // SYNC_ENGINE_PROCESS_COMMIT_RESPONSE_COMMAND_H_
OLDNEW
« no previous file with comments | « sync/engine/net/server_connection_manager.cc ('k') | sync/engine/process_commit_response_command.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698