diff options
author | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-04 23:03:33 +0000 |
---|---|---|
committer | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-04 23:03:33 +0000 |
commit | 62cdf1eb96a4c410b503652a5656e0b197b1b9eb (patch) | |
tree | da020c20415d39f79eab88c4a818934e1df2fede /net/disk_cache/mem_entry_impl.cc | |
parent | a100d13626ad0ddeb4b0a7bb81eb9a736acc4d11 (diff) | |
download | chromium_src-62cdf1eb96a4c410b503652a5656e0b197b1b9eb.zip chromium_src-62cdf1eb96a4c410b503652a5656e0b197b1b9eb.tar.gz chromium_src-62cdf1eb96a4c410b503652a5656e0b197b1b9eb.tar.bz2 |
Disk cache: Add support for an extra data stream for each cache entry.
This is the first step to allow the http cache to store additional metadata
for certain entries.
The cache file format changes to version 2.0 so an effect of this cl is
that the borwser will discard the old cache files.
Review URL: http://codereview.chromium.org/12880
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6392 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/disk_cache/mem_entry_impl.cc')
-rw-r--r-- | net/disk_cache/mem_entry_impl.cc | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/net/disk_cache/mem_entry_impl.cc b/net/disk_cache/mem_entry_impl.cc index 2bbf4a5..6bc7b6b 100644 --- a/net/disk_cache/mem_entry_impl.cc +++ b/net/disk_cache/mem_entry_impl.cc @@ -15,12 +15,13 @@ MemEntryImpl::MemEntryImpl(MemBackendImpl* backend) { doomed_ = false; backend_ = backend; ref_count_ = 0; - data_size_[0] = data_size_[1] = 0; + for (int i = 0; i < NUM_STREAMS; i++) + data_size_[i] = 0; } MemEntryImpl::~MemEntryImpl() { - backend_->ModifyStorageSize(data_size_[0], 0); - backend_->ModifyStorageSize(data_size_[1], 0); + for (int i = 0; i < NUM_STREAMS; i++) + backend_->ModifyStorageSize(data_size_[i], 0); backend_->ModifyStorageSize(static_cast<int32>(key_.size()), 0); } @@ -75,7 +76,7 @@ Time MemEntryImpl::GetLastModified() const { } int32 MemEntryImpl::GetDataSize(int index) const { - if (index < 0 || index > 1) + if (index < 0 || index >= NUM_STREAMS) return 0; return data_size_[index]; @@ -83,7 +84,7 @@ int32 MemEntryImpl::GetDataSize(int index) const { int MemEntryImpl::ReadData(int index, int offset, char* buf, int buf_len, net::CompletionCallback* completion_callback) { - if (index < 0 || index > 1) + if (index < 0 || index >= NUM_STREAMS) return net::ERR_INVALID_ARGUMENT; int entry_size = GetDataSize(index); @@ -105,7 +106,7 @@ int MemEntryImpl::ReadData(int index, int offset, char* buf, int buf_len, int MemEntryImpl::WriteData(int index, int offset, const char* buf, int buf_len, net::CompletionCallback* completion_callback, bool truncate) { - if (index < 0 || index > 1) + if (index < 0 || index >= NUM_STREAMS) return net::ERR_INVALID_ARGUMENT; if (offset < 0 || buf_len < 0) |