OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/sync/syncable/syncable.h" | 5 #include "chrome/browser/sync/syncable/syncable.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cstring> | 8 #include <cstring> |
9 #include <functional> | 9 #include <functional> |
10 #include <iomanip> | 10 #include <iomanip> |
(...skipping 1465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1476 // Some indices don't include deleted items and must be updated | 1476 // Some indices don't include deleted items and must be updated |
1477 // upon a value change. | 1477 // upon a value change. |
1478 ScopedIndexUpdater<ParentIdAndHandleIndexer> updater(lock, kernel_, | 1478 ScopedIndexUpdater<ParentIdAndHandleIndexer> updater(lock, kernel_, |
1479 dir()->kernel_->parent_id_child_index); | 1479 dir()->kernel_->parent_id_child_index); |
1480 | 1480 |
1481 kernel_->put(IS_DEL, is_del); | 1481 kernel_->put(IS_DEL, is_del); |
1482 kernel_->mark_dirty(dir()->kernel_->dirty_metahandles); | 1482 kernel_->mark_dirty(dir()->kernel_->dirty_metahandles); |
1483 } | 1483 } |
1484 | 1484 |
1485 if (!is_del) | 1485 if (!is_del) |
1486 CHECK(PutPredecessor(Id())); // Restores position to the 0th index. | 1486 PutPredecessor(Id()); // Restores position to the 0th index. |
akalin
2011/10/15 00:21:24
should do something instead of silently dropped.
lipalani1
2011/10/15 00:36:31
Done.
| |
1487 | 1487 |
1488 return true; | 1488 return true; |
1489 } | 1489 } |
1490 | 1490 |
1491 bool MutableEntry::Put(Int64Field field, const int64& value) { | 1491 bool MutableEntry::Put(Int64Field field, const int64& value) { |
1492 DCHECK(kernel_); | 1492 DCHECK(kernel_); |
1493 if (kernel_->ref(field) != value) { | 1493 if (kernel_->ref(field) != value) { |
1494 ScopedKernelLock lock(dir()); | 1494 ScopedKernelLock lock(dir()); |
1495 if (SERVER_POSITION_IN_PARENT == field) { | 1495 if (SERVER_POSITION_IN_PARENT == field) { |
1496 ScopedIndexUpdater<ParentIdAndHandleIndexer> updater(lock, kernel_, | 1496 ScopedIndexUpdater<ParentIdAndHandleIndexer> updater(lock, kernel_, |
(...skipping 17 matching lines...) Expand all Loading... | |
1514 } | 1514 } |
1515 | 1515 |
1516 bool MutableEntry::Put(IdField field, const Id& value) { | 1516 bool MutableEntry::Put(IdField field, const Id& value) { |
1517 DCHECK(kernel_); | 1517 DCHECK(kernel_); |
1518 if (kernel_->ref(field) != value) { | 1518 if (kernel_->ref(field) != value) { |
1519 if (ID == field) { | 1519 if (ID == field) { |
1520 if (!dir()->ReindexId(kernel_, value)) | 1520 if (!dir()->ReindexId(kernel_, value)) |
1521 return false; | 1521 return false; |
1522 } else if (PARENT_ID == field) { | 1522 } else if (PARENT_ID == field) { |
1523 PutParentIdPropertyOnly(value); // Makes sibling order inconsistent. | 1523 PutParentIdPropertyOnly(value); // Makes sibling order inconsistent. |
1524 CHECK(PutPredecessor(Id())); // Fixes up the sibling order inconsistency. | 1524 PutPredecessor(Id()); // Fixes up the sibling order inconsistency. |
akalin
2011/10/15 00:21:24
NOTREACHED()
lipalani1
2011/10/15 00:36:31
Done.
| |
1525 } else { | 1525 } else { |
1526 kernel_->put(field, value); | 1526 kernel_->put(field, value); |
1527 } | 1527 } |
1528 kernel_->mark_dirty(dir()->kernel_->dirty_metahandles); | 1528 kernel_->mark_dirty(dir()->kernel_->dirty_metahandles); |
1529 } | 1529 } |
1530 return true; | 1530 return true; |
1531 } | 1531 } |
1532 | 1532 |
1533 void MutableEntry::PutParentIdPropertyOnly(const Id& parent_id) { | 1533 void MutableEntry::PutParentIdPropertyOnly(const Id& parent_id) { |
1534 dir()->ReindexParentId(kernel_, parent_id); | 1534 dir()->ReindexParentId(kernel_, parent_id); |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1970 CHECK(result); | 1970 CHECK(result); |
1971 for (iterator i = GetParentChildIndexLowerBound(lock, parent_id), | 1971 for (iterator i = GetParentChildIndexLowerBound(lock, parent_id), |
1972 end = GetParentChildIndexUpperBound(lock, parent_id); | 1972 end = GetParentChildIndexUpperBound(lock, parent_id); |
1973 i != end; ++i) { | 1973 i != end; ++i) { |
1974 DCHECK_EQ(parent_id, (*i)->ref(PARENT_ID)); | 1974 DCHECK_EQ(parent_id, (*i)->ref(PARENT_ID)); |
1975 result->push_back((*i)->ref(META_HANDLE)); | 1975 result->push_back((*i)->ref(META_HANDLE)); |
1976 } | 1976 } |
1977 } | 1977 } |
1978 | 1978 |
1979 } // namespace syncable | 1979 } // namespace syncable |
OLD | NEW |