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

Unified Diff: blimp/helium/lww_register.h

Issue 2402153002: Add CompoundSyncable class for synchronizing containers of Syncables. (Closed)
Patch Set: make literal unsigned Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « blimp/helium/helium_test.h ('k') | blimp/helium/lww_register_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: blimp/helium/lww_register.h
diff --git a/blimp/helium/lww_register.h b/blimp/helium/lww_register.h
index 31f11ac56497a8eb9fe8763fcf504ba46875f229..99ff80bd308ecffbec5d61c634ee5eaec93ba66d 100644
--- a/blimp/helium/lww_register.h
+++ b/blimp/helium/lww_register.h
@@ -86,17 +86,21 @@ Result LwwRegister<RegisterType>::ApplyChangeset(
google::protobuf::io::CodedInputStream* input_stream) {
VersionVector remote;
if (!CodedValueSerializer::Deserialize(input_stream, &remote)) {
- return Result::ERR_INTERNAL_ERROR;
+ return Result::ERR_PROTOCOL_ERROR;
}
remote = remote.Invert();
VersionVector::Comparison cmp = last_modified_.CompareTo(remote);
+
+ RegisterType input_value;
+ if (!CodedValueSerializer::Deserialize(input_stream, &input_value)) {
+ return Result::ERR_PROTOCOL_ERROR;
+ }
if (cmp == VersionVector::Comparison::LessThan ||
(cmp == VersionVector::Comparison::Conflict && !locally_owned_)) {
- if (!CodedValueSerializer::Deserialize(input_stream, &value_)) {
- return Result::ERR_INTERNAL_ERROR;
- }
+ value_ = input_value;
value_set_ = true;
}
+
last_modified_ = last_modified_.MergeWith(remote);
return Result::SUCCESS;
}
« no previous file with comments | « blimp/helium/helium_test.h ('k') | blimp/helium/lww_register_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698