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

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

Issue 10696087: [Sync] Move ModelType and related classes to 'syncer' namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sort headers, update copyrights Created 8 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « sync/internal_api/public/write_node.h ('k') | sync/internal_api/sync_manager.cc » ('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/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"
(...skipping 26 matching lines...) Expand all
37 37
38 BaseNode::InitByLookupResult ReadNode::InitByIdLookup(int64 id) { 38 BaseNode::InitByLookupResult ReadNode::InitByIdLookup(int64 id) {
39 DCHECK(!entry_) << "Init called twice"; 39 DCHECK(!entry_) << "Init called twice";
40 DCHECK_NE(id, kInvalidId); 40 DCHECK_NE(id, kInvalidId);
41 syncable::BaseTransaction* trans = transaction_->GetWrappedTrans(); 41 syncable::BaseTransaction* trans = transaction_->GetWrappedTrans();
42 entry_ = new syncable::Entry(trans, syncable::GET_BY_HANDLE, id); 42 entry_ = new syncable::Entry(trans, syncable::GET_BY_HANDLE, id);
43 if (!entry_->good()) 43 if (!entry_->good())
44 return INIT_FAILED_ENTRY_NOT_GOOD; 44 return INIT_FAILED_ENTRY_NOT_GOOD;
45 if (entry_->Get(syncable::IS_DEL)) 45 if (entry_->Get(syncable::IS_DEL))
46 return INIT_FAILED_ENTRY_IS_DEL; 46 return INIT_FAILED_ENTRY_IS_DEL;
47 syncable::ModelType model_type = GetModelType(); 47 syncer::ModelType model_type = GetModelType();
48 LOG_IF(WARNING, model_type == syncable::UNSPECIFIED || 48 LOG_IF(WARNING, model_type == syncer::UNSPECIFIED ||
49 model_type == syncable::TOP_LEVEL_FOLDER) 49 model_type == syncer::TOP_LEVEL_FOLDER)
50 << "SyncAPI InitByIdLookup referencing unusual object."; 50 << "SyncAPI InitByIdLookup referencing unusual object.";
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 syncable::ModelType model_type, 55 syncer::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 = 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())
(...skipping 15 matching lines...) Expand all
81 const std::string& tag) { 81 const std::string& tag) {
82 DCHECK(!entry_) << "Init called twice"; 82 DCHECK(!entry_) << "Init called twice";
83 if (tag.empty()) 83 if (tag.empty())
84 return INIT_FAILED_PRECONDITION; 84 return INIT_FAILED_PRECONDITION;
85 syncable::BaseTransaction* trans = transaction_->GetWrappedTrans(); 85 syncable::BaseTransaction* trans = transaction_->GetWrappedTrans();
86 entry_ = new syncable::Entry(trans, syncable::GET_BY_SERVER_TAG, tag); 86 entry_ = new syncable::Entry(trans, syncable::GET_BY_SERVER_TAG, tag);
87 if (!entry_->good()) 87 if (!entry_->good())
88 return INIT_FAILED_ENTRY_NOT_GOOD; 88 return INIT_FAILED_ENTRY_NOT_GOOD;
89 if (entry_->Get(syncable::IS_DEL)) 89 if (entry_->Get(syncable::IS_DEL))
90 return INIT_FAILED_ENTRY_IS_DEL; 90 return INIT_FAILED_ENTRY_IS_DEL;
91 syncable::ModelType model_type = GetModelType(); 91 syncer::ModelType model_type = GetModelType();
92 LOG_IF(WARNING, model_type == syncable::UNSPECIFIED || 92 LOG_IF(WARNING, model_type == syncer::UNSPECIFIED ||
93 model_type == syncable::TOP_LEVEL_FOLDER) 93 model_type == syncer::TOP_LEVEL_FOLDER)
94 << "SyncAPI InitByTagLookup referencing unusually typed object."; 94 << "SyncAPI InitByTagLookup referencing unusually typed object.";
95 return DecryptIfNecessary() ? INIT_OK : INIT_FAILED_DECRYPT_IF_NECESSARY; 95 return DecryptIfNecessary() ? INIT_OK : INIT_FAILED_DECRYPT_IF_NECESSARY;
96 } 96 }
97 97
98 } // namespace syncer 98 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/internal_api/public/write_node.h ('k') | sync/internal_api/sync_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698