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

Side by Side Diff: sync/syncable/directory_backing_store.cc

Issue 805633004: Enable Null Syncable ID which is different than Root ID. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed CR feedback Created 5 years, 12 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
« no previous file with comments | « sync/syncable/directory.cc ('k') | sync/syncable/directory_unittest.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/directory_backing_store.h" 5 #include "sync/syncable/directory_backing_store.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #include <limits> 9 #include <limits>
10 10
(...skipping 1530 matching lines...) Expand 10 before | Expand all | Expand 10 after
1541 it != handles_map->end(); ++it) { 1541 it != handles_map->end(); ++it) {
1542 EntryKernel* entry = it->second; 1542 EntryKernel* entry = it->second;
1543 bool is_duplicate_id = !(ids_set.insert(entry->ref(ID).value()).second); 1543 bool is_duplicate_id = !(ids_set.insert(entry->ref(ID).value()).second);
1544 is_ok = is_ok && !is_duplicate_id; 1544 is_ok = is_ok && !is_duplicate_id;
1545 } 1545 }
1546 1546
1547 IdsSet::iterator end = ids_set.end(); 1547 IdsSet::iterator end = ids_set.end();
1548 for (Directory::MetahandlesMap::const_iterator it = handles_map->begin(); 1548 for (Directory::MetahandlesMap::const_iterator it = handles_map->begin();
1549 it != handles_map->end(); ++it) { 1549 it != handles_map->end(); ++it) {
1550 EntryKernel* entry = it->second; 1550 EntryKernel* entry = it->second;
1551 bool parent_exists = (ids_set.find(entry->ref(PARENT_ID).value()) != end); 1551 if (!entry->ref(PARENT_ID).IsNull()) {
1552 if (!parent_exists) { 1552 bool parent_exists = (ids_set.find(entry->ref(PARENT_ID).value()) != end);
1553 return false; 1553 if (!parent_exists) {
1554 return false;
1555 }
1554 } 1556 }
1555 } 1557 }
1556 return is_ok; 1558 return is_ok;
1557 } 1559 }
1558 1560
1559 void DirectoryBackingStore::PrepareSaveEntryStatement( 1561 void DirectoryBackingStore::PrepareSaveEntryStatement(
1560 EntryTable table, sql::Statement* save_statement) { 1562 EntryTable table, sql::Statement* save_statement) {
1561 if (save_statement->is_valid()) 1563 if (save_statement->is_valid())
1562 return; 1564 return;
1563 1565
(...skipping 22 matching lines...) Expand all
1586 } 1588 }
1587 query.append(" ) "); 1589 query.append(" ) ");
1588 values.append(" )"); 1590 values.append(" )");
1589 query.append(values); 1591 query.append(values);
1590 save_statement->Assign(db_->GetUniqueStatement( 1592 save_statement->Assign(db_->GetUniqueStatement(
1591 base::StringPrintf(query.c_str(), "metas").c_str())); 1593 base::StringPrintf(query.c_str(), "metas").c_str()));
1592 } 1594 }
1593 1595
1594 } // namespace syncable 1596 } // namespace syncable
1595 } // namespace syncer 1597 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/syncable/directory.cc ('k') | sync/syncable/directory_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698