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

Side by Side Diff: net/disk_cache/mem_entry_impl.cc

Issue 174592: Fix DiskCacheEntryTest.MemoryOnlyDoomSparseEntry (Closed)
Patch Set: cache only Created 11 years, 3 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 | « net/disk_cache/entry_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-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 "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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 backend_->ModifyStorageSize(0, static_cast<int32>(key.size())); 62 backend_->ModifyStorageSize(0, static_cast<int32>(key.size()));
63 return true; 63 return true;
64 } 64 }
65 65
66 void MemEntryImpl::Close() { 66 void MemEntryImpl::Close() {
67 // Only a parent entry can be closed. 67 // Only a parent entry can be closed.
68 DCHECK(type() == kParentEntry); 68 DCHECK(type() == kParentEntry);
69 ref_count_--; 69 ref_count_--;
70 DCHECK(ref_count_ >= 0); 70 DCHECK(ref_count_ >= 0);
71 if (!ref_count_ && doomed_) 71 if (!ref_count_ && doomed_)
72 delete this; 72 InternalDoom();
73 } 73 }
74 74
75 void MemEntryImpl::Open() { 75 void MemEntryImpl::Open() {
76 // Only a parent entry can be opened. 76 // Only a parent entry can be opened.
77 // TODO(hclam): make sure it's correct to not apply the concept of ref 77 // TODO(hclam): make sure it's correct to not apply the concept of ref
78 // counting to child entry. 78 // counting to child entry.
79 DCHECK(type() == kParentEntry); 79 DCHECK(type() == kParentEntry);
80 ref_count_++; 80 ref_count_++;
81 DCHECK(ref_count_ >= 0); 81 DCHECK(ref_count_ >= 0);
82 DCHECK(!doomed_); 82 DCHECK(!doomed_);
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 scanned_len += kMaxSparseEntrySize - current_child_offset; 476 scanned_len += kMaxSparseEntrySize - current_child_offset;
477 } 477 }
478 return scanned_len; 478 return scanned_len;
479 } 479 }
480 480
481 void MemEntryImpl::DetachChild(int child_id) { 481 void MemEntryImpl::DetachChild(int child_id) {
482 children_->erase(child_id); 482 children_->erase(child_id);
483 } 483 }
484 484
485 } // namespace disk_cache 485 } // namespace disk_cache
OLDNEW
« no previous file with comments | « net/disk_cache/entry_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698