Commit f8d12991 authored by Ken Rockot's avatar Ken Rockot Committed by Commit Bot

Fix dropped callback in SpellCheckHostChromeImpl

r683358 introduced a bug where in a SpellCheckHost.CallSpellingService
message response callback may be dropped without being called whenever
the source render process has been terminated. That can result in a
DCHECK being hit in testing environments but is otherwise harmless.

This CL fixes the issue by ensuring that the response callback gets
called in the case where the process has been terminated.

Bug: 977637
Change-Id: I6d815be3cad8199c7f8bef27ac10f322b217f881
Tbr: thestig@chromium.org
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1732678Reviewed-by: default avatarKen Rockot <rockot@google.com>
Commit-Queue: Ken Rockot <rockot@google.com>
Cr-Commit-Position: refs/heads/master@{#683506}
parent 1c9dff4e
......@@ -104,8 +104,10 @@ void SpellCheckHostChromeImpl::CallSpellingService(
// a response is received (including an error) from the remote Spelling
// service, calls CallSpellingServiceDone.
auto* host = content::RenderProcessHost::FromID(render_process_id_);
if (!host)
if (!host) {
std::move(callback).Run(false, std::vector<SpellCheckResult>());
return;
}
client_.RequestTextCheck(
host->GetBrowserContext(), SpellingServiceClient::SPELLCHECK, text,
base::BindOnce(&SpellCheckHostChromeImpl::CallSpellingServiceDone,
......
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