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

Unified Diff: net/disk_cache/simple/simple_entry_impl.cc

Issue 2842193002: A crude cut at incorporating stream 1 footer read into stream 0 read.
Patch Set: Rebase. Still needs design re-thought Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/disk_cache/simple/simple_synchronous_entry.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/simple/simple_entry_impl.cc
diff --git a/net/disk_cache/simple/simple_entry_impl.cc b/net/disk_cache/simple/simple_entry_impl.cc
index 62347507f8d8d61b2e272901670212bbe5399cbf..03e2d4c9e7f4b205084a135d02002ed0d047f1f5 100644
--- a/net/disk_cache/simple/simple_entry_impl.cc
+++ b/net/disk_cache/simple/simple_entry_impl.cc
@@ -1484,6 +1484,8 @@ int SimpleEntryImpl::SetStream0Data(net::IOBuffer* buf,
int data_size = GetDataSize(0);
if (offset == 0 && truncate) {
RecordHeaderSizeChange(cache_type_, data_size, buf_len);
+ // Undo some of the offset weirdness from SimpleSynchronousEntry
+ stream_0_data_->set_offset(0);
stream_0_data_->SetCapacity(buf_len);
memcpy(stream_0_data_->data(), buf->data(), buf_len);
data_size_[0] = buf_len;
@@ -1491,7 +1493,7 @@ int SimpleEntryImpl::SetStream0Data(net::IOBuffer* buf,
RecordUnexpectedStream0Write(cache_type_);
const int buffer_size =
truncate ? offset + buf_len : std::max(offset + buf_len, data_size);
- stream_0_data_->SetCapacity(buffer_size);
+ stream_0_data_->SetCapacity(buffer_size + stream_0_data_->offset());
// If |stream_0_data_| was extended, the extension until offset needs to be
// zero-filled.
const int fill_size = offset <= data_size ? 0 : offset - data_size;
« no previous file with comments | « no previous file | net/disk_cache/simple/simple_synchronous_entry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698