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

Side by Side Diff: sync/syncable/entry.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/syncable/directory_backing_store_unittest.cc ('k') | sync/syncable/entry_kernel.h » ('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/syncable/entry.h" 5 #include "sync/syncable/entry.h"
6 6
7 #include <iomanip> 7 #include <iomanip>
8 8
9 #include "net/base/escape.h" 9 #include "net/base/escape.h"
10 #include "sync/syncable/base_transaction.h" 10 #include "sync/syncable/base_transaction.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 entry_info->SetBoolean("isRoot", IsRoot()); 57 entry_info->SetBoolean("isRoot", IsRoot());
58 } 58 }
59 return entry_info; 59 return entry_info;
60 } 60 }
61 61
62 const string& Entry::Get(StringField field) const { 62 const string& Entry::Get(StringField field) const {
63 DCHECK(kernel_); 63 DCHECK(kernel_);
64 return kernel_->ref(field); 64 return kernel_->ref(field);
65 } 65 }
66 66
67 syncable::ModelType Entry::GetServerModelType() const { 67 syncer::ModelType Entry::GetServerModelType() const {
68 ModelType specifics_type = kernel_->GetServerModelType(); 68 ModelType specifics_type = kernel_->GetServerModelType();
69 if (specifics_type != UNSPECIFIED) 69 if (specifics_type != UNSPECIFIED)
70 return specifics_type; 70 return specifics_type;
71 71
72 // Otherwise, we don't have a server type yet. That should only happen 72 // Otherwise, we don't have a server type yet. That should only happen
73 // if the item is an uncommitted locally created item. 73 // if the item is an uncommitted locally created item.
74 // It's possible we'll need to relax these checks in the future; they're 74 // It's possible we'll need to relax these checks in the future; they're
75 // just here for now as a safety measure. 75 // just here for now as a safety measure.
76 DCHECK(Get(IS_UNSYNCED)); 76 DCHECK(Get(IS_UNSYNCED));
77 DCHECK_EQ(Get(SERVER_VERSION), 0); 77 DCHECK_EQ(Get(SERVER_VERSION), 0);
78 DCHECK(Get(SERVER_IS_DEL)); 78 DCHECK(Get(SERVER_IS_DEL));
79 // Note: can't enforce !Get(ID).ServerKnows() here because that could 79 // Note: can't enforce !Get(ID).ServerKnows() here because that could
80 // actually happen if we hit AttemptReuniteLostCommitResponses. 80 // actually happen if we hit AttemptReuniteLostCommitResponses.
81 return UNSPECIFIED; 81 return UNSPECIFIED;
82 } 82 }
83 83
84 syncable::ModelType Entry::GetModelType() const { 84 syncer::ModelType Entry::GetModelType() const {
85 ModelType specifics_type = GetModelTypeFromSpecifics(Get(SPECIFICS)); 85 ModelType specifics_type = GetModelTypeFromSpecifics(Get(SPECIFICS));
86 if (specifics_type != UNSPECIFIED) 86 if (specifics_type != UNSPECIFIED)
87 return specifics_type; 87 return specifics_type;
88 if (IsRoot()) 88 if (IsRoot())
89 return TOP_LEVEL_FOLDER; 89 return TOP_LEVEL_FOLDER;
90 // Loose check for server-created top-level folders that aren't 90 // Loose check for server-created top-level folders that aren't
91 // bound to a particular model type. 91 // bound to a particular model type.
92 if (!Get(UNIQUE_SERVER_TAG).empty() && Get(IS_DIR)) 92 if (!Get(UNIQUE_SERVER_TAG).empty() && Get(IS_DIR))
93 return TOP_LEVEL_FOLDER; 93 return TOP_LEVEL_FOLDER;
94 94
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 os << "TempFlags: "; 136 os << "TempFlags: ";
137 for ( ; i < BIT_TEMPS_END; ++i) { 137 for ( ; i < BIT_TEMPS_END; ++i) {
138 if (kernel->ref(static_cast<BitTemp>(i))) 138 if (kernel->ref(static_cast<BitTemp>(i)))
139 os << "#" << i - BIT_TEMPS_BEGIN << ", "; 139 os << "#" << i - BIT_TEMPS_BEGIN << ", ";
140 } 140 }
141 return os; 141 return os;
142 } 142 }
143 143
144 } // namespace syncable 144 } // namespace syncable
145 } // namespace syncer 145 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/syncable/directory_backing_store_unittest.cc ('k') | sync/syncable/entry_kernel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698