| OLD | NEW |
| 1 // Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-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 "net/disk_cache/mem_entry_impl.h" | 5 #include "net/disk_cache/mem_entry_impl.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "net/base/io_buffer.h" | 8 #include "net/base/io_buffer.h" |
| 9 #include "net/base/net_errors.h" | 9 #include "net/base/net_errors.h" |
| 10 #include "net/disk_cache/mem_backend_impl.h" | 10 #include "net/disk_cache/mem_backend_impl.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 if (children_.get()) { | 68 if (children_.get()) { |
| 69 EntryMap children; | 69 EntryMap children; |
| 70 children.swap(*children_); | 70 children.swap(*children_); |
| 71 for (EntryMap::iterator i = children.begin(); | 71 for (EntryMap::iterator i = children.begin(); |
| 72 i != children.end(); ++i) { | 72 i != children.end(); ++i) { |
| 73 // Since a pointer to this object is also saved in the map, avoid | 73 // Since a pointer to this object is also saved in the map, avoid |
| 74 // dooming it. | 74 // dooming it. |
| 75 if (i->second != this) | 75 if (i->second != this) |
| 76 i->second->Doom(); | 76 i->second->Doom(); |
| 77 } | 77 } |
| 78 DCHECK(children_->size() == 0); | 78 DCHECK(children_->empty()); |
| 79 } | 79 } |
| 80 } else { | 80 } else { |
| 81 // If this is a child entry, detach it from the parent. | 81 // If this is a child entry, detach it from the parent. |
| 82 parent_->DetachChild(child_id_); | 82 parent_->DetachChild(child_id_); |
| 83 } | 83 } |
| 84 delete this; | 84 delete this; |
| 85 } | 85 } |
| 86 } | 86 } |
| 87 | 87 |
| 88 void MemEntryImpl::Open() { | 88 void MemEntryImpl::Open() { |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 scanned_len += kMaxSparseEntrySize - current_child_offset; | 487 scanned_len += kMaxSparseEntrySize - current_child_offset; |
| 488 } | 488 } |
| 489 return scanned_len; | 489 return scanned_len; |
| 490 } | 490 } |
| 491 | 491 |
| 492 void MemEntryImpl::DetachChild(int child_id) { | 492 void MemEntryImpl::DetachChild(int child_id) { |
| 493 children_->erase(child_id); | 493 children_->erase(child_id); |
| 494 } | 494 } |
| 495 | 495 |
| 496 } // namespace disk_cache | 496 } // namespace disk_cache |
| OLD | NEW |