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

Side by Side Diff: components/sync/model_impl/processor_entity_tracker.cc

Issue 2502253003: [Sync] Move GenerateSyncableHash to base. (Closed)
Patch Set: Keep full syncable/ DEP. Created 4 years, 1 month 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 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 #include "components/sync/model_impl/processor_entity_tracker.h" 5 #include "components/sync/model_impl/processor_entity_tracker.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/sha1.h" 8 #include "base/sha1.h"
9 #include "components/sync/base/time.h" 9 #include "components/sync/base/time.h"
10 #include "components/sync/engine/non_blocking_sync_common.h" 10 #include "components/sync/engine/non_blocking_sync_common.h"
11 #include "components/sync/syncable/syncable_util.h"
12 11
13 namespace syncer { 12 namespace syncer {
14 13
15 namespace { 14 namespace {
16 15
17 void HashSpecifics(const sync_pb::EntitySpecifics& specifics, 16 void HashSpecifics(const sync_pb::EntitySpecifics& specifics,
18 std::string* hash) { 17 std::string* hash) {
19 DCHECK_GT(specifics.ByteSize(), 0); 18 DCHECK_GT(specifics.ByteSize(), 0);
20 base::Base64Encode(base::SHA1HashString(specifics.SerializeAsString()), hash); 19 base::Base64Encode(base::SHA1HashString(specifics.SerializeAsString()), hash);
21 } 20 }
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 void ProcessorEntityTracker::UpdateSpecificsHash( 240 void ProcessorEntityTracker::UpdateSpecificsHash(
242 const sync_pb::EntitySpecifics& specifics) { 241 const sync_pb::EntitySpecifics& specifics) {
243 if (specifics.ByteSize() > 0) { 242 if (specifics.ByteSize() > 0) {
244 HashSpecifics(specifics, metadata_.mutable_specifics_hash()); 243 HashSpecifics(specifics, metadata_.mutable_specifics_hash());
245 } else { 244 } else {
246 metadata_.clear_specifics_hash(); 245 metadata_.clear_specifics_hash();
247 } 246 }
248 } 247 }
249 248
250 } // namespace syncer 249 } // namespace syncer
OLDNEW
« no previous file with comments | « components/sync/model_impl/DEPS ('k') | components/sync/model_impl/processor_entity_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698