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

Side by Side Diff: sync/internal_api/write_node.cc

Issue 1842653006: Update //third_party/protobuf to version 3. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 4 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
« no previous file with comments | « sync/internal_api/sync_manager_impl_unittest.cc ('k') | third_party/protobuf/.gitignore » ('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 (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 #include "sync/internal_api/public/write_node.h" 5 #include "sync/internal_api/public/write_node.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 CHECK(!new_value.password().has_client_only_encrypted_data()); 156 CHECK(!new_value.password().has_client_only_encrypted_data());
157 DCHECK_NE(new_specifics_type, UNSPECIFIED); 157 DCHECK_NE(new_specifics_type, UNSPECIFIED);
158 DVLOG(1) << "Writing entity specifics of type " 158 DVLOG(1) << "Writing entity specifics of type "
159 << ModelTypeToString(new_specifics_type); 159 << ModelTypeToString(new_specifics_type);
160 DCHECK_EQ(new_specifics_type, GetModelType()); 160 DCHECK_EQ(new_specifics_type, GetModelType());
161 161
162 // Preserve unknown fields. 162 // Preserve unknown fields.
163 const sync_pb::EntitySpecifics& old_specifics = entry_->GetSpecifics(); 163 const sync_pb::EntitySpecifics& old_specifics = entry_->GetSpecifics();
164 sync_pb::EntitySpecifics new_specifics; 164 sync_pb::EntitySpecifics new_specifics;
165 new_specifics.CopyFrom(new_value); 165 new_specifics.CopyFrom(new_value);
166 new_specifics.mutable_unknown_fields()->MergeFrom( 166 new_specifics.mutable_unknown_fields()
167 old_specifics.unknown_fields()); 167 ->append(old_specifics.unknown_fields());
168 168
169 // Will update the entry if encryption was necessary. 169 // Will update the entry if encryption was necessary.
170 if (!UpdateEntryWithEncryption(GetTransaction()->GetWrappedTrans(), 170 if (!UpdateEntryWithEncryption(GetTransaction()->GetWrappedTrans(),
171 new_specifics, 171 new_specifics,
172 entry_)) { 172 entry_)) {
173 return; 173 return;
174 } 174 }
175 if (entry_->GetSpecifics().has_encrypted()) { 175 if (entry_->GetSpecifics().has_encrypted()) {
176 // EncryptIfNecessary already updated the entry for us and marked for 176 // EncryptIfNecessary already updated the entry for us and marked for
177 // syncing if it was needed. Now we just make a copy of the unencrypted 177 // syncing if it was needed. Now we just make a copy of the unencrypted
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 syncable::Id predecessor_id = 467 syncable::Id predecessor_id =
468 predecessor ? predecessor->GetSyncId() : syncable::Id(); 468 predecessor ? predecessor->GetSyncId() : syncable::Id();
469 return entry_->PutPredecessor(predecessor_id); 469 return entry_->PutPredecessor(predecessor_id);
470 } 470 }
471 471
472 void WriteNode::MarkForSyncing() { 472 void WriteNode::MarkForSyncing() {
473 syncable::MarkForSyncing(entry_); 473 syncable::MarkForSyncing(entry_);
474 } 474 }
475 475
476 } // namespace syncer 476 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/internal_api/sync_manager_impl_unittest.cc ('k') | third_party/protobuf/.gitignore » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698