OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #include <sys/stat.h> | 9 #include <sys/stat.h> |
10 #if defined(OS_POSIX) | 10 #if defined(OS_POSIX) |
11 #include <sys/time.h> | 11 #include <sys/time.h> |
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 MetahandlesIndex::iterator found = | 579 MetahandlesIndex::iterator found = |
580 kernel_->metahandles_index->find(&kernel_->needle); | 580 kernel_->metahandles_index->find(&kernel_->needle); |
581 EntryKernel* entry = (found == kernel_->metahandles_index->end() ? | 581 EntryKernel* entry = (found == kernel_->metahandles_index->end() ? |
582 NULL : *found); | 582 NULL : *found); |
583 if (entry && SafeToPurgeFromMemory(entry)) { | 583 if (entry && SafeToPurgeFromMemory(entry)) { |
584 // We now drop deleted metahandles that are up to date on both the client | 584 // We now drop deleted metahandles that are up to date on both the client |
585 // and the server. | 585 // and the server. |
586 size_t num_erased = 0; | 586 size_t num_erased = 0; |
587 kernel_->flushed_metahandles.Push(entry->ref(META_HANDLE)); | 587 kernel_->flushed_metahandles.Push(entry->ref(META_HANDLE)); |
588 num_erased = kernel_->ids_index->erase(entry); | 588 num_erased = kernel_->ids_index->erase(entry); |
589 DCHECK(1 == num_erased); | 589 DCHECK_EQ(1u, num_erased); |
590 num_erased = kernel_->metahandles_index->erase(entry); | 590 num_erased = kernel_->metahandles_index->erase(entry); |
591 DCHECK(1 == num_erased); | 591 DCHECK_EQ(1u, num_erased); |
592 | 592 |
593 num_erased = kernel_->client_tag_index->erase(entry); // Might not be in
it | 593 // Might not be in it |
594 DCHECK(!entry->ref(UNIQUE_CLIENT_TAG).empty() == num_erased); | 594 num_erased = kernel_->client_tag_index->erase(entry); |
| 595 DCHECK_EQ(entry->ref(UNIQUE_CLIENT_TAG).empty(), !num_erased); |
595 delete entry; | 596 delete entry; |
596 } | 597 } |
597 } | 598 } |
598 | 599 |
599 ExtendedAttributes::const_iterator i = snapshot.dirty_xattrs.begin(); | 600 ExtendedAttributes::const_iterator i = snapshot.dirty_xattrs.begin(); |
600 while (i != snapshot.dirty_xattrs.end()) { | 601 while (i != snapshot.dirty_xattrs.end()) { |
601 ExtendedAttributeKey key(i->first.metahandle, i->first.key); | 602 ExtendedAttributeKey key(i->first.metahandle, i->first.key); |
602 ExtendedAttributes::iterator found = | 603 ExtendedAttributes::iterator found = |
603 kernel_->extended_attributes->find(key); | 604 kernel_->extended_attributes->find(key); |
604 if (found == kernel_->extended_attributes->end() || | 605 if (found == kernel_->extended_attributes->end() || |
(...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1581 return s << std::dec; | 1582 return s << std::dec; |
1582 } | 1583 } |
1583 | 1584 |
1584 FastDump& operator<<(FastDump& dump, const syncable::Blob& blob) { | 1585 FastDump& operator<<(FastDump& dump, const syncable::Blob& blob) { |
1585 if (blob.empty()) | 1586 if (blob.empty()) |
1586 return dump; | 1587 return dump; |
1587 string buffer(HexEncode(&blob[0], blob.size())); | 1588 string buffer(HexEncode(&blob[0], blob.size())); |
1588 dump.out_->sputn(buffer.c_str(), buffer.size()); | 1589 dump.out_->sputn(buffer.c_str(), buffer.size()); |
1589 return dump; | 1590 return dump; |
1590 } | 1591 } |
OLD | NEW |