Commit 2ce72991 authored by Joel Hockey's avatar Joel Hockey Committed by Commit Bot

Check crostini deleted paths on threadpool, not IO thread

I erroneously used the IO thread for checking if paths exist
when first creating this code.

Change-Id: I2f0180be7e4ad7caec4d11a28bf3e434533a6e94
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1619444
Auto-Submit: Joel Hockey <joelhockey@chromium.org>
Commit-Queue: Nicholas Verne <nverne@chromium.org>
Reviewed-by: default avatarNicholas Verne <nverne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#661274}
parent 40fab1bb
...@@ -602,14 +602,12 @@ void CrostiniSharePath::OnFileChanged(const base::FilePath& path, bool error) { ...@@ -602,14 +602,12 @@ void CrostiniSharePath::OnFileChanged(const base::FilePath& path, bool error) {
return; return;
} }
base::PostTaskWithTraits( base::PostTaskWithTraits(
FROM_HERE, {content::BrowserThread::IO}, FROM_HERE, {base::MayBlock()},
base::BindOnce(&CrostiniSharePath::CheckIfPathDeletedOnIOThread, base::BindOnce(&CrostiniSharePath::CheckIfPathDeleted,
base::Unretained(this), path)); base::Unretained(this), path));
} }
void CrostiniSharePath::CheckIfPathDeletedOnIOThread( void CrostiniSharePath::CheckIfPathDeleted(const base::FilePath& path) {
const base::FilePath& path) {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
if (base::PathExists(path)) { if (base::PathExists(path)) {
return; return;
} }
......
...@@ -155,8 +155,8 @@ class CrostiniSharePath : public KeyedService, ...@@ -155,8 +155,8 @@ class CrostiniSharePath : public KeyedService,
// Callback for FilePathWatcher. // Callback for FilePathWatcher.
void OnFileChanged(const base::FilePath& path, bool error); void OnFileChanged(const base::FilePath& path, bool error);
// Runs on IO Thread to check if a path is deleted. // Blocking function to check if a path is deleted.
void CheckIfPathDeletedOnIOThread(const base::FilePath& path); void CheckIfPathDeleted(const base::FilePath& path);
// Returns info for specified path or nullptr if not found. // Returns info for specified path or nullptr if not found.
SharedPathInfo* FindSharedPathInfo(const base::FilePath& path); SharedPathInfo* FindSharedPathInfo(const base::FilePath& path);
......
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