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

Side by Side Diff: components/sync/syncable/read_node.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 "components/sync/syncable/read_node.h" 5 #include "components/sync/syncable/read_node.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "components/sync/base/hash_util.h"
8 #include "components/sync/syncable/base_transaction.h" 9 #include "components/sync/syncable/base_transaction.h"
9 #include "components/sync/syncable/entry.h" 10 #include "components/sync/syncable/entry.h"
10 #include "components/sync/syncable/syncable_base_transaction.h" 11 #include "components/sync/syncable/syncable_base_transaction.h"
11 #include "components/sync/syncable/syncable_util.h"
12 12
13 namespace syncer { 13 namespace syncer {
14 14
15 ////////////////////////////////////////////////////////////////////////// 15 //////////////////////////////////////////////////////////////////////////
16 // ReadNode member definitions 16 // ReadNode member definitions
17 ReadNode::ReadNode(const BaseTransaction* transaction) 17 ReadNode::ReadNode(const BaseTransaction* transaction)
18 : entry_(nullptr), transaction_(transaction) { 18 : entry_(nullptr), transaction_(transaction) {
19 DCHECK(transaction); 19 DCHECK(transaction);
20 } 20 }
21 21
(...skipping 29 matching lines...) Expand all
51 return DecryptIfNecessary() ? INIT_OK : INIT_FAILED_DECRYPT_IF_NECESSARY; 51 return DecryptIfNecessary() ? INIT_OK : INIT_FAILED_DECRYPT_IF_NECESSARY;
52 } 52 }
53 53
54 BaseNode::InitByLookupResult ReadNode::InitByClientTagLookup( 54 BaseNode::InitByLookupResult ReadNode::InitByClientTagLookup(
55 ModelType model_type, 55 ModelType model_type,
56 const std::string& tag) { 56 const std::string& tag) {
57 DCHECK(!entry_) << "Init called twice"; 57 DCHECK(!entry_) << "Init called twice";
58 if (tag.empty()) 58 if (tag.empty())
59 return INIT_FAILED_PRECONDITION; 59 return INIT_FAILED_PRECONDITION;
60 60
61 const std::string hash = syncable::GenerateSyncableHash(model_type, tag); 61 const std::string hash = GenerateSyncableHash(model_type, tag);
62 62
63 entry_ = new syncable::Entry(transaction_->GetWrappedTrans(), 63 entry_ = new syncable::Entry(transaction_->GetWrappedTrans(),
64 syncable::GET_BY_CLIENT_TAG, hash); 64 syncable::GET_BY_CLIENT_TAG, hash);
65 if (!entry_->good()) 65 if (!entry_->good())
66 return INIT_FAILED_ENTRY_NOT_GOOD; 66 return INIT_FAILED_ENTRY_NOT_GOOD;
67 if (entry_->GetIsDel()) 67 if (entry_->GetIsDel())
68 return INIT_FAILED_ENTRY_IS_DEL; 68 return INIT_FAILED_ENTRY_IS_DEL;
69 return DecryptIfNecessary() ? INIT_OK : INIT_FAILED_DECRYPT_IF_NECESSARY; 69 return DecryptIfNecessary() ? INIT_OK : INIT_FAILED_DECRYPT_IF_NECESSARY;
70 } 70 }
71 71
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 if (entry_->GetIsDel()) 109 if (entry_->GetIsDel())
110 return INIT_FAILED_ENTRY_IS_DEL; 110 return INIT_FAILED_ENTRY_IS_DEL;
111 ModelType found_model_type = GetModelType(); 111 ModelType found_model_type = GetModelType();
112 LOG_IF(WARNING, found_model_type == UNSPECIFIED || 112 LOG_IF(WARNING, found_model_type == UNSPECIFIED ||
113 found_model_type == TOP_LEVEL_FOLDER) 113 found_model_type == TOP_LEVEL_FOLDER)
114 << "SyncAPI InitTypeRoot referencing unusually typed object."; 114 << "SyncAPI InitTypeRoot referencing unusually typed object.";
115 return DecryptIfNecessary() ? INIT_OK : INIT_FAILED_DECRYPT_IF_NECESSARY; 115 return DecryptIfNecessary() ? INIT_OK : INIT_FAILED_DECRYPT_IF_NECESSARY;
116 } 116 }
117 117
118 } // namespace syncer 118 } // namespace syncer
OLDNEW
« no previous file with comments | « components/sync/syncable/parent_child_index_unittest.cc ('k') | components/sync/syncable/syncable_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698