OLD | NEW |
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> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 return INIT_FAILED_EMPTY_TAG; | 324 return INIT_FAILED_EMPTY_TAG; |
325 } | 325 } |
326 | 326 |
327 const std::string hash = syncable::GenerateSyncableHash(model_type, tag); | 327 const std::string hash = syncable::GenerateSyncableHash(model_type, tag); |
328 | 328 |
329 // Start out with a dummy name. We expect | 329 // Start out with a dummy name. We expect |
330 // the caller to set a meaningful name after creation. | 330 // the caller to set a meaningful name after creation. |
331 string dummy(kDefaultNameForNewNodes); | 331 string dummy(kDefaultNameForNewNodes); |
332 | 332 |
333 // Check if we have this locally and need to undelete it. | 333 // Check if we have this locally and need to undelete it. |
334 scoped_ptr<syncable::MutableEntry> existing_entry( | 334 std::unique_ptr<syncable::MutableEntry> existing_entry( |
335 new syncable::MutableEntry(transaction_->GetWrappedWriteTrans(), | 335 new syncable::MutableEntry(transaction_->GetWrappedWriteTrans(), |
336 syncable::GET_BY_CLIENT_TAG, hash)); | 336 syncable::GET_BY_CLIENT_TAG, hash)); |
337 | 337 |
338 if (existing_entry->good()) { | 338 if (existing_entry->good()) { |
339 if (existing_entry->GetIsDel()) { | 339 if (existing_entry->GetIsDel()) { |
340 // Rules for undelete: | 340 // Rules for undelete: |
341 // BASE_VERSION: Must keep the same. | 341 // BASE_VERSION: Must keep the same. |
342 // ID: Essential to keep the same. | 342 // ID: Essential to keep the same. |
343 // META_HANDLE: Must be the same, so we can't "split" the entry. | 343 // META_HANDLE: Must be the same, so we can't "split" the entry. |
344 // IS_DEL: Must be set to false, will cause reindexing. | 344 // IS_DEL: Must be set to false, will cause reindexing. |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 syncable::Id predecessor_id = | 467 syncable::Id predecessor_id = |
468 predecessor ? predecessor->GetSyncId() : syncable::Id(); | 468 predecessor ? predecessor->GetSyncId() : syncable::Id(); |
469 return entry_->PutPredecessor(predecessor_id); | 469 return entry_->PutPredecessor(predecessor_id); |
470 } | 470 } |
471 | 471 |
472 void WriteNode::MarkForSyncing() { | 472 void WriteNode::MarkForSyncing() { |
473 syncable::MarkForSyncing(entry_); | 473 syncable::MarkForSyncing(entry_); |
474 } | 474 } |
475 | 475 |
476 } // namespace syncer | 476 } // namespace syncer |
OLD | NEW |