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

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

Issue 2844037: Fix handling of undeletion within the syncer. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Whitespace. Created 10 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
OLDNEW
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 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 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 CHROME_BROWSER_SYNC_ENGINE_PROCESS_COMMIT_RESPONSE_COMMAND_H_ 5 #ifndef CHROME_BROWSER_SYNC_ENGINE_PROCESS_COMMIT_RESPONSE_COMMAND_H_
6 #define CHROME_BROWSER_SYNC_ENGINE_PROCESS_COMMIT_RESPONSE_COMMAND_H_ 6 #define CHROME_BROWSER_SYNC_ENGINE_PROCESS_COMMIT_RESPONSE_COMMAND_H_
7 7
8 #include <set> 8 #include <set>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 14 matching lines...) Expand all
25 ProcessCommitResponseCommand(); 25 ProcessCommitResponseCommand();
26 virtual ~ProcessCommitResponseCommand(); 26 virtual ~ProcessCommitResponseCommand();
27 27
28 // ModelChangingSyncerCommand implementation. 28 // ModelChangingSyncerCommand implementation.
29 virtual bool ModelNeutralExecuteImpl(sessions::SyncSession* session); 29 virtual bool ModelNeutralExecuteImpl(sessions::SyncSession* session);
30 virtual void ModelChangingExecuteImpl(sessions::SyncSession* session); 30 virtual void ModelChangingExecuteImpl(sessions::SyncSession* session);
31 31
32 private: 32 private:
33 CommitResponse::ResponseType ProcessSingleCommitResponse( 33 CommitResponse::ResponseType ProcessSingleCommitResponse(
34 syncable::WriteTransaction* trans, 34 syncable::WriteTransaction* trans,
35 const sync_pb::CommitResponse_EntryResponse& pb_server_entry, 35 const sync_pb::CommitResponse_EntryResponse& pb_commit_response,
36 const syncable::Id& pre_commit_id, std::set<syncable::Id>* 36 const sync_pb::SyncEntity& pb_committed_entry,
37 conflicting_new_directory_ids, 37 const syncable::Id& pre_commit_id,
38 std::set<syncable::Id>* conflicting_new_directory_ids,
38 std::set<syncable::Id>* deleted_folders); 39 std::set<syncable::Id>* deleted_folders);
39 40
40 // Actually does the work of execute. 41 // Actually does the work of execute.
41 void ProcessCommitResponse(sessions::SyncSession* session); 42 void ProcessCommitResponse(sessions::SyncSession* session);
42 43
43 void ProcessSuccessfulCommitResponse(syncable::WriteTransaction* trans, 44 void ProcessSuccessfulCommitResponse(
44 const CommitResponse_EntryResponse& server_entry, 45 const sync_pb::SyncEntity& committed_entry,
46 const CommitResponse_EntryResponse& entry_response,
45 const syncable::Id& pre_commit_id, syncable::MutableEntry* local_entry, 47 const syncable::Id& pre_commit_id, syncable::MutableEntry* local_entry,
46 bool syncing_was_set, std::set<syncable::Id>* deleted_folders); 48 bool syncing_was_set, std::set<syncable::Id>* deleted_folders);
47 49
48 void PerformCommitTimeNameAside( 50 // Update the BASE_VERSION and SERVER_VERSION, post-commit.
49 syncable::WriteTransaction* trans, 51 // Helper for ProcessSuccessfulCommitResponse.
50 const CommitResponse_EntryResponse& server_entry, 52 bool UpdateVersionAfterCommit(
53 const sync_pb::SyncEntity& committed_entry,
54 const CommitResponse_EntryResponse& entry_response,
55 const syncable::Id& pre_commit_id,
51 syncable::MutableEntry* local_entry); 56 syncable::MutableEntry* local_entry);
52 57
58 // If the server generated an ID for us during a commit, apply the new ID.
59 // Helper for ProcessSuccessfulCommitResponse.
60 bool ChangeIdAfterCommit(
61 const CommitResponse_EntryResponse& entry_response,
62 const syncable::Id& pre_commit_id,
63 syncable::MutableEntry* local_entry);
64
65 // Update the SERVER_ fields to reflect the server state after committing.
66 // Helper for ProcessSuccessfulCommitResponse.
67 void UpdateServerFieldsAfterCommit(
68 const sync_pb::SyncEntity& committed_entry,
69 const CommitResponse_EntryResponse& entry_response,
70 syncable::MutableEntry* local_entry);
71
72 // The server can override some values during a commit; the overridden values
73 // are returned as fields in the CommitResponse_EntryResponse. This method
74 // stores the fields back in the client-visible (i.e. not the SERVER_* fields)
75 // fields of the entry. This should only be done if the item did not change
76 // locally while the commit was in flight.
77 // Helper for ProcessSuccessfulCommitResponse.
78 void OverrideClientFieldsAfterCommit(
79 const sync_pb::SyncEntity& committed_entry,
80 const CommitResponse_EntryResponse& entry_response,
81 syncable::MutableEntry* local_entry);
82
83 // Helper to extract the final name from the protobufs.
84 const string& GetResultingPostCommitName(
85 const sync_pb::SyncEntity& committed_entry,
86 const CommitResponse_EntryResponse& entry_response);
87
53 DISALLOW_COPY_AND_ASSIGN(ProcessCommitResponseCommand); 88 DISALLOW_COPY_AND_ASSIGN(ProcessCommitResponseCommand);
54 }; 89 };
55 90
56 } // namespace browser_sync 91 } // namespace browser_sync
57 92
58 #endif // CHROME_BROWSER_SYNC_ENGINE_PROCESS_COMMIT_RESPONSE_COMMAND_H_ 93 #endif // CHROME_BROWSER_SYNC_ENGINE_PROCESS_COMMIT_RESPONSE_COMMAND_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698