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

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

Issue 1545553003: Switch to standard integer types in sync/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « sync/internal_api/test/test_user_share.cc ('k') | sync/internal_api/write_transaction.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/write_node.h" 5 #include "sync/internal_api/public/write_node.h"
6 6
7 #include <stdint.h>
8
7 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
8 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
9 #include "base/values.h" 11 #include "base/values.h"
10 #include "sync/internal_api/public/base_transaction.h" 12 #include "sync/internal_api/public/base_transaction.h"
11 #include "sync/internal_api/public/write_transaction.h" 13 #include "sync/internal_api/public/write_transaction.h"
12 #include "sync/internal_api/syncapi_internal.h" 14 #include "sync/internal_api/syncapi_internal.h"
13 #include "sync/protocol/bookmark_specifics.pb.h" 15 #include "sync/protocol/bookmark_specifics.pb.h"
14 #include "sync/protocol/typed_url_specifics.pb.h" 16 #include "sync/protocol/typed_url_specifics.pb.h"
15 #include "sync/syncable/mutable_entry.h" 17 #include "sync/syncable/mutable_entry.h"
16 #include "sync/syncable/nigori_util.h" 18 #include "sync/syncable/nigori_util.h"
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 SetEntitySpecifics(GetEntitySpecifics()); 188 SetEntitySpecifics(GetEntitySpecifics());
187 } 189 }
188 190
189 void WriteNode::SetTypedUrlSpecifics( 191 void WriteNode::SetTypedUrlSpecifics(
190 const sync_pb::TypedUrlSpecifics& new_value) { 192 const sync_pb::TypedUrlSpecifics& new_value) {
191 sync_pb::EntitySpecifics entity_specifics; 193 sync_pb::EntitySpecifics entity_specifics;
192 entity_specifics.mutable_typed_url()->CopyFrom(new_value); 194 entity_specifics.mutable_typed_url()->CopyFrom(new_value);
193 SetEntitySpecifics(entity_specifics); 195 SetEntitySpecifics(entity_specifics);
194 } 196 }
195 197
196 void WriteNode::SetExternalId(int64 id) { 198 void WriteNode::SetExternalId(int64_t id) {
197 if (GetExternalId() != id) 199 if (GetExternalId() != id)
198 entry_->PutLocalExternalId(id); 200 entry_->PutLocalExternalId(id);
199 } 201 }
200 202
201 WriteNode::WriteNode(WriteTransaction* transaction) 203 WriteNode::WriteNode(WriteTransaction* transaction)
202 : entry_(NULL), transaction_(transaction) { 204 : entry_(NULL), transaction_(transaction) {
203 DCHECK(transaction); 205 DCHECK(transaction);
204 } 206 }
205 207
206 WriteNode::~WriteNode() { 208 WriteNode::~WriteNode() {
207 delete entry_; 209 delete entry_;
208 } 210 }
209 211
210 // Find an existing node matching the ID |id|, and bind this WriteNode to it. 212 // Find an existing node matching the ID |id|, and bind this WriteNode to it.
211 // Return true on success. 213 // Return true on success.
212 BaseNode::InitByLookupResult WriteNode::InitByIdLookup(int64 id) { 214 BaseNode::InitByLookupResult WriteNode::InitByIdLookup(int64_t id) {
213 DCHECK(!entry_) << "Init called twice"; 215 DCHECK(!entry_) << "Init called twice";
214 DCHECK_NE(id, kInvalidId); 216 DCHECK_NE(id, kInvalidId);
215 entry_ = new syncable::MutableEntry(transaction_->GetWrappedWriteTrans(), 217 entry_ = new syncable::MutableEntry(transaction_->GetWrappedWriteTrans(),
216 syncable::GET_BY_HANDLE, id); 218 syncable::GET_BY_HANDLE, id);
217 if (!entry_->good()) 219 if (!entry_->good())
218 return INIT_FAILED_ENTRY_NOT_GOOD; 220 return INIT_FAILED_ENTRY_NOT_GOOD;
219 if (entry_->GetIsDel()) 221 if (entry_->GetIsDel())
220 return INIT_FAILED_ENTRY_IS_DEL; 222 return INIT_FAILED_ENTRY_IS_DEL;
221 return DecryptIfNecessary() ? INIT_OK : INIT_FAILED_DECRYPT_IF_NECESSARY; 223 return DecryptIfNecessary() ? INIT_OK : INIT_FAILED_DECRYPT_IF_NECESSARY;
222 } 224 }
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 syncable::Id predecessor_id = 467 syncable::Id predecessor_id =
466 predecessor ? predecessor->GetSyncId() : syncable::Id(); 468 predecessor ? predecessor->GetSyncId() : syncable::Id();
467 return entry_->PutPredecessor(predecessor_id); 469 return entry_->PutPredecessor(predecessor_id);
468 } 470 }
469 471
470 void WriteNode::MarkForSyncing() { 472 void WriteNode::MarkForSyncing() {
471 syncable::MarkForSyncing(entry_); 473 syncable::MarkForSyncing(entry_);
472 } 474 }
473 475
474 } // namespace syncer 476 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/internal_api/test/test_user_share.cc ('k') | sync/internal_api/write_transaction.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698