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

Issue 2299523003: Add synchronous callback support to important_file_writer.cc (Closed)

Created:
4 years, 3 months ago by proberge
Modified:
4 years, 3 months ago
Reviewers:
gab, dcheng
CC:
chromium-reviews
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Add synchronous callback support to important_file_writer.cc This is required to support post-write callbacks which need to execute even if Chrome is shutting down. Carved out of https://codereview.chromium.org/2204943002/, new call will be used there. BUG=624858 Committed: https://crrev.com/fc46ac15bce89405e0bfff3e246be0111f466318 Cr-Commit-Position: refs/heads/master@{#420102}

Patch Set 1 #

Patch Set 2 : Fix unit test to work on non-Win OSes #

Patch Set 3 : Update a parameter name #

Total comments: 10

Patch Set 4 : Struct -> Enum #

Total comments: 2

Patch Set 5 : Add logic to check that the synchronous callback is invoked before. Also rename successful_write_ob… #

Patch Set 6 : update some comments #

Total comments: 7

Patch Set 7 : Address comments on #6 #

Patch Set 8 : Re-add accidentaly removed test fixture ctor #

Total comments: 11

Patch Set 9 : Start() without options, ResetPolicy Manual #

Patch Set 10 : Use base::Passed, on_write -> OnWrite #

Patch Set 11 : on_successful_write -> OnNextSuccessfulWrite for consistency #

Total comments: 6

Patch Set 12 : Try rebase on 2337253003 #

Patch Set 13 : Try move logic from ImportantFileWriter to JsonPrefStore #

Total comments: 43

Patch Set 14 : Address comments on #13 #

Total comments: 22

Patch Set 15 : Address comments on #14 #

Total comments: 4

Patch Set 16 : Fix last nits #

Patch Set 17 : Move variable declaration down to fix 'initialized after field' warning #

Patch Set 18 : more re-ordering #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+427 lines, -97 lines) Patch
M base/files/important_file_writer.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +11 lines, -13 lines 0 comments Download
M base/files/important_file_writer.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 3 chunks +14 lines, -36 lines 0 comments Download
M base/files/important_file_writer_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 3 chunks +80 lines, -32 lines 0 comments Download
M chrome/browser/prefs/profile_pref_store_manager.cc View 1 2 3 4 5 6 1 chunk +2 lines, -2 lines 0 comments Download
M components/prefs/json_pref_store.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 4 chunks +30 lines, -3 lines 1 comment Download
M components/prefs/json_pref_store.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 3 chunks +64 lines, -3 lines 0 comments Download
M components/prefs/json_pref_store_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 9 chunks +226 lines, -8 lines 0 comments Download

Depends on Patchset:

Dependent Patchsets:

Messages

