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

Issue 83001: ImportantFileWriter (Closed)

Created:
11 years, 8 months ago by Paweł Hajdan Jr.
Modified:
9 years, 7 months ago
CC:
chromium-reviews_googlegroups.com
Visibility:
Public.

Description

ImportantFileWriter Introducing a class for writing important files, preventing their corruption during writing. Switched PrefService to use it. Other classes will be switched in future changesets. TEST=This may affect things using preferences. Make sure that changes in preferences don't get lost, and that you don't get excessive disk activity when changing preferences. http://crbug.com/10618 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=14717

Patch Set 1 #

Total comments: 8

Patch Set 2 : updates #

Patch Set 3 : fix Windows weirdness #

Total comments: 1

Patch Set 4 : share more code #

Unified diffs Side-by-side diffs Delta from patch set Stats (+453 lines, -200 lines) Patch
M base/file_util.h View 2 1 chunk +3 lines, -0 lines 0 comments Download
M base/file_util.cc View 2 1 chunk +8 lines, -0 lines 0 comments Download
M base/file_util_posix.cc View 2 3 1 chunk +6 lines, -16 lines 0 comments Download
M base/file_util_win.cc View 2 1 chunk +12 lines, -8 lines 0 comments Download
M chrome/browser/bookmarks/bookmark_utils.cc View 2 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/browser_main.cc View 1 chunk +2 lines, -1 line 0 comments Download
M chrome/browser/browser_process_impl.cc View 2 chunks +2 lines, -2 lines 0 comments Download
M chrome/browser/browser_shutdown.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/importer/importer.cc View 2 chunks +2 lines, -2 lines 0 comments Download
M chrome/browser/metrics/metrics_service.cc View 2 chunks +2 lines, -3 lines 0 comments Download
M chrome/browser/metrics/metrics_service_uitest.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/profile.cc View 2 3 chunks +4 lines, -3 lines 0 comments Download
M chrome/browser/search_engines/template_url_model.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/tab_contents/web_contents_unittest.cc View 2 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/views/options/options_page_view.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/chrome.gyp View 1 2 3 2 chunks +3 lines, -0 lines 0 comments Download
M chrome/common/common.vcproj View 1 chunk +8 lines, -0 lines 0 comments Download
A chrome/common/important_file_writer.h View 1 1 chunk +90 lines, -0 lines 0 comments Download
A chrome/common/important_file_writer.cc View 1 1 chunk +128 lines, -0 lines 0 comments Download
A chrome/common/important_file_writer_unittest.cc View 1 1 chunk +96 lines, -0 lines 0 comments Download
M chrome/common/pref_member_unittest.cc View 4 chunks +4 lines, -3 lines 0 comments Download
M chrome/common/pref_service.h View 4 chunks +24 lines, -42 lines 0 comments Download
M chrome/common/pref_service.cc View 6 chunks +27 lines, -92 lines 0 comments Download
M chrome/common/pref_service_unittest.cc View 8 chunks +24 lines, -20 lines 0 comments Download
M chrome/test/reliability/page_load_test.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/test/testing_profile.h View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 15 (0 generated)
Paweł Hajdan Jr.
I'm attaching just the class and test for now to see if it makes sense. ...
11 years, 8 months ago (2009-04-20 15:49:39 UTC) #1
darin (slow to review)
http://codereview.chromium.org/83001/diff/1/3 File chrome/common/important_file_writer.cc (right): http://codereview.chromium.org/83001/diff/1/3#newcode49 Line 49: if (file_util::Move(tmp_file, path_)) { hmm... this seems wrong. ...
11 years, 8 months ago (2009-04-20 16:20:19 UTC) #2
darin (slow to review)
This reminds me of Mozilla's SafeFileOutputStream class :-)
11 years, 8 months ago (2009-04-20 16:20:21 UTC) #3
Paweł Hajdan Jr.
On 2009/04/20 16:20:21, darin wrote: > This reminds me of Mozilla's SafeFileOutputStream class :-) It ...
11 years, 8 months ago (2009-04-20 16:24:39 UTC) #4
Evan Martin
+adam who has talked about doing this before +dean because it seems like his sort ...
11 years, 8 months ago (2009-04-20 17:49:22 UTC) #5
Evan Martin
Oh, and be sure to remove the [WIP] before you commit.
11 years, 8 months ago (2009-04-20 17:49:51 UTC) #6
agl
NACK based on security issues. http://codereview.chromium.org/83001/diff/1/3 File chrome/common/important_file_writer.cc (right): http://codereview.chromium.org/83001/diff/1/3#newcode31 Line 31: const FilePath tmp_file(path_.InsertBeforeExtension(" ...
11 years, 8 months ago (2009-04-20 17:59:47 UTC) #7
Paweł Hajdan Jr.
I think that most issues with ImportantFileWriter should now be fixed. +brettw I switched PrefService ...
11 years, 8 months ago (2009-04-23 20:00:43 UTC) #8
brettw
This is only used for preferences right, now, right? If we were to serialize on ...
11 years, 8 months ago (2009-04-23 21:27:56 UTC) #9
Paweł Hajdan Jr.
Patch updated. Here are things I'll definitely wait for before committing: agl: Please re-check security ...
11 years, 8 months ago (2009-04-24 18:08:11 UTC) #10
agl
important_file_writer.cc: LGTM
11 years, 8 months ago (2009-04-24 18:12:51 UTC) #11
brettw
http://codereview.chromium.org/83001/diff/5028/5031 File base/file_util_posix.cc (right): http://codereview.chromium.org/83001/diff/5028/5031#newcode377 Line 377: int fd = CreateAndOpenFdForTemporaryFile(directory, path); Can the rest ...
11 years, 8 months ago (2009-04-24 20:32:56 UTC) #12
Paweł Hajdan Jr.
On 2009/04/24 20:32:56, brettw wrote: > http://codereview.chromium.org/83001/diff/5028/5031 > File base/file_util_posix.cc (right): > > http://codereview.chromium.org/83001/diff/5028/5031#newcode377 > ...
11 years, 8 months ago (2009-04-27 08:18:36 UTC) #13
brettw
LGTM
11 years, 8 months ago (2009-04-28 02:06:58 UTC) #14
stoyan
11 years, 7 months ago (2009-05-05 18:59:41 UTC) #15
On Windows ::ReplaceFile() is preferred solution over ::MoveFile()

Powered by Google App Engine
This is Rietveld 408576698