Commit e56b996c authored by Sergei Datsenko's avatar Sergei Datsenko Committed by Commit Bot

Ensure DriveFs search requests always respond.

When DriveFs is unmounted all pending searches are cancelled and
callbacks are not called, but extension API requiries reply always.
Ensure we respond with a default failure when this happens.

BUG=chromium:904605

Change-Id: I2196a13c60ac35ee2aa8ab4a1c9e34e244c1932d
Reviewed-on: https://chromium-review.googlesource.com/c/1343580Reviewed-by: default avatarSam McNally <sammc@chromium.org>
Commit-Queue: Sergei Datsenko <dats@chromium.org>
Cr-Commit-Position: refs/heads/master@{#609595}
parent 975bcf64
......@@ -809,9 +809,13 @@ drivefs::mojom::QueryParameters::QuerySource SearchDriveFs(
base::OnceCallback<void(std::unique_ptr<base::ListValue>)> callback) {
drive::DriveIntegrationService* const integration_service =
drive::util::GetIntegrationServiceByProfile(function->GetProfile());
auto on_response = base::BindOnce(&OnSearchDriveFs, std::move(function),
filter_dirs, std::move(callback));
return integration_service->GetDriveFsHost()->PerformSearch(
std::move(query), base::BindOnce(&OnSearchDriveFs, std::move(function),
filter_dirs, std::move(callback)));
std::move(query),
mojo::WrapCallbackWithDefaultInvokeIfNotRun(
std::move(on_response), drive::FileError::FILE_ERROR_ABORT,
base::Optional<std::vector<drivefs::mojom::QueryItemPtr>>()));
}
void UmaEmitSearchOutcome(
......
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