Commit 3fa8fea5 authored by Ken Rockot's avatar Ken Rockot Committed by Chromium LUCI CQ

Ensure clean shutdown of Local Storage in tests

Tests set up Local Storage in a temporary directory. If the directory
has opened files during test shutdown, temp directory deletion can fail
on Windows and cause test flake.

This properly reorders LocalStorageImpl's shutdown synchronization logic
so that we can ensure no LevelDB files remain open once the shutdown
callback is invoked.

Fixed: 1151226
Change-Id: Id9cad4ae8a305e12c965e1fb3d8908b739050cbc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2617869Reviewed-by: default avatarVictor Costan <pwnall@chromium.org>
Commit-Queue: Victor Costan <pwnall@chromium.org>
Commit-Queue: Ken Rockot <rockot@google.com>
Cr-Commit-Position: refs/heads/master@{#841730}
parent 4b853918
...@@ -1102,10 +1102,10 @@ void LocalStorageImpl::OnOriginsDeleted(leveldb::Status status) { ...@@ -1102,10 +1102,10 @@ void LocalStorageImpl::OnOriginsDeleted(leveldb::Status status) {
void LocalStorageImpl::OnShutdownComplete() { void LocalStorageImpl::OnShutdownComplete() {
DCHECK(shutdown_complete_callback_); DCHECK(shutdown_complete_callback_);
// Flush any final tasks on the DB task runner before invoking the callback. // Flush any final tasks on the DB task runner before invoking the callback.
leveldb_task_runner_->PostTaskAndReply(
FROM_HERE, base::DoNothing(), std::move(shutdown_complete_callback_));
PurgeAllStorageAreas(); PurgeAllStorageAreas();
database_.reset(); database_.reset();
leveldb_task_runner_->PostTaskAndReply(
FROM_HERE, base::DoNothing(), std::move(shutdown_complete_callback_));
} }
void LocalStorageImpl::GetStatistics(size_t* total_cache_size, void LocalStorageImpl::GetStatistics(size_t* total_cache_size,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment