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

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

Issue 11636006: WIP: The Bookmark Position Megapatch (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Various updates, including switch suffix to unique_client_tag style Created 8 years 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 | Annotate | Revision Log
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/read_node.h" 5 #include "sync/internal_api/public/read_node.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "sync/internal_api/public/base_transaction.h" 8 #include "sync/internal_api/public/base_transaction.h"
9 #include "sync/syncable/base_transaction.h" 9 #include "sync/syncable/base_transaction.h"
10 #include "sync/syncable/entry.h" 10 #include "sync/syncable/entry.h"
11 #include "sync/syncable/syncable_util.h"
11 12
12 namespace syncer { 13 namespace syncer {
13 14
14 ////////////////////////////////////////////////////////////////////////// 15 //////////////////////////////////////////////////////////////////////////
15 // ReadNode member definitions 16 // ReadNode member definitions
16 ReadNode::ReadNode(const BaseTransaction* transaction) 17 ReadNode::ReadNode(const BaseTransaction* transaction)
17 : entry_(NULL), transaction_(transaction) { 18 : entry_(NULL), transaction_(transaction) {
18 DCHECK(transaction); 19 DCHECK(transaction);
19 } 20 }
20 21
(...skipping 29 matching lines...) Expand all
50 return DecryptIfNecessary() ? INIT_OK : INIT_FAILED_DECRYPT_IF_NECESSARY; 51 return DecryptIfNecessary() ? INIT_OK : INIT_FAILED_DECRYPT_IF_NECESSARY;
51 } 52 }
52 53
53 BaseNode::InitByLookupResult ReadNode::InitByClientTagLookup( 54 BaseNode::InitByLookupResult ReadNode::InitByClientTagLookup(
54 ModelType model_type, 55 ModelType model_type,
55 const std::string& tag) { 56 const std::string& tag) {
56 DCHECK(!entry_) << "Init called twice"; 57 DCHECK(!entry_) << "Init called twice";
57 if (tag.empty()) 58 if (tag.empty())
58 return INIT_FAILED_PRECONDITION; 59 return INIT_FAILED_PRECONDITION;
59 60
60 const std::string hash = GenerateSyncableHash(model_type, tag); 61 const std::string hash = syncable::GenerateSyncableHash(model_type, tag);
61 62
62 entry_ = new syncable::Entry(transaction_->GetWrappedTrans(), 63 entry_ = new syncable::Entry(transaction_->GetWrappedTrans(),
63 syncable::GET_BY_CLIENT_TAG, hash); 64 syncable::GET_BY_CLIENT_TAG, hash);
64 if (!entry_->good()) 65 if (!entry_->good())
65 return INIT_FAILED_ENTRY_NOT_GOOD; 66 return INIT_FAILED_ENTRY_NOT_GOOD;
66 if (entry_->Get(syncable::IS_DEL)) 67 if (entry_->Get(syncable::IS_DEL))
67 return INIT_FAILED_ENTRY_IS_DEL; 68 return INIT_FAILED_ENTRY_IS_DEL;
68 return DecryptIfNecessary() ? INIT_OK : INIT_FAILED_DECRYPT_IF_NECESSARY; 69 return DecryptIfNecessary() ? INIT_OK : INIT_FAILED_DECRYPT_IF_NECESSARY;
69 } 70 }
70 71
(...skipping 16 matching lines...) Expand all
87 return INIT_FAILED_ENTRY_NOT_GOOD; 88 return INIT_FAILED_ENTRY_NOT_GOOD;
88 if (entry_->Get(syncable::IS_DEL)) 89 if (entry_->Get(syncable::IS_DEL))
89 return INIT_FAILED_ENTRY_IS_DEL; 90 return INIT_FAILED_ENTRY_IS_DEL;
90 ModelType model_type = GetModelType(); 91 ModelType model_type = GetModelType();
91 LOG_IF(WARNING, model_type == UNSPECIFIED || model_type == TOP_LEVEL_FOLDER) 92 LOG_IF(WARNING, model_type == UNSPECIFIED || model_type == TOP_LEVEL_FOLDER)
92 << "SyncAPI InitByTagLookup referencing unusually typed object."; 93 << "SyncAPI InitByTagLookup referencing unusually typed object.";
93 return DecryptIfNecessary() ? INIT_OK : INIT_FAILED_DECRYPT_IF_NECESSARY; 94 return DecryptIfNecessary() ? INIT_OK : INIT_FAILED_DECRYPT_IF_NECESSARY;
94 } 95 }
95 96
96 } // namespace syncer 97 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/internal_api/public/write_node.h ('k') | sync/internal_api/sync_encryption_handler_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698