Currently EnsureArchivesDirCreatedImpl will cause a crash on release in case the directory creation fails. Other use cases of base::CreateDirectory failures are generally handled gracefully so it seems the same should happen here.
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/9cbc9e00f731772c85ab54f9dad713bafd0d7ee4 commit 9cbc9e00f731772c85ab54f9dad713bafd0d7ee4 Author: Yafei Duan <romax@chromium.org> Date: Wed May 31 20:05:59 2017 [Offline Pages] Ensure the archive folder exists when saving a page. Move the logic ensuring archives directory is created from the startup of OfflinePageModel to every time saving a page. This change will also handle the directory creation gracefully to not crash Chrome. Bug: 725266 Change-Id: Iec46b007e51c33d90c3e282919a6313d7a5e3f85 Reviewed-on: https://chromium-review.googlesource.com/513984 Commit-Queue: Yafei Duan <romax@chromium.org> Reviewed-by: Filip Gorski <fgorski@chromium.org> Cr-Commit-Position: refs/heads/master@{#475992} [modify] https://crrev.com/9cbc9e00f731772c85ab54f9dad713bafd0d7ee4/components/offline_pages/core/archive_manager.cc [modify] https://crrev.com/9cbc9e00f731772c85ab54f9dad713bafd0d7ee4/components/offline_pages/core/archive_manager.h [modify] https://crrev.com/9cbc9e00f731772c85ab54f9dad713bafd0d7ee4/components/offline_pages/core/archive_manager_unittest.cc [modify] https://crrev.com/9cbc9e00f731772c85ab54f9dad713bafd0d7ee4/components/offline_pages/core/offline_page_model_impl.cc [modify] https://crrev.com/9cbc9e00f731772c85ab54f9dad713bafd0d7ee4/components/offline_pages/core/offline_page_model_impl.h [modify] https://crrev.com/9cbc9e00f731772c85ab54f9dad713bafd0d7ee4/components/offline_pages/core/offline_page_model_impl_unittest.cc [modify] https://crrev.com/9cbc9e00f731772c85ab54f9dad713bafd0d7ee4/components/offline_pages/core/offline_page_types.h [modify] https://crrev.com/9cbc9e00f731772c85ab54f9dad713bafd0d7ee4/tools/metrics/histograms/enums.xml
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/04b1442d27ae436d542e0e2ad0a072f7d4a5ec12 commit 04b1442d27ae436d542e0e2ad0a072f7d4a5ec12 Author: John Budorick <jbudorick@chromium.org> Date: Thu Jun 01 01:48:49 2017 Revert "[Offline Pages] Ensure the archive folder exists when saving a page." This reverts commit 9cbc9e00f731772c85ab54f9dad713bafd0d7ee4. Reason for revert: https://bugs.chromium.org/p/chromium/issues/detail?id=728433 Original change's description: > [Offline Pages] Ensure the archive folder exists when saving a page. > > Move the logic ensuring archives directory is created from the startup of > OfflinePageModel to every time saving a page. This change will also handle > the directory creation gracefully to not crash Chrome. > > Bug: 725266 > Change-Id: Iec46b007e51c33d90c3e282919a6313d7a5e3f85 > Reviewed-on: https://chromium-review.googlesource.com/513984 > Commit-Queue: Yafei Duan <romax@chromium.org> > Reviewed-by: Filip Gorski <fgorski@chromium.org> > Cr-Commit-Position: refs/heads/master@{#475992} TBR=fgorski@chromium.org,romax@chromium.org No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: 725266 Change-Id: Ic9da92f529b68f3b472c072cecec2b9fc1059802 Reviewed-on: https://chromium-review.googlesource.com/520484 Reviewed-by: John Budorick <jbudorick@chromium.org> Commit-Queue: John Budorick <jbudorick@chromium.org> Cr-Commit-Position: refs/heads/master@{#476138} [modify] https://crrev.com/04b1442d27ae436d542e0e2ad0a072f7d4a5ec12/components/offline_pages/core/archive_manager.cc [modify] https://crrev.com/04b1442d27ae436d542e0e2ad0a072f7d4a5ec12/components/offline_pages/core/archive_manager.h [modify] https://crrev.com/04b1442d27ae436d542e0e2ad0a072f7d4a5ec12/components/offline_pages/core/archive_manager_unittest.cc [modify] https://crrev.com/04b1442d27ae436d542e0e2ad0a072f7d4a5ec12/components/offline_pages/core/offline_page_model_impl.cc [modify] https://crrev.com/04b1442d27ae436d542e0e2ad0a072f7d4a5ec12/components/offline_pages/core/offline_page_model_impl.h [modify] https://crrev.com/04b1442d27ae436d542e0e2ad0a072f7d4a5ec12/components/offline_pages/core/offline_page_model_impl_unittest.cc [modify] https://crrev.com/04b1442d27ae436d542e0e2ad0a072f7d4a5ec12/components/offline_pages/core/offline_page_types.h [modify] https://crrev.com/04b1442d27ae436d542e0e2ad0a072f7d4a5ec12/tools/metrics/histograms/enums.xml
The previous approach introduced increment of crash possibility and flaky tests and got reverted. Will upload another patch with another approach.
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/edf8e43c615fb02a9350a01ee4cfd0a5144fc2c2 commit edf8e43c615fb02a9350a01ee4cfd0a5144fc2c2 Author: Yafei Duan <romax@chromium.org> Date: Tue Jun 20 23:12:44 2017 [Offline Pages] Create archive directories if archive creation failed. Added the logic to create archive directories if the result of SavePage is ARCHIVE_CREATION_FAILED. This is going to prevent potential increment of failure rate once we move temporary pages to cache directory, and download pages to external downloads directory which are vulnerable to removal by user actions. Also added an UMA counting the result of archive creation and related tests. Bug: 725266 Change-Id: Id726365ea53786077d71b02831f6dfca0d16c4f3 Reviewed-on: https://chromium-review.googlesource.com/540995 Reviewed-by: Steven Holte <holte@chromium.org> Reviewed-by: Filip Gorski <fgorski@chromium.org> Commit-Queue: Yafei Duan <romax@chromium.org> Cr-Commit-Position: refs/heads/master@{#481014} [modify] https://crrev.com/edf8e43c615fb02a9350a01ee4cfd0a5144fc2c2/components/offline_pages/core/archive_manager.cc [modify] https://crrev.com/edf8e43c615fb02a9350a01ee4cfd0a5144fc2c2/components/offline_pages/core/archive_manager_unittest.cc [modify] https://crrev.com/edf8e43c615fb02a9350a01ee4cfd0a5144fc2c2/components/offline_pages/core/offline_page_model_impl.cc [modify] https://crrev.com/edf8e43c615fb02a9350a01ee4cfd0a5144fc2c2/tools/metrics/histograms/histograms.xml
Comment 1 by romax@chromium.org
, May 30 2017