| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_EQ(1u, num_erased); | 589 DCHECK(1 == num_erased); |
| 590 num_erased = kernel_->metahandles_index->erase(entry); | 590 num_erased = kernel_->metahandles_index->erase(entry); |
| 591 DCHECK_EQ(1u, num_erased); | 591 DCHECK(1 == num_erased); |
| 592 | 592 |
| 593 // Might not be in it | 593 num_erased = kernel_->client_tag_index->erase(entry); // Might not be in
it |
| 594 num_erased = kernel_->client_tag_index->erase(entry); | 594 DCHECK(!entry->ref(UNIQUE_CLIENT_TAG).empty() == num_erased); |
| 595 DCHECK_EQ(entry->ref(UNIQUE_CLIENT_TAG).empty(), !num_erased); | |
| 596 delete entry; | 595 delete entry; |
| 597 } | 596 } |
| 598 } | 597 } |
| 599 | 598 |
| 600 ExtendedAttributes::const_iterator i = snapshot.dirty_xattrs.begin(); | 599 ExtendedAttributes::const_iterator i = snapshot.dirty_xattrs.begin(); |
| 601 while (i != snapshot.dirty_xattrs.end()) { | 600 while (i != snapshot.dirty_xattrs.end()) { |
| 602 ExtendedAttributeKey key(i->first.metahandle, i->first.key); | 601 ExtendedAttributeKey key(i->first.metahandle, i->first.key); |
| 603 ExtendedAttributes::iterator found = | 602 ExtendedAttributes::iterator found = |
| 604 kernel_->extended_attributes->find(key); | 603 kernel_->extended_attributes->find(key); |
| 605 if (found == kernel_->extended_attributes->end() || | 604 if (found == kernel_->extended_attributes->end() || |
| (...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1582 return s << std::dec; | 1581 return s << std::dec; |
| 1583 } | 1582 } |
| 1584 | 1583 |
| 1585 FastDump& operator<<(FastDump& dump, const syncable::Blob& blob) { | 1584 FastDump& operator<<(FastDump& dump, const syncable::Blob& blob) { |
| 1586 if (blob.empty()) | 1585 if (blob.empty()) |
| 1587 return dump; | 1586 return dump; |
| 1588 string buffer(HexEncode(&blob[0], blob.size())); | 1587 string buffer(HexEncode(&blob[0], blob.size())); |
| 1589 dump.out_->sputn(buffer.c_str(), buffer.size()); | 1588 dump.out_->sputn(buffer.c_str(), buffer.size()); |
| 1590 return dump; | 1589 return dump; |
| 1591 } | 1590 } |
| OLD | NEW |