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

Issue 14877019: Minor SimpleCacheBackend improvements. (Closed)

Created:
7 years, 7 months ago by digit1
Modified:
7 years, 6 months ago
Reviewers:
pasko, felipeg, Philippe, gavinp
CC:
chromium-reviews, cbentzel+watch_chromium.org, gavinp+disk_chromium.org
Base URL:
http://git.chromium.org/chromium/src.git@master
Visibility:
Public.

Description

Minor SimpleCacheBackend improvements. - Use a base::hash_map instead of a std::map for the SimpleBackendImpl::EntryMap type, to reduce heap usage. This saves 3 pointers/node on Android, since there is no need for an ordered map here. - Avoid creating a new closure on every call to SimpleIndex::PostponeWritingToDisk. Each base::Bind() call creates a new heap-allocated reference-counted object. Given that this function is called for every mutating operation on the index, it's a good idea to get rid of it. Since the called function and its argument never change, create the closure only once and reuse it on every write_to_disk_timer_.Start() call. - Avoid performing one extra lookup and one extra call to PostponeWritingToDisk() in SimpleIndex::Remove(). - Remove un-necessary temporary string creations and a tiny typo. R=felipeg@chromium.org, gavinp@chromium.org, pasko@chromium.org, pliard@chromium.org BUG= Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=204035

Patch Set 1 #

Total comments: 10

Patch Set 2 : Made failed Open and Create an UNINITIALIZED, added a test. #

Patch Set 3 : Made failed Open and Create an UNINITIALIZED, added a test. #

Patch Set 4 : rebase #

Total comments: 10

Patch Set 5 : simple rebase #

Patch Set 6 : nits #

Total comments: 2

Patch Set 7 : Use sizeof("_0") - 1' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+32 lines, -20 lines) Patch
M net/disk_cache/simple/simple_backend_impl.h View 1 2 3 2 chunks +2 lines, -2 lines 0 comments Download
M net/disk_cache/simple/simple_index.h View 1 2 3 4 5 6 2 chunks +4 lines, -0 lines 0 comments Download
M net/disk_cache/simple/simple_index.cc View 1 2 3 4 5 6 7 chunks +26 lines, -18 lines 0 comments Download

Messages

Total messages: 15 (0 generated)
digit1
7 years, 7 months ago (2013-05-17 08:47:47 UTC) #1
pasko
https://chromiumcodereview.appspot.com/14877019/diff/1/net/disk_cache/simple/simple_backend_impl.h File net/disk_cache/simple/simple_backend_impl.h (right): https://chromiumcodereview.appspot.com/14877019/diff/1/net/disk_cache/simple/simple_backend_impl.h#newcode88 net/disk_cache/simple/simple_backend_impl.h:88: typedef base::hash_map<uint64, base::WeakPtr<SimpleEntryImpl> > EntryMap; This change cannot make ...
7 years, 7 months ago (2013-05-17 10:31:33 UTC) #2
digit1
https://chromiumcodereview.appspot.com/14877019/diff/1/net/disk_cache/simple/simple_backend_impl.h File net/disk_cache/simple/simple_backend_impl.h (right): https://chromiumcodereview.appspot.com/14877019/diff/1/net/disk_cache/simple/simple_backend_impl.h#newcode88 net/disk_cache/simple/simple_backend_impl.h:88: typedef base::hash_map<uint64, base::WeakPtr<SimpleEntryImpl> > EntryMap; I feel that these ...
7 years, 7 months ago (2013-05-17 14:36:18 UTC) #3
pasko
https://chromiumcodereview.appspot.com/14877019/diff/1/net/disk_cache/simple/simple_backend_impl.h File net/disk_cache/simple/simple_backend_impl.h (right): https://chromiumcodereview.appspot.com/14877019/diff/1/net/disk_cache/simple/simple_backend_impl.h#newcode88 net/disk_cache/simple/simple_backend_impl.h:88: typedef base::hash_map<uint64, base::WeakPtr<SimpleEntryImpl> > EntryMap; On 2013/05/17 14:36:18, digit1 ...
7 years, 7 months ago (2013-05-17 16:57:19 UTC) #4
gavinp
Something weird has happened to this CL... I don't understand the two latest uploads.
7 years, 7 months ago (2013-05-21 16:39:15 UTC) #5
pasko-google - do not use
On 2013/05/21 16:39:15, gavinp wrote: > Something weird has happened to this CL... I don't ...
7 years, 7 months ago (2013-05-21 16:45:26 UTC) #6
digit
Spooky, I've rebased and re-uploaded the patch. By the way, I had the following message ...
7 years, 7 months ago (2013-05-21 19:51:14 UTC) #7
gavinp
On 2013/05/21 19:51:14, digit wrote: > Spooky, I've rebased and re-uploaded the patch. By the ...
7 years, 7 months ago (2013-05-21 19:54:09 UTC) #8
gavinp
https://codereview.chromium.org/14877019/diff/19001/net/disk_cache/simple/simple_index.cc File net/disk_cache/simple/simple_index.cc (right): https://codereview.chromium.org/14877019/diff/19001/net/disk_cache/simple/simple_index.cc#newcode170 net/disk_cache/simple/simple_index.cc:170: write_to_disk_cb_ = base::Bind(&SimpleIndex::WriteToDisk, AsWeakPtr()); Why not place this in ...
7 years, 7 months ago (2013-05-21 19:59:21 UTC) #9
digit1
https://codereview.chromium.org/14877019/diff/19001/net/disk_cache/simple/simple_index.cc File net/disk_cache/simple/simple_index.cc (right): https://codereview.chromium.org/14877019/diff/19001/net/disk_cache/simple/simple_index.cc#newcode170 net/disk_cache/simple/simple_index.cc:170: write_to_disk_cb_ = base::Bind(&SimpleIndex::WriteToDisk, AsWeakPtr()); On 2013/05/21 19:59:21, gavinp wrote: ...
7 years, 6 months ago (2013-05-30 13:17:58 UTC) #10
pasko
https://codereview.chromium.org/14877019/diff/30001/net/disk_cache/simple/simple_index.cc File net/disk_cache/simple/simple_index.cc (right): https://codereview.chromium.org/14877019/diff/30001/net/disk_cache/simple/simple_index.cc#newcode352 net/disk_cache/simple/simple_index.cc:352: UpdateEntryIteratorSize(&it, entry_size); Somehow adding this function looks less awkward ...
7 years, 6 months ago (2013-05-30 13:47:10 UTC) #11
gavinp
lgtm https://codereview.chromium.org/14877019/diff/30001/net/disk_cache/simple/simple_index.cc File net/disk_cache/simple/simple_index.cc (right): https://codereview.chromium.org/14877019/diff/30001/net/disk_cache/simple/simple_index.cc#newcode489 net/disk_cache/simple/simple_index.cc:489: const int kFileSuffixLength = strlen("_0"); As long as ...
7 years, 6 months ago (2013-05-30 13:50:40 UTC) #12
digit1
On 2013/05/30 13:50:40, gavinp wrote: > As long as we're playing this game, you could ...
7 years, 6 months ago (2013-06-04 14:58:45 UTC) #13
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/digit@chromium.org/14877019/41001
7 years, 6 months ago (2013-06-04 16:14:46 UTC) #14
commit-bot: I haz the power
7 years, 6 months ago (2013-06-04 20:47:32 UTC) #15
Message was sent while issue was closed.
Change committed as 204035

Powered by Google App Engine
This is Rietveld 408576698