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

Issue 881413003: Make SDCH dictionaries persistent across browser restart. (Closed)

Created:
5 years, 10 months ago by Randy Smith (Not in Mondays)
Modified:
3 years, 10 months ago
CC:
chromium-reviews, cbentzel+watch_chromium.org, Elly Fong-Jones
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Make SDCH dictionaries persistent across browser restart. This CL also adds a generic persistence mechanism for //net, separate from Chrome user preferences, that loads asynchronously on startup (i.e. doesn't block startup). BUG=374915 R=mmenke@chromium.org R=ellyjones@chromium.org R=bauerb@chromium.org

Patch Set 1 #

Total comments: 36

Patch Set 2 : Incorporated Bernhard's comments. #

Patch Set 3 : Incorporated Matt's comments. #

Total comments: 28

Patch Set 4 : Incorporated Matt's comments, shifted to WriteablePrefStore, clean up observation and fleshed out e… #

Patch Set 5 : Incorporated all comments. #

Patch Set 6 : Preference registration and UMA. #

Patch Set 7 : Incorporated Matt's suggestion and removed SdchDictionaryFetcher::Data. #

Total comments: 28

Patch Set 8 : First round of persistence tests. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1232 lines, -261 lines) Patch
M chrome/browser/profiles/profile_impl_io_data.h View 1 2 3 4 2 chunks +5 lines, -0 lines 0 comments Download
M chrome/browser/profiles/profile_impl_io_data.cc View 1 2 3 4 5 3 chunks +20 lines, -0 lines 0 comments Download
M chrome/common/chrome_constants.h View 1 chunk +1 line, -0 lines 0 comments Download
M chrome/common/chrome_constants.cc View 1 chunk +2 lines, -0 lines 0 comments Download
M net/sdch/sdch_owner.h View 1 2 3 4 5 7 chunks +53 lines, -6 lines 0 comments Download
M net/sdch/sdch_owner.cc View 1 2 3 4 5 6 7 13 chunks +465 lines, -60 lines 0 comments Download
M net/sdch/sdch_owner_unittest.cc View 1 2 3 4 5 6 7 21 chunks +330 lines, -81 lines 0 comments Download
M net/url_request/sdch_dictionary_fetcher.h View 1 2 3 4 5 6 4 chunks +40 lines, -12 lines 0 comments Download
M net/url_request/sdch_dictionary_fetcher.cc View 1 2 3 4 7 chunks +107 lines, -52 lines 0 comments Download
M net/url_request/sdch_dictionary_fetcher_unittest.cc View 1 2 3 4 15 chunks +190 lines, -49 lines 0 comments Download
M tools/metrics/histograms/histograms.xml View 2 chunks +19 lines, -1 line 0 comments Download

Messages

Total messages: 20 (1 generated)
Randy Smith (Not in Mondays)
I'd like to get some early design level feedback on this approach. This CL isn't ...
5 years, 10 months ago (2015-01-29 00:51:11 UTC) #1
Bernhard Bauer
Using a JSONPrefStore for asynchronous persisted storage is... unconventional, but works out pretty neatly! :) ...
5 years, 10 months ago (2015-01-29 17:42:24 UTC) #2
Randy Smith (Not in Mondays)
On 2015/01/29 17:42:24, Bernhard Bauer wrote: > Using a JSONPrefStore for asynchronous persisted storage is... ...
5 years, 10 months ago (2015-01-29 18:31:33 UTC) #3
Bernhard Bauer
On 2015/01/29 18:31:33, rdsmith wrote: > On 2015/01/29 17:42:24, Bernhard Bauer wrote: > > Using ...
5 years, 10 months ago (2015-01-29 21:56:45 UTC) #4
Randy Smith (Not in Mondays)
> TBH, I'm not completely sure... A SQLite database would probably > do it, for ...
5 years, 10 months ago (2015-01-30 20:11:10 UTC) #5
mmenke
I haven't done a full review, but I think this looks pretty good. https://codereview.chromium.org/881413003/diff/1/chrome/browser/profiles/profile_impl_io_data.cc File ...
5 years, 10 months ago (2015-01-30 20:18:41 UTC) #6
Randy Smith (Not in Mondays)
Awesome! That makes me much more comfortable that I can finish this for M42. Matt, ...
5 years, 10 months ago (2015-01-31 02:53:30 UTC) #7
Bernhard Bauer
https://codereview.chromium.org/881413003/diff/1/net/sdch/sdch_owner.cc File net/sdch/sdch_owner.cc (right): https://codereview.chromium.org/881413003/diff/1/net/sdch/sdch_owner.cc#newcode461 net/sdch/sdch_owner.cc:461: !dict_it.IsAtEnd(); dict_it.Advance()) { On 2015/01/31 02:53:29, rdsmith wrote: > ...
5 years, 10 months ago (2015-02-02 14:39:47 UTC) #8
mmenke
https://codereview.chromium.org/881413003/diff/40001/net/sdch/sdch_owner.cc File net/sdch/sdch_owner.cc (right): https://codereview.chromium.org/881413003/diff/40001/net/sdch/sdch_owner.cc#newcode70 net/sdch/sdch_owner.cc:70: const int kInitialHoursSinceLastUsed = 23; May be beyond the ...
5 years, 10 months ago (2015-02-02 16:35:28 UTC) #9
Randy Smith (Not in Mondays)
New version uploaded. This is everything besides new tests; PTAL. A couple of notes: * ...
5 years, 10 months ago (2015-02-04 19:29:03 UTC) #10
mmenke
https://codereview.chromium.org/881413003/diff/40001/net/sdch/sdch_owner.cc File net/sdch/sdch_owner.cc (right): https://codereview.chromium.org/881413003/diff/40001/net/sdch/sdch_owner.cc#newcode70 net/sdch/sdch_owner.cc:70: const int kInitialHoursSinceLastUsed = 23; On 2015/02/04 19:29:03, rdsmith ...
5 years, 10 months ago (2015-02-04 19:53:46 UTC) #11
Randy Smith (Not in Mondays)
On 2015/02/04 19:53:46, mmenke wrote: > https://codereview.chromium.org/881413003/diff/40001/net/sdch/sdch_owner.cc > File net/sdch/sdch_owner.cc (right): > > https://codereview.chromium.org/881413003/diff/40001/net/sdch/sdch_owner.cc#newcode70 > ...
5 years, 10 months ago (2015-02-04 20:38:09 UTC) #12
mmenke
https://codereview.chromium.org/881413003/diff/120001/chrome/browser/profiles/profile_impl_io_data.cc File chrome/browser/profiles/profile_impl_io_data.cc (right): https://codereview.chromium.org/881413003/diff/120001/chrome/browser/profiles/profile_impl_io_data.cc#newcode434 chrome/browser/profiles/profile_impl_io_data.cc:434: DCHECK(preference_names.insert(net::SdchOwner::PreferenceName()).second); DCHECKs with side effects just seem like a ...
5 years, 10 months ago (2015-02-04 21:14:39 UTC) #13
Randy Smith (Not in Mondays)
Quick response to one comment. https://codereview.chromium.org/881413003/diff/120001/chrome/browser/profiles/profile_impl_io_data.cc File chrome/browser/profiles/profile_impl_io_data.cc (right): https://codereview.chromium.org/881413003/diff/120001/chrome/browser/profiles/profile_impl_io_data.cc#newcode434 chrome/browser/profiles/profile_impl_io_data.cc:434: DCHECK(preference_names.insert(net::SdchOwner::PreferenceName()).second); On 2015/02/04 21:14:39, ...
5 years, 10 months ago (2015-02-04 21:20:24 UTC) #14
mmenke
https://codereview.chromium.org/881413003/diff/120001/chrome/browser/profiles/profile_impl_io_data.cc File chrome/browser/profiles/profile_impl_io_data.cc (right): https://codereview.chromium.org/881413003/diff/120001/chrome/browser/profiles/profile_impl_io_data.cc#newcode434 chrome/browser/profiles/profile_impl_io_data.cc:434: DCHECK(preference_names.insert(net::SdchOwner::PreferenceName()).second); On 2015/02/04 21:20:24, rdsmith wrote: > On 2015/02/04 ...
5 years, 10 months ago (2015-02-04 21:34:32 UTC) #15
Bernhard Bauer
https://codereview.chromium.org/881413003/diff/40001/net/sdch/sdch_owner.cc File net/sdch/sdch_owner.cc (right): https://codereview.chromium.org/881413003/diff/40001/net/sdch/sdch_owner.cc#newcode112 net/sdch/sdch_owner.cc:112: bool success = store->GetMutableValue(kPreferenceName, &result); On 2015/02/04 19:29:03, rdsmith ...
5 years, 10 months ago (2015-02-04 21:48:01 UTC) #16
Randy Smith (Not in Mondays)
On 2015/02/04 21:34:32, mmenke wrote: > https://codereview.chromium.org/881413003/diff/120001/chrome/browser/profiles/profile_impl_io_data.cc > File chrome/browser/profiles/profile_impl_io_data.cc (right): > > https://codereview.chromium.org/881413003/diff/120001/chrome/browser/profiles/profile_impl_io_data.cc#newcode434 > ...
5 years, 10 months ago (2015-02-04 21:48:06 UTC) #17
Bernhard Bauer
On 2015/02/04 21:48:06, rdsmith wrote: > On 2015/02/04 21:34:32, mmenke wrote: > > > https://codereview.chromium.org/881413003/diff/120001/chrome/browser/profiles/profile_impl_io_data.cc ...
5 years, 10 months ago (2015-02-04 21:50:22 UTC) #18
Elly Fong-Jones
5 years, 10 months ago (2015-02-05 23:03:12 UTC) #19
bauerb, mmenke: I've uploaded a new version with these changes at
https://codereview.chromium.org/901303002, please review there :)

https://codereview.chromium.org/881413003/diff/120001/chrome/common/chrome_co...
File chrome/common/chrome_constants.cc (right):

https://codereview.chromium.org/881413003/diff/120001/chrome/common/chrome_co...
chrome/common/chrome_constants.cc:159: FPL("NetworkPersistentState");
On 2015/02/04 21:48:00, Bernhard Bauer wrote:
> Nit: We write out filenames with spaces in between, https://crbug.com/35210
> notwithstanding ;-)

Done.

https://codereview.chromium.org/881413003/diff/120001/net/sdch/sdch_owner.cc
File net/sdch/sdch_owner.cc (right):

https://codereview.chromium.org/881413003/diff/120001/net/sdch/sdch_owner.cc#...
net/sdch/sdch_owner.cc:37: DICTIONARY_FATE_ADD_RESPONSE_TRIGGERRED = 5,
On 2015/02/04 21:48:00, Bernhard Bauer wrote:
> Nit: "triggered" with a single "r". Also in some comments below.

Done.

https://codereview.chromium.org/881413003/diff/120001/net/sdch/sdch_owner.cc#...
net/sdch/sdch_owner.cc:55: enum PersistenceDrop {
On 2015/02/04 21:14:39, mmenke wrote:
> I don't know what a PersistenceDrop is.

Done.

https://codereview.chromium.org/881413003/diff/120001/net/sdch/sdch_owner.cc#...
net/sdch/sdch_owner.cc:72: // Dictionaries that haven't ever been used only stay
fresh for one hour.
On 2015/02/04 21:14:39, mmenke wrote:
> nit:  haven't ever -> have never?

Done.

https://codereview.chromium.org/881413003/diff/120001/net/sdch/sdch_owner.cc#...
net/sdch/sdch_owner.cc:109: const char kPreferenceName[] = "SDCH";
On 2015/02/04 21:14:39, mmenke wrote:
> optional:  Rather than "name" suggest using "key" for these.  Think it's a bit
> more precise.

Done.

https://codereview.chromium.org/881413003/diff/120001/net/sdch/sdch_owner.cc#...
net/sdch/sdch_owner.cc:168: GURL Url() const;
On 2015/02/04 21:14:39, mmenke wrote:
> optional:  Hrm...Url() looks weird on its own to me.  I'd prefix these with
> Get() as a result, but up to you - I can't really say why it looks weird, but
> the others look less so.

I changed this to load all these fields when the iterator advances, then make
these into primitive accessors.

https://codereview.chromium.org/881413003/diff/120001/net/sdch/sdch_owner.cc#...
net/sdch/sdch_owner.cc:230: // when the object goes out of scope.  The
On 2015/02/04 21:48:00, Bernhard Bauer wrote:
> Nit: Dangling "The"

Done.

https://codereview.chromium.org/881413003/diff/120001/net/sdch/sdch_owner.cc#...
net/sdch/sdch_owner.cc:416: DCHECK(avail_bytes >= dictionary_text.size());
On 2015/02/04 21:14:39, mmenke wrote:
> DCHECK_GE?

Done.

https://codereview.chromium.org/881413003/diff/120001/net/sdch/sdch_owner.cc#...
net/sdch/sdch_owner.cc:416: DCHECK(avail_bytes >= dictionary_text.size());
On 2015/02/04 21:48:00, Bernhard Bauer wrote:
> DCHECK_GE for nicer error messages on failure.

Done.

https://codereview.chromium.org/881413003/diff/120001/net/sdch/sdch_owner.cc#...
net/sdch/sdch_owner.cc:596: // This object can stop waiting on (== observing)
the external preference
On 2015/02/04 21:48:00, Bernhard Bauer wrote:
> Super-nit: Double equal signs are only used in code, prose uses single. 

Changed to "i.e."

https://codereview.chromium.org/881413003/diff/120001/net/sdch/sdch_owner.h
File net/sdch/sdch_owner.h (right):

https://codereview.chromium.org/881413003/diff/120001/net/sdch/sdch_owner.h#n...
net/sdch/sdch_owner.h:46: static std::string PreferenceName();
On 2015/02/04 21:14:39, mmenke wrote:
> Should we just make this a static const char[]?  Or get rid of it, per my
> PrefRegistry suggestion.

Done.

https://codereview.chromium.org/881413003/diff/120001/net/url_request/sdch_di...
File net/url_request/sdch_dictionary_fetcher_unittest.cc (right):

https://codereview.chromium.org/881413003/diff/120001/net/url_request/sdch_di...
net/url_request/sdch_dictionary_fetcher_unittest.cc:273:
std::vector<DictionaryAdditions> dictionary_additions;
On 2015/02/04 21:48:01, Bernhard Bauer wrote:
> This should end with an underscore.

Done.

Powered by Google App Engine
This is Rietveld 408576698