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

Unified Diff: net/disk_cache/mem_entry_impl.cc

Issue 12880: Disk cache: Add support for an extra data stream for each cache entry.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years 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 side-by-side diff with in-line comments
Download patch
Index: net/disk_cache/mem_entry_impl.cc
===================================================================
--- net/disk_cache/mem_entry_impl.cc (revision 6334)
+++ net/disk_cache/mem_entry_impl.cc (working copy)
@@ -15,12 +15,13 @@
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 @@
}
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 @@
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::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)

Powered by Google App Engine
This is Rietveld 408576698