Total messages: 65 (17 generated)
proberge
4 years, 3 months ago (2016-08-31 19:14:43 UTC) #3
gab
https://codereview.chromium.org/2299523003/diff/40001/base/files/important_file_writer_unittest.cc File base/files/important_file_writer_unittest.cc (right): https://codereview.chromium.org/2299523003/diff/40001/base/files/important_file_writer_unittest.cc#newcode95 base/files/important_file_writer_unittest.cc:95: }; Use an enum instead of a struct to ...
4 years, 3 months ago (2016-08-31 19:45:34 UTC) #4
proberge
https://codereview.chromium.org/2299523003/diff/40001/base/files/important_file_writer_unittest.cc File base/files/important_file_writer_unittest.cc (right): https://codereview.chromium.org/2299523003/diff/40001/base/files/important_file_writer_unittest.cc#newcode95 base/files/important_file_writer_unittest.cc:95: }; On 2016/08/31 19:45:34, gab wrote: > Use an ...
4 years, 3 months ago (2016-08-31 21:06:44 UTC) #5
gab
https://codereview.chromium.org/2299523003/diff/40001/base/files/important_file_writer_unittest.cc File base/files/important_file_writer_unittest.cc (right): https://codereview.chromium.org/2299523003/diff/40001/base/files/important_file_writer_unittest.cc#newcode195 base/files/important_file_writer_unittest.cc:195: cb_state = write_callback_observer_.GetAndResetObservationState(); On 2016/08/31 21:06:44, proberge wrote: > ...
4 years, 3 months ago (2016-09-01 19:59:54 UTC) #6
proberge
@dcheng can you approve the changes for base/files or suggest another reviewer? Thanks! https://codereview.chromium.org/2299523003/diff/40001/base/files/important_file_writer_unittest.cc File ...
4 years, 3 months ago (2016-09-07 19:07:15 UTC) #7
gab
https://codereview.chromium.org/2299523003/diff/100001/base/files/important_file_writer_unittest.cc File base/files/important_file_writer_unittest.cc (right): https://codereview.chromium.org/2299523003/diff/100001/base/files/important_file_writer_unittest.cc#newcode134 base/files/important_file_writer_unittest.cc:134: base::Thread::Options(base::MessageLoop::TYPE_IO, 0)); I don't think you specifically need an ...
4 years, 3 months ago (2016-09-07 19:40:52 UTC) #8
proberge
https://codereview.chromium.org/2299523003/diff/100001/base/files/important_file_writer_unittest.cc File base/files/important_file_writer_unittest.cc (right): https://codereview.chromium.org/2299523003/diff/100001/base/files/important_file_writer_unittest.cc#newcode134 base/files/important_file_writer_unittest.cc:134: base::Thread::Options(base::MessageLoop::TYPE_IO, 0)); On 2016/09/07 19:40:52, gab wrote: > I ...
4 years, 3 months ago (2016-09-08 17:19:31 UTC) #9
gab
lgtm % comments https://codereview.chromium.org/2299523003/diff/100001/base/files/important_file_writer_unittest.cc File base/files/important_file_writer_unittest.cc (right): https://codereview.chromium.org/2299523003/diff/100001/base/files/important_file_writer_unittest.cc#newcode185 base/files/important_file_writer_unittest.cc:185: ImportantFileWriter writer(file_, GetTestThreadTaskRunner()); On 2016/09/08 17:19:31, ...
4 years, 3 months ago (2016-09-08 17:50:46 UTC) #10
proberge
https://codereview.chromium.org/2299523003/diff/140001/base/files/important_file_writer_unittest.cc File base/files/important_file_writer_unittest.cc (right): https://codereview.chromium.org/2299523003/diff/140001/base/files/important_file_writer_unittest.cc#newcode161 base/files/important_file_writer_unittest.cc:161: file_writer_thread.StartWithOptions( On 2016/09/08 17:50:46, gab wrote: > Start() will ...
4 years, 3 months ago (2016-09-08 20:08:34 UTC) #11
dcheng
Also, am I missing something here? Nothing outside the test seems to be calling the ...
4 years, 3 months ago (2016-09-09 05:18:59 UTC) #12
proberge
On 2016/09/09 05:18:59, dcheng wrote: > Also, am I missing something here? Nothing outside the ...
4 years, 3 months ago (2016-09-09 17:23:46 UTC) #13
proberge
Thanks for the review! https://codereview.chromium.org/2299523003/diff/140001/base/files/important_file_writer.cc File base/files/important_file_writer.cc (right): https://codereview.chromium.org/2299523003/diff/140001/base/files/important_file_writer.cc#newcode178 base/files/important_file_writer.cc:178: on_next_write_callback_); On 2016/09/09 05:18:59, dcheng ...
4 years, 3 months ago (2016-09-09 17:24:00 UTC) #14
gab
On 2016/09/09 17:23:46, proberge wrote: > On 2016/09/09 05:18:59, dcheng wrote: > > Also, am ...
4 years, 3 months ago (2016-09-09 19:06:51 UTC) #15
proberge
On 2016/09/09 19:06:51, gab wrote: > On 2016/09/09 17:23:46, proberge wrote: > > On 2016/09/09 ...
4 years, 3 months ago (2016-09-09 19:24:09 UTC) #17
gab
(still lgtm % nit) https://codereview.chromium.org/2299523003/diff/140001/base/files/important_file_writer.cc File base/files/important_file_writer.cc (right): https://codereview.chromium.org/2299523003/diff/140001/base/files/important_file_writer.cc#newcode178 base/files/important_file_writer.cc:178: on_next_write_callback_); On 2016/09/09 17:24:00, proberge ...
4 years, 3 months ago (2016-09-09 19:35:37 UTC) #18
proberge
https://codereview.chromium.org/2299523003/diff/140001/base/files/important_file_writer_unittest.cc File base/files/important_file_writer_unittest.cc (right): https://codereview.chromium.org/2299523003/diff/140001/base/files/important_file_writer_unittest.cc#newcode102 base/files/important_file_writer_unittest.cc:102: void on_write(bool success) { On 2016/09/09 19:35:37, gab wrote: ...
4 years, 3 months ago (2016-09-09 19:45:19 UTC) #19
gab
https://codereview.chromium.org/2299523003/diff/200001/base/files/important_file_writer_unittest.cc File base/files/important_file_writer_unittest.cc (right): https://codereview.chromium.org/2299523003/diff/200001/base/files/important_file_writer_unittest.cc#newcode178 base/files/important_file_writer_unittest.cc:178: wait_helper.Wait(); Note: I just grew tired of having to ...
4 years, 3 months ago (2016-09-13 20:47:37 UTC) #20
dcheng
So I think the main thing that feels weird to me is it seems like ...
4 years, 3 months ago (2016-09-14 06:54:49 UTC) #21
proberge
On 2016/09/14 06:54:49, dcheng wrote: > So I think the main thing that feels weird ...
4 years, 3 months ago (2016-09-14 14:33:34 UTC) #22
gab
On 2016/09/14 14:33:34, proberge wrote: > On 2016/09/14 06:54:49, dcheng wrote: > > So I ...
4 years, 3 months ago (2016-09-14 14:48:46 UTC) #23
dcheng
On 2016/09/14 14:48:46, gab wrote: > On 2016/09/14 14:33:34, proberge wrote: > > On 2016/09/14 ...
4 years, 3 months ago (2016-09-15 09:10:51 UTC) #24
gab
On 2016/09/15 09:10:51, dcheng wrote: > On 2016/09/14 14:48:46, gab wrote: > > On 2016/09/14 ...
4 years, 3 months ago (2016-09-15 13:38:33 UTC) #25
dcheng
On 2016/09/15 13:38:33, gab wrote: > On 2016/09/15 09:10:51, dcheng wrote: > > On 2016/09/14 ...
4 years, 3 months ago (2016-09-15 18:54:00 UTC) #26
gab
On 2016/09/15 18:54:00, dcheng wrote: > On 2016/09/15 13:38:33, gab wrote: > > On 2016/09/15 ...
4 years, 3 months ago (2016-09-15 21:00:35 UTC) #27
dcheng
On 2016/09/15 21:00:35, gab wrote: > On 2016/09/15 18:54:00, dcheng wrote: > > On 2016/09/15 ...
4 years, 3 months ago (2016-09-15 21:09:21 UTC) #28
gab
On 2016/09/15 21:09:21, dcheng wrote: > On 2016/09/15 21:00:35, gab wrote: > > On 2016/09/15 ...
4 years, 3 months ago (2016-09-15 21:15:05 UTC) #29
proberge
On 2016/09/15 21:15:05, gab wrote: > On 2016/09/15 21:09:21, dcheng wrote: > > On 2016/09/15 ...
4 years, 3 months ago (2016-09-16 21:40:42 UTC) #30
dcheng
base LGTM https://codereview.chromium.org/2299523003/diff/240001/base/files/important_file_writer_unittest.cc File base/files/important_file_writer_unittest.cc (right): https://codereview.chromium.org/2299523003/diff/240001/base/files/important_file_writer_unittest.cc#newcode129 base/files/important_file_writer_unittest.cc:129: writer.WriteNow(WrapUnique(new std::string("foo"))); Nit: MakeUnique<std::string> here and elsewhere.
4 years, 3 months ago (2016-09-16 22:42:06 UTC) #31
gab
This looks great but "not lgtm" yet (to remove my previous lgtm) as there is ...
4 years, 3 months ago (2016-09-19 18:01:31 UTC) #32
proberge
https://codereview.chromium.org/2299523003/diff/240001/base/files/important_file_writer.cc File base/files/important_file_writer.cc (right): https://codereview.chromium.org/2299523003/diff/240001/base/files/important_file_writer.cc#newcode175 base/files/important_file_writer.cc:175: auto task = Bind(&WriteScopedStringToFileAtomically, path_, Passed(&data), On 2016/09/19 18:01:30, ...
4 years, 3 months ago (2016-09-19 21:24:26 UTC) #33
dcheng
https://codereview.chromium.org/2299523003/diff/240001/components/prefs/json_pref_store_unittest.cc File components/prefs/json_pref_store_unittest.cc (right): https://codereview.chromium.org/2299523003/diff/240001/components/prefs/json_pref_store_unittest.cc#newcode1075 components/prefs/json_pref_store_unittest.cc:1075: }; On 2016/09/19 21:24:26, proberge wrote: > On 2016/09/19 ...
4 years, 3 months ago (2016-09-20 01:08:57 UTC) #34
gab
Latest approach in JsonPrefStore looks great :-) https://codereview.chromium.org/2299523003/diff/240001/components/prefs/json_pref_store.cc File components/prefs/json_pref_store.cc (right): https://codereview.chromium.org/2299523003/diff/240001/components/prefs/json_pref_store.cc#newcode342 components/prefs/json_pref_store.cc:342: calling_store->has_pending_write_callback_ = ...
4 years, 3 months ago (2016-09-20 01:27:42 UTC) #35
proberge
https://codereview.chromium.org/2299523003/diff/240001/components/prefs/json_pref_store.h File components/prefs/json_pref_store.h (right): https://codereview.chromium.org/2299523003/diff/240001/components/prefs/json_pref_store.h#newcode117 components/prefs/json_pref_store.h:117: // Registers |on_next_write_callback| to be called once, on the ...
4 years, 3 months ago (2016-09-20 15:15:53 UTC) #36
gab
lgtm w/ nits, this is great thanks :-D! https://codereview.chromium.org/2299523003/diff/280001/components/prefs/json_pref_store.cc File components/prefs/json_pref_store.cc (right): https://codereview.chromium.org/2299523003/diff/280001/components/prefs/json_pref_store.cc#newcode350 components/prefs/json_pref_store.cc:350: if ...
4 years, 3 months ago (2016-09-20 17:30:12 UTC) #37
proberge
https://codereview.chromium.org/2299523003/diff/280001/components/prefs/json_pref_store.cc File components/prefs/json_pref_store.cc (right): https://codereview.chromium.org/2299523003/diff/280001/components/prefs/json_pref_store.cc#newcode350 components/prefs/json_pref_store.cc:350: if (!on_next_write_callback.is_null()) { On 2016/09/20 17:30:12, gab wrote: > ...
4 years, 3 months ago (2016-09-20 18:03:28 UTC) #38
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2299523003/300001
4 years, 3 months ago (2016-09-20 18:04:06 UTC) #41
commit-bot: I haz the power
Try jobs failed on following builders: ios-simulator on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-simulator/builds/72381)
4 years, 3 months ago (2016-09-20 18:20:09 UTC) #43
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2299523003/320001
4 years, 3 months ago (2016-09-20 19:40:47 UTC) #46
commit-bot: I haz the power
Try jobs failed on following builders: ios-device on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-device/builds/72165)
4 years, 3 months ago (2016-09-20 19:48:38 UTC) #48
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2299523003/340001
4 years, 3 months ago (2016-09-20 19:57:08 UTC) #51
commit-bot: I haz the power
Try jobs failed on following builders: win_chromium_x64_rel_ng on master.tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_x64_rel_ng/builds/282929)
4 years, 3 months ago (2016-09-20 20:48:44 UTC) #53
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2299523003/340001
4 years, 3 months ago (2016-09-21 14:28:31 UTC) #55
commit-bot: I haz the power
Try jobs failed on following builders: win_chromium_rel_ng on master.tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_rel_ng/builds/297023)
4 years, 3 months ago (2016-09-21 16:27:06 UTC) #57
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2299523003/340001
4 years, 3 months ago (2016-09-21 17:08:29 UTC) #59
gab
https://codereview.chromium.org/2299523003/diff/340001/components/prefs/json_pref_store.h File components/prefs/json_pref_store.h (right): https://codereview.chromium.org/2299523003/diff/340001/components/prefs/json_pref_store.h#newcode120 components/prefs/json_pref_store.h:120: void RegisterOnNextWriteSynchronousCallback( Just realized from https://codereview.chromium.org/2204943002/diff/200001/components/prefs/json_pref_store.cc, this should probably ...
4 years, 3 months ago (2016-09-21 17:49:59 UTC) #60
proberge
On 2016/09/21 17:49:59, gab wrote: > https://codereview.chromium.org/2299523003/diff/340001/components/prefs/json_pref_store.h > File components/prefs/json_pref_store.h (right): > > https://codereview.chromium.org/2299523003/diff/340001/components/prefs/json_pref_store.h#newcode120 > ...
4 years, 3 months ago (2016-09-21 17:54:17 UTC) #61
commit-bot: I haz the power
Committed patchset #18 (id:340001)
4 years, 3 months ago (2016-09-21 18:03:23 UTC) #63
commit-bot: I haz the power
4 years, 3 months ago (2016-09-21 18:06:20 UTC) #65
Message was sent while issue was closed.
Patchset 18 (id:??) landed as
https://crrev.com/fc46ac15bce89405e0bfff3e246be0111f466318
Cr-Commit-Position: refs/heads/master@{#420102}

Powered by Google App Engine
This is Rietveld 408576698