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

Side by Side Diff: net/disk_cache/blockfile/entry_impl.cc

Issue 1304363013: Add a size estimation mechanism to StoragePartitionHttpCacheDataRemover. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Support null max time. Created 5 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/blockfile/entry_impl.h" 5 #include "net/disk_cache/blockfile/entry_impl.h"
6 6
7 #include "base/hash.h" 7 #include "base/hash.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "net/base/io_buffer.h" 10 #include "net/base/io_buffer.h"
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 // The longest key that can be stored using one block. 739 // The longest key that can be stored using one block.
740 int key1_len = 740 int key1_len =
741 static_cast<int>(sizeof(EntryStore) - offsetof(EntryStore, key)); 741 static_cast<int>(sizeof(EntryStore) - offsetof(EntryStore, key));
742 742
743 if (key_size < key1_len || key_size > kMaxInternalKeyLength) 743 if (key_size < key1_len || key_size > kMaxInternalKeyLength)
744 return 1; 744 return 1;
745 745
746 return ((key_size - key1_len) / 256 + 2); 746 return ((key_size - key1_len) / 256 + 2);
747 } 747 }
748 748
749 int EntryImpl::GetEntrySize() const {
750 int result = 0;
751 for (int i = 0; i < kNumStreams; ++i) {
752 result += GetDataSize(i);
753 }
754 return result;
755 }
756
749 // ------------------------------------------------------------------------ 757 // ------------------------------------------------------------------------
750 758
751 void EntryImpl::Doom() { 759 void EntryImpl::Doom() {
752 if (background_queue_.get()) 760 if (background_queue_.get())
753 background_queue_->DoomEntryImpl(this); 761 background_queue_->DoomEntryImpl(this);
754 } 762 }
755 763
756 void EntryImpl::Close() { 764 void EntryImpl::Close() {
757 if (background_queue_.get()) 765 if (background_queue_.get())
758 background_queue_->CloseEntryImpl(this); 766 background_queue_->CloseEntryImpl(this);
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after
1544 Trace("%s 0x%p 0x%x 0x%x", msg, reinterpret_cast<void*>(this), 1552 Trace("%s 0x%p 0x%x 0x%x", msg, reinterpret_cast<void*>(this),
1545 entry_.address().value(), node_.address().value()); 1553 entry_.address().value(), node_.address().value());
1546 1554
1547 Trace(" data: 0x%x 0x%x 0x%x", entry_.Data()->data_addr[0], 1555 Trace(" data: 0x%x 0x%x 0x%x", entry_.Data()->data_addr[0],
1548 entry_.Data()->data_addr[1], entry_.Data()->long_key); 1556 entry_.Data()->data_addr[1], entry_.Data()->long_key);
1549 1557
1550 Trace(" doomed: %d 0x%x", doomed_, dirty); 1558 Trace(" doomed: %d 0x%x", doomed_, dirty);
1551 } 1559 }
1552 1560
1553 } // namespace disk_cache 1561 } // namespace disk_cache
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698