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

Issue 2570693002: Fix base::CopyDirectory() and JumpListIcons(Old) folders' operation logic (Closed)

Created:
4 years ago by chengx
Modified:
4 years ago
CC:
chromium-reviews, asvitkine+watch_chromium.org, vmpstr+watch_chromium.org, grt (UTC plus 2)
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Fix base::CopyDirectory() and JumpListIcons(Old) folders' operation logic JumpListIcons(Old) folders are getting unexpectively huge for some users. This is caused by file operation failures. After analyzing those two folders' operation metrics by landing several changes, we find that there are a few issues that need to be fixed. 1) base::CopyDirectory() in file_util_win.cc has incorrect logic when target dir string contains source dir string. Please see detailed comments in the code, 2) When it fails to delete folder |JumpListIconOld|, we should not move folder |JumpListIcon| to |JumpListIconOld|, otherwise |JumpListIconOld| can get unexpectedly huge eventually. 3) When it fails to move folder |JumpListIcon| to |JumpListIconOld|, we should still delete |JumpListIcon| to avoid endless file accumulation in it. To fix the first issue, IsParent() function is used in file_util_win.cc to replace the old logic. I have tested it in a previously checked-in CL. The gathered user data confirms its correctness. It can be found in line 370 of the old version of jumplist.cc in this CL. In that version, I copied and changed a few file operation functions from //base for debugging and testing purposes. We still log one kind of user data for verification and further analysis. This CL also reverts several changes I made for debugging purpose. BUG=40407, 179576 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.win:win10_chromium_x64_rel_ng Committed: https://crrev.com/76561121d20d72e2d54a9071fe30b1db23b128ad Cr-Commit-Position: refs/heads/master@{#438778}

Patch Set 1 #

Total comments: 6

Patch Set 2 : Mark retired metrics as obselete rather than deleting them #

Total comments: 2

Patch Set 3 : Fix deletion logic for JumpListIcon folder #

Total comments: 19

Patch Set 4 : Update comments and fix some nits #

Total comments: 4

Patch Set 5 : Update some comments #

Total comments: 5
Unified diffs Side-by-side diffs Delta from patch set Stats (+85 lines, -287 lines) Patch
M base/files/file_util_win.cc View 1 2 3 4 1 chunk +3 lines, -2 lines 3 comments Download
M chrome/browser/win/jumplist.cc View 1 2 3 4 5 chunks +19 lines, -284 lines 2 comments Download
M tools/metrics/histograms/histograms.xml View 1 2 3 4 chunks +63 lines, -1 line 0 comments Download

Messages

Total messages: 74 (57 generated)
chengx
This CL is ready for review. @Ilya, could you PTAL the metric? @Gabriel, could you ...
4 years ago (2016-12-13 00:24:54 UTC) #20
brucedawson
Are you sure you want to remove the metrics now? It might be better to ...
4 years ago (2016-12-13 00:35:45 UTC) #21
Ilya Sherman
https://codereview.chromium.org/2570693002/diff/1/tools/metrics/histograms/histograms.xml File tools/metrics/histograms/histograms.xml (left): https://codereview.chromium.org/2570693002/diff/1/tools/metrics/histograms/histograms.xml#oldcode74767 tools/metrics/histograms/histograms.xml:74767: - enum="JumplistIconsFolderMoveCategory"> Please mark this metric as <obsolete> rather ...
4 years ago (2016-12-13 00:40:52 UTC) #22
chengx
On 2016/12/13 00:35:45, brucedawson wrote: > Are you sure you want to remove the metrics ...
4 years ago (2016-12-13 01:38:49 UTC) #33
chengx
This patch addressed the comments from Bruce and Ilya. https://codereview.chromium.org/2570693002/diff/1/base/files/file_util_win.cc File base/files/file_util_win.cc (right): https://codereview.chromium.org/2570693002/diff/1/base/files/file_util_win.cc#newcode189 base/files/file_util_win.cc:189: ...
4 years ago (2016-12-13 01:40:17 UTC) #34
Ilya Sherman
https://codereview.chromium.org/2570693002/diff/20001/tools/metrics/histograms/histograms.xml File tools/metrics/histograms/histograms.xml (left): https://codereview.chromium.org/2570693002/diff/20001/tools/metrics/histograms/histograms.xml#oldcode74753 tools/metrics/histograms/histograms.xml:74753: - enum="JumplistIconsDetailedFolderMoveCategory"> It still looks like you've removed the ...
4 years ago (2016-12-13 06:20:08 UTC) #37
chengx
https://codereview.chromium.org/2570693002/diff/20001/tools/metrics/histograms/histograms.xml File tools/metrics/histograms/histograms.xml (left): https://codereview.chromium.org/2570693002/diff/20001/tools/metrics/histograms/histograms.xml#oldcode74753 tools/metrics/histograms/histograms.xml:74753: - enum="JumplistIconsDetailedFolderMoveCategory"> On 2016/12/13 06:20:07, Ilya Sherman wrote: > ...
4 years ago (2016-12-13 18:46:01 UTC) #41
Ilya Sherman
Metrics LGTM % comments https://codereview.chromium.org/2570693002/diff/40001/tools/metrics/histograms/histograms.xml File tools/metrics/histograms/histograms.xml (right): https://codereview.chromium.org/2570693002/diff/40001/tools/metrics/histograms/histograms.xml#newcode74780 tools/metrics/histograms/histograms.xml:74780: + any of these file ...
4 years ago (2016-12-13 21:08:33 UTC) #48
gab
lgtm w/ comments, this is great, thanks! https://codereview.chromium.org/2570693002/diff/40001/base/files/file_util_win.cc File base/files/file_util_win.cc (right): https://codereview.chromium.org/2570693002/diff/40001/base/files/file_util_win.cc#newcode184 base/files/file_util_win.cc:184: // contains ...
4 years ago (2016-12-13 21:31:22 UTC) #49
chengx
https://codereview.chromium.org/2570693002/diff/40001/base/files/file_util_win.cc File base/files/file_util_win.cc (right): https://codereview.chromium.org/2570693002/diff/40001/base/files/file_util_win.cc#newcode184 base/files/file_util_win.cc:184: // contains the other, e.g. C:\\JumpListIcon and C:\\JumpListIconOld. On ...
4 years ago (2016-12-13 23:00:40 UTC) #52
gab
+grt who's digging into the fallouts of base::Move https://codereview.chromium.org/2570693002/diff/40001/chrome/browser/win/jumplist.cc File chrome/browser/win/jumplist.cc (right): https://codereview.chromium.org/2570693002/diff/40001/chrome/browser/win/jumplist.cc#newcode259 chrome/browser/win/jumplist.cc:259: // ...
4 years ago (2016-12-14 15:04:23 UTC) #59
chengx
@Daniel, could you please take a look at this CL? https://codereview.chromium.org/2570693002/diff/40001/chrome/browser/win/jumplist.cc File chrome/browser/win/jumplist.cc (right): https://codereview.chromium.org/2570693002/diff/40001/chrome/browser/win/jumplist.cc#newcode259 ...
4 years ago (2016-12-14 19:07:32 UTC) #61
dcheng
lgtm (sorry for the review latency)
4 years ago (2016-12-15 06:50:45 UTC) #65
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/2570693002/80001
4 years ago (2016-12-15 07:50:16 UTC) #68
commit-bot: I haz the power
Committed patchset #5 (id:80001)
4 years ago (2016-12-15 07:54:29 UTC) #71
commit-bot: I haz the power
Patchset 5 (id:??) landed as https://crrev.com/76561121d20d72e2d54a9071fe30b1db23b128ad Cr-Commit-Position: refs/heads/master@{#438778}
4 years ago (2016-12-15 07:56:17 UTC) #73
grt (UTC plus 2)
4 years ago (2016-12-15 09:23:55 UTC) #74
Message was sent while issue was closed.
post-commit drive-by. please address in a followup CL. thanks.

https://codereview.chromium.org/2570693002/diff/80001/base/files/file_util_wi...
File base/files/file_util_win.cc (right):

https://codereview.chromium.org/2570693002/diff/80001/base/files/file_util_wi...
base/files/file_util_win.cc:180: // Note: it's important to use IsParent() here
as string comparison would
nit: i think this comment is unnecessary. the FilePath API should be used
because it's the right thing. otherwise, why is this one use of IsParent so
important that this comment is justified in comparison to every other use of
IsParent in the codebase?

https://codereview.chromium.org/2570693002/diff/80001/base/files/file_util_wi...
base/files/file_util_win.cc:182: if (real_to_path.value().size() >=
real_from_path.value().size() &&
this "optimization" seems wrong to me -- either a FilePath is treated like a
string (as was with the old code), or it's treated as a FilePath (as it is with
the call to IsParent). i think it's a mistake to mix the two like this.

https://codereview.chromium.org/2570693002/diff/80001/base/files/file_util_wi...
base/files/file_util_win.cc:183: real_from_path.IsParent(real_to_path)) {
please make this same fix in file_util_posix

https://codereview.chromium.org/2570693002/diff/80001/chrome/browser/win/jump...
File chrome/browser/win/jumplist.cc (right):

https://codereview.chromium.org/2570693002/diff/80001/chrome/browser/win/jump...
chrome/browser/win/jumplist.cc:254: int folder_operation_status =
FolderOperationResult::SUCCESS;
nit: always use an unsigned type to hold a bitfield -- uint32_t would be good
here

https://codereview.chromium.org/2570693002/diff/80001/chrome/browser/win/jump...
chrome/browser/win/jumplist.cc:256: if (base::PathExists(icon_dir_old) &&
!base::DeleteFile(icon_dir_old, true)) {
base::PathExists is unnecessary -- DeleteFile returns true if the item didn't
exist (and is documented as such).

Powered by Google App Engine
This is Rietveld 408576698