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

Issue 2591743002: Implement a method to get the total size of a cache entry (Closed)

Created:
4 years ago by dullweber
Modified:
3 years, 11 months ago
Reviewers:
gavinp
CC:
chromium-reviews, jam, cbentzel+watch_chromium.org, darin-cc_chromium.org, gavinp+disk_chromium.org, kinuko+cache_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Implement a method to get the total size of a cache entry. This method will be used to calculate the size of subsets of the cache in http://crrev.com/2612033002. BUG=671196

Patch Set 1 #

Patch Set 2 : rebase #

Patch Set 3 : rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+51 lines, -0 lines) Patch
M content/browser/blob_storage/blob_reader_unittest.cc View 1 chunk +2 lines, -0 lines 0 comments Download
M net/disk_cache/backend_unittest.cc View 5 chunks +8 lines, -0 lines 0 comments Download
M net/disk_cache/blockfile/entry_impl.h View 1 chunk +1 line, -0 lines 0 comments Download
M net/disk_cache/blockfile/entry_impl.cc View 1 chunk +8 lines, -0 lines 0 comments Download
M net/disk_cache/disk_cache.h View 1 chunk +3 lines, -0 lines 0 comments Download
M net/disk_cache/entry_unittest.cc View 3 chunks +6 lines, -0 lines 0 comments Download
M net/disk_cache/memory/mem_entry_impl.h View 1 chunk +1 line, -0 lines 0 comments Download
M net/disk_cache/memory/mem_entry_impl.cc View 1 chunk +8 lines, -0 lines 0 comments Download
M net/disk_cache/simple/simple_entry_impl.h View 1 chunk +1 line, -0 lines 0 comments Download
M net/disk_cache/simple/simple_entry_impl.cc View 1 chunk +4 lines, -0 lines 0 comments Download
M net/http/mock_http_cache.h View 1 chunk +1 line, -0 lines 0 comments Download
M net/http/mock_http_cache.cc View 1 chunk +8 lines, -0 lines 0 comments Download

Dependent Patchsets:

Messages

Total messages: 14 (8 generated)
dullweber
Gavin, please review this CL.
4 years ago (2016-12-21 13:53:09 UTC) #8
gavinp
On 2016/12/21 13:53:09, dullweber wrote: > Gavin, please review this CL. I'm not convinced that ...
4 years ago (2016-12-22 16:06:57 UTC) #9
gavinp
On 2016/12/22 16:06:57, gavinp wrote: > On 2016/12/21 13:53:09, dullweber wrote: > > Gavin, please ...
4 years ago (2016-12-22 18:37:27 UTC) #10
dullweber
On 2016/12/22 16:06:57, gavinp wrote: > On 2016/12/21 13:53:09, dullweber wrote: > > Gavin, please ...
3 years, 12 months ago (2016-12-27 09:46:38 UTC) #11
dullweber
On 2016/12/22 18:37:27, gavinp wrote: > On 2016/12/22 16:06:57, gavinp wrote: > > On 2016/12/21 ...
3 years, 12 months ago (2016-12-27 09:57:09 UTC) #12
gavinp
3 years, 11 months ago (2017-01-11 17:28:48 UTC) #14
On 2016/12/27 09:57:09, dullweber wrote:
> On 2016/12/22 18:37:27, gavinp wrote:
> > On 2016/12/22 16:06:57, gavinp wrote:
> > > On 2016/12/21 13:53:09, dullweber wrote:
> > > > Gavin, please review this CL.
> > > 
> > > I'm not convinced that we need a separate implementation on each backend.
> This
> > > API doesn't need to be more complex, and I don't see any benefit.
> > > 
> > >   - None of the implementations are really all that accurate, except
perhaps
> > the
> > > one on the Simple Cache backend.
> > >   - And even that one isn't accurate, because of course there's loss from
> > > rounding up allocation units (typically 4096 bytes).
> > > 
> > > So, if you really want this method, why not implement it directly on
> > > disk_cache::Entry?
> > 
> > I peeked briefly at the upstream review. I see what you were thinking about
> > getting it efficiently from the index metadata; that could make this all
very
> > fast. So fast that you probably won't need to bother having the race
described
> > in the bug.
> > 
> > The simple cache implementation of "DoomEntriesBetween" doesn't open the
> entries
> > I believe; so an interface like that could give you your size pretty quickly
> > from the index.
> > 
> > But as long as you're iterating, there's no savings from using the index.
> > Iteration, by its nature, requires opening each entry. And if you have a
> > disk_cache::Entry*, then you already opened the entry. The size data is
stored
> > in core on the IO thread, so you've already paid for it.
> 
> I mostly did the complicated counting with timeout logic for the blockfile
> cache, which is still used on Windows. Is there any plan to replace it with
> SimpleCache as well? Then it would make this all much easier :) I didn't find
a
> way to implement counting the size without opening each entry in the blockfile
> cache. 

But why is GetEntrySize() being implemented separately on each backend. Couldn't
the same implementation serve all three backends?

> My idea is to add a "CacheSizeBetween()" method to the backend that by default
> returns something like ERR_NOT_IMPLEMENTED if there is no efficient way to do
> this and override it for the SimpleCache with a method using the index.
> The CacheCountingHelper with timeout will only be used if the backend returns
> ERR_NOT_IMPLEMENTED from "CacheSizeBetween()".

Sure, this seems fair; or possibly just generalise DoomEntriesBetween() to do
other calculations. This makes more sense to me as a direction to go in the long
run, but I just don't understand why this CL is part of the path to get there.

Powered by Google App Engine
This is Rietveld 408576698