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/worker_entity_tracker.h

Issue 1814823006: [Sync] Accumulate GU response chunks in the Worker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mtw
Patch Set: Improve test coverage. Created 4 years, 9 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
« no previous file with comments | « sync/engine/model_type_worker_unittest.cc ('k') | sync/engine/worker_entity_tracker.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_WORKER_ENTITY_TRACKER_H_ 5 #ifndef SYNC_ENGINE_WORKER_ENTITY_TRACKER_H_
6 #define SYNC_ENGINE_WORKER_ENTITY_TRACKER_H_ 6 #define SYNC_ENGINE_WORKER_ENTITY_TRACKER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 // Since commits happen entirely on the sync thread, we can safely assume 58 // Since commits happen entirely on the sync thread, we can safely assume
59 // that our item's state at the end of the commit is the same as it was at 59 // that our item's state at the end of the commit is the same as it was at
60 // the start. 60 // the start.
61 void ReceiveCommitResponse(const std::string& response_id, 61 void ReceiveCommitResponse(const std::string& response_id,
62 int64_t response_version, 62 int64_t response_version,
63 int64_t sequence_number); 63 int64_t sequence_number);
64 64
65 // Handles receipt of an update from the server. 65 // Handles receipt of an update from the server.
66 void ReceiveUpdate(int64_t version); 66 void ReceiveUpdate(int64_t version);
67 67
68 // Handles the receipt of an pending update from the server. 68 // Handles the receipt of an encrypted update from the server.
69 // 69 //
70 // Returns true if the tracker decides this item is worth keeping. Returns 70 // Returns true if the tracker decides this item is worth keeping. Returns
71 // false if the item is discarded, which could happen if the version number 71 // false if the item is discarded, which could happen if the version number
72 // is out of date. 72 // is out of date.
73 bool ReceivePendingUpdate(const UpdateResponseData& data); 73 bool ReceiveEncryptedUpdate(const UpdateResponseData& data);
74 74
75 // Functions to fetch the latest pending update. 75 // Functions to fetch the latest encrypted update.
76 bool HasPendingUpdate() const; 76 bool HasEncryptedUpdate() const;
77 UpdateResponseData GetPendingUpdate() const; 77 UpdateResponseData GetEncryptedUpdate() const;
78 78
79 // Clears the pending update. Allows us to resume regular commit behavior. 79 // Clears the pending update. Allows us to resume regular commit behavior.
pavely 2016/03/23 21:58:15 pending -> encrypted in comment
maxbogue 2016/03/23 22:59:35 Done.
80 void ClearPendingUpdate(); 80 void ClearEncryptedUpdate();
81 81
82 private: 82 private:
83 // Checks if the current state indicates a conflict. 83 // Checks if the current state indicates a conflict.
84 // 84 //
85 // This can be true only while a call to this object is in progress. 85 // This can be true only while a call to this object is in progress.
86 // Conflicts are always cleared before the method call ends. 86 // Conflicts are always cleared before the method call ends.
87 bool IsInConflict() const; 87 bool IsInConflict() const;
88 88
89 // Checks if the server knows about this item. 89 // Checks if the server knows about this item.
90 bool IsServerKnown() const; 90 bool IsServerKnown() const;
(...skipping 20 matching lines...) Expand all
111 111
112 // The server version on which this item is based. 112 // The server version on which this item is based.
113 int64_t base_version_; 113 int64_t base_version_;
114 114
115 // A commit for this entity waiting for a sync cycle to be committed. 115 // A commit for this entity waiting for a sync cycle to be committed.
116 scoped_ptr<CommitRequestData> pending_commit_; 116 scoped_ptr<CommitRequestData> pending_commit_;
117 117
118 // An update for this entity which can't be applied right now. The presence 118 // An update for this entity which can't be applied right now. The presence
119 // of an pending update prevents commits. As of this writing, the only 119 // of an pending update prevents commits. As of this writing, the only
120 // source of pending updates is updates that can't currently be decrypted. 120 // source of pending updates is updates that can't currently be decrypted.
121 scoped_ptr<UpdateResponseData> pending_update_; 121 scoped_ptr<UpdateResponseData> encrypted_update_;
122 122
123 DISALLOW_COPY_AND_ASSIGN(WorkerEntityTracker); 123 DISALLOW_COPY_AND_ASSIGN(WorkerEntityTracker);
124 }; 124 };
125 125
126 } // namespace syncer_v2 126 } // namespace syncer_v2
127 127
128 #endif // SYNC_ENGINE_WORKER_ENTITY_TRACKER_H_ 128 #endif // SYNC_ENGINE_WORKER_ENTITY_TRACKER_H_
OLDNEW
« no previous file with comments | « sync/engine/model_type_worker_unittest.cc ('k') | sync/engine/worker_entity_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698