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

Issue 6894020: Adds async interface method to PersistentPrefStore. (Closed)

Created:
9 years, 8 months ago by altimofeev
Modified:
9 years, 7 months ago
CC:
chromium-reviews, Paweł Hajdan Jr., Miranda Callahan
Visibility:
Public.

Description

Adds async interface method, which is used by JsonPrefStore. Also see the bug description for more info. BUG=chromium-os:14289 TEST=JsonPrefStoreTest.* Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=84962

Patch Set 1 #

Patch Set 2 : always call OnInit.. #

Total comments: 24

Patch Set 3 : Use Notifications. #

Total comments: 10

Patch Set 4 : merged #

Patch Set 5 : notify PrefValueStore when JsonPrefStore finishes #

Patch Set 6 : move logic to InitFromStorage #

Patch Set 7 : non-static InitFromStorage #

Patch Set 8 : JsonPrefStore cleanup #

Patch Set 9 : nits #

Total comments: 11

Patch Set 10 : unittest for asyn reading #

Total comments: 4

Patch Set 11 : merge #

Patch Set 12 : internal state for PrefValueStore #

Patch Set 13 : prevent multiple calls when failed #

Total comments: 5

Patch Set 14 : prevent leaks #

Patch Set 15 : 2010->2011 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+381 lines, -253 lines) Patch
M chrome/browser/browser_main.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/browser_process_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/chromeos/login/signed_settings_temp_storage_unittest.cc View 1 2 1 chunk +2 lines, -1 line 0 comments Download
M chrome/browser/content_settings/content_settings_pref_provider_unittest.cc View 1 2 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/policy/configuration_policy_pref_store.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/policy/configuration_policy_pref_store_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/prefs/overlay_persistent_pref_store.h View 1 2 3 4 2 chunks +2 lines, -1 line 0 comments Download
M chrome/browser/prefs/overlay_persistent_pref_store.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 3 chunks +11 lines, -2 lines 0 comments Download
M chrome/browser/prefs/pref_notifier.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2 chunks +2 lines, -2 lines 0 comments Download
M chrome/browser/prefs/pref_notifier_impl.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2 chunks +2 lines, -2 lines 0 comments Download
M chrome/browser/prefs/pref_notifier_impl.cc View 1 2 3 4 5 6 7 8 9 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/browser/prefs/pref_notifier_impl_unittest.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/browser/prefs/pref_service.h View 1 2 3 4 5 6 7 8 9 10 5 chunks +10 lines, -25 lines 0 comments Download
M chrome/browser/prefs/pref_service.cc View 1 2 3 4 5 6 7 8 9 10 11 6 chunks +45 lines, -61 lines 0 comments Download
M chrome/browser/prefs/pref_service_mock_builder.cc View 1 2 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/prefs/pref_value_store.h View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +5 lines, -2 lines 0 comments Download
M chrome/browser/prefs/pref_value_store.cc View 1 2 3 4 5 6 7 8 9 10 11 12 4 chunks +16 lines, -5 lines 0 comments Download
M chrome/browser/prefs/pref_value_store_unittest.cc View 1 2 3 4 5 6 7 8 9 10 3 chunks +3 lines, -3 lines 0 comments Download
M chrome/browser/prefs/testing_pref_store.h View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/prefs/testing_pref_store.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 2 chunks +8 lines, -1 line 0 comments Download
M chrome/browser/prefs/value_map_pref_store.cc View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/profiles/profile_impl.h View 1 2 3 4 5 6 7 8 9 10 2 chunks +3 lines, -5 lines 0 comments Download
M chrome/browser/profiles/profile_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 3 chunks +57 lines, -38 lines 0 comments Download
M chrome/common/json_pref_store.h View 1 2 3 4 5 6 7 5 chunks +9 lines, -9 lines 0 comments Download
M chrome/common/json_pref_store.cc View 1 2 3 4 5 6 7 8 9 10 11 7 chunks +66 lines, -54 lines 0 comments Download
M chrome/common/json_pref_store_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 4 chunks +110 lines, -26 lines 0 comments Download
M chrome/common/persistent_pref_store.h View 1 2 3 4 5 6 7 8 2 chunks +15 lines, -1 line 0 comments Download
M chrome/common/pref_store.h View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M chrome/common/pref_store_observer_mock.h View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M chrome/test/testing_pref_service.cc View 1 2 3 4 5 6 2 chunks +1 line, -2 lines 0 comments Download

Messages

Total messages: 18 (0 generated)
altimofeev
9 years, 8 months ago (2011-04-22 15:38:49 UTC) #1
altimofeev
Ping.
9 years, 8 months ago (2011-04-25 15:06:46 UTC) #2
Bernhard Bauer
(Sorry for the hold-up. Friday and Monday are holidays over here in catholic Bavaria, so ...
9 years, 8 months ago (2011-04-25 15:54:10 UTC) #3
Mattias Nissler (ping if slow)
A first round of mostly high-level comments for your consideration. http://codereview.chromium.org/6894020/diff/1011/chrome/browser/prefs/pref_service.cc File chrome/browser/prefs/pref_service.cc (right): http://codereview.chromium.org/6894020/diff/1011/chrome/browser/prefs/pref_service.cc#newcode148 ...
9 years, 8 months ago (2011-04-26 09:04:26 UTC) #4
altimofeev
Tried to satisfy all the comments. Please take a look. http://codereview.chromium.org/6894020/diff/1011/chrome/browser/prefs/pref_service.cc File chrome/browser/prefs/pref_service.cc (right): http://codereview.chromium.org/6894020/diff/1011/chrome/browser/prefs/pref_service.cc#newcode148 ...
9 years, 8 months ago (2011-04-27 10:32:08 UTC) #5
Bernhard Bauer
http://codereview.chromium.org/6894020/diff/1011/chrome/browser/prefs/pref_service.cc File chrome/browser/prefs/pref_service.cc (right): http://codereview.chromium.org/6894020/diff/1011/chrome/browser/prefs/pref_service.cc#newcode204 chrome/browser/prefs/pref_service.cc:204: user_pref_store_->GetErrors(&error, &is_fatal); On 2011/04/27 10:32:08, altimofeev wrote: > On ...
9 years, 8 months ago (2011-04-27 10:52:16 UTC) #6
altimofeev
On 2011/04/27 10:52:16, Bernhard Bauer wrote: > http://codereview.chromium.org/6894020/diff/1011/chrome/browser/prefs/pref_service.cc > File chrome/browser/prefs/pref_service.cc (right): > > http://codereview.chromium.org/6894020/diff/1011/chrome/browser/prefs/pref_service.cc#newcode204 ...
9 years, 8 months ago (2011-04-27 11:26:58 UTC) #7
Mattias Nissler (ping if slow)
Some more comments. Let me know if something is unclear and thanks for being patient ...
9 years, 8 months ago (2011-04-27 12:16:30 UTC) #8
altimofeev
Sorry, that reply takes a long time. In a nutshell, I have implemented scheme suggested ...
9 years, 7 months ago (2011-05-04 13:46:14 UTC) #9
Mattias Nissler (ping if slow)
Thanks for addressing all the previous comments, I think we're pretty close now. http://codereview.chromium.org/6894020/diff/14032/chrome/browser/prefs/pref_notifier_impl.cc File ...
9 years, 7 months ago (2011-05-04 23:33:08 UTC) #10
altimofeev
Thanks for your comments. http://codereview.chromium.org/6894020/diff/14032/chrome/browser/prefs/pref_notifier_impl.cc File chrome/browser/prefs/pref_notifier_impl.cc (right): http://codereview.chromium.org/6894020/diff/14032/chrome/browser/prefs/pref_notifier_impl.cc#newcode83 chrome/browser/prefs/pref_notifier_impl.cc:83: Details<PrefService>(succeeded ? pref_service_ : NULL)); ...
9 years, 7 months ago (2011-05-05 12:59:28 UTC) #11
Mattias Nissler (ping if slow)
First of all, sorry for the delay. I've spent the last couple of days in ...
9 years, 7 months ago (2011-05-07 00:24:14 UTC) #12
altimofeev
As always, thank you for your comments. http://codereview.chromium.org/6894020/diff/14032/chrome/browser/prefs/pref_value_store.cc File chrome/browser/prefs/pref_value_store.cc (right): http://codereview.chromium.org/6894020/diff/14032/chrome/browser/prefs/pref_value_store.cc#newcode243 chrome/browser/prefs/pref_value_store.cc:243: if (!succeeded) ...
9 years, 7 months ago (2011-05-10 11:10:22 UTC) #13
Mattias Nissler (ping if slow)
LGTM pending a comment to be resolved. http://codereview.chromium.org/6894020/diff/33002/chrome/browser/prefs/pref_service.cc File chrome/browser/prefs/pref_service.cc (right): http://codereview.chromium.org/6894020/diff/33002/chrome/browser/prefs/pref_service.cc#newcode230 chrome/browser/prefs/pref_service.cc:230: new ReadErrorHandler())); ...
9 years, 7 months ago (2011-05-10 11:27:50 UTC) #14
altimofeev
http://codereview.chromium.org/6894020/diff/33002/chrome/browser/prefs/pref_service.cc File chrome/browser/prefs/pref_service.cc (right): http://codereview.chromium.org/6894020/diff/33002/chrome/browser/prefs/pref_service.cc#newcode230 chrome/browser/prefs/pref_service.cc:230: new ReadErrorHandler())); On 2011/05/10 11:27:50, Mattias Nissler wrote: > ...
9 years, 7 months ago (2011-05-10 12:01:18 UTC) #15
Mattias Nissler (ping if slow)
http://codereview.chromium.org/6894020/diff/33002/chrome/browser/prefs/pref_service.cc File chrome/browser/prefs/pref_service.cc (right): http://codereview.chromium.org/6894020/diff/33002/chrome/browser/prefs/pref_service.cc#newcode230 chrome/browser/prefs/pref_service.cc:230: new ReadErrorHandler())); On 2011/05/10 12:01:18, altimofeev wrote: > On ...
9 years, 7 months ago (2011-05-10 12:16:41 UTC) #16
altimofeev
http://codereview.chromium.org/6894020/diff/33002/chrome/browser/prefs/pref_service.cc File chrome/browser/prefs/pref_service.cc (right): http://codereview.chromium.org/6894020/diff/33002/chrome/browser/prefs/pref_service.cc#newcode230 chrome/browser/prefs/pref_service.cc:230: new ReadErrorHandler())); On 2011/05/10 12:16:41, Mattias Nissler wrote: > ...
9 years, 7 months ago (2011-05-10 14:24:19 UTC) #17
Mattias Nissler (ping if slow)
9 years, 7 months ago (2011-05-10 14:43:54 UTC) #18
LGTM!

http://codereview.chromium.org/6894020/diff/33002/chrome/browser/prefs/pref_s...
File chrome/browser/prefs/pref_service.cc (right):

http://codereview.chromium.org/6894020/diff/33002/chrome/browser/prefs/pref_s...
chrome/browser/prefs/pref_service.cc:230: new ReadErrorHandler()));
On 2011/05/10 14:24:19, altimofeev wrote:
> On 2011/05/10 12:16:41, Mattias Nissler wrote:
> > On 2011/05/10 12:01:18, altimofeev wrote:
> > > On 2011/05/10 11:27:50, Mattias Nissler wrote:
> > > > It seems like this ReadErrorHandler instance gets leaked. 
> > > > You cloud solve this e.g. by making OnError delete the ReadErrorHandler
> and
> > > > changing the if branch above to
> > > > 
> > > > (new ReadErrorHandler).OnError(user_pref_store_->ReadPrefs());
> > > 
> > > Excuse me, but I didn't get you.
> > > ReadPrefsAsync owns ReadErrorDelegate (delegate is saved as scoped_ptr<>).
> > Also
> > > note, it is mentioned in the corresponding comments.
> > 
> > I'm not talking about the ReadErrorDelegate, but the ReadErrorHandler
instance
> > you create in line 230. I couldn't find where that object gets deleted.
Maybe
> I
> > miss something?
> 
> ReadErrorDelegate is an interface which is implemented by ReadErrorHandler.
Also
> this interface is provided to the ReadPrefsAsync to be called, if reading
error
> occurs.
> 
> So, as I have said, ReadErrorHandler is owned by |user_pref_store_| and will
be
> deleted by it in the end.

Ah, sorry, I didn't realize ReadPrefAsync takes ownership. What you do is
correct.

On a side-note: In this particular case, you could also use the standard
Callback infrastructure (see base/callback.h and base/callback_old.h,
respectively), instead of coding up an ad-hoc interface class. Not a review
comment, feel free to decide yourself :)

> 
> But you are right - I have forgotten to delete it in some PersistenPrefStore
> realizations (non-JsonPrefStore ones) - fixed.

Thanks!

Powered by Google App Engine
This is Rietveld 408576698