Commit 203f9c7e authored by Eugene But's avatar Eugene But Committed by Commit Bot

Replace dispatch_async with base::PostTaskWithTraits.

TaskShutdownBehavior::BLOCK_SHUTDOWN is used to make sure that
completion handler is always called on shutdown.

Bug: 853774
Cq-Include-Trybots: luci.chromium.try:ios-simulator-cronet;luci.chromium.try:ios-simulator-full-configs
Change-Id: Ief6560419f79055ce9a8d0de47806db5f3f9c9d4
Reviewed-on: https://chromium-review.googlesource.com/1226195Reviewed-by: default avatarSylvain Defresne <sdefresne@chromium.org>
Commit-Queue: Eugene But <eugenebut@chromium.org>
Cr-Commit-Position: refs/heads/master@{#592517}
parent cba8bb5b
......@@ -202,11 +202,10 @@ decideLoadPolicyForRejectedTrustResult:(SecTrustResultType)trustResult
if (SecTrustEvaluate(trust.get(), &trustResult) != errSecSuccess) {
trustResult = kSecTrustResultInvalid;
}
// Use GCD API, which is guaranteed to be called during shutdown.
// See https://crbug.com/853774 for details.
dispatch_async(dispatch_get_main_queue(), ^{
completionHandler(trustResult);
});
TaskTraits traits{WebThread::UI, TaskShutdownBehavior::BLOCK_SHUTDOWN};
base::PostTaskWithTraits(FROM_HERE, traits, base::BindOnce(^{
completionHandler(trustResult);
}));
}));
}
......
......@@ -126,6 +126,7 @@ void WebTestWithWebState::LoadHtml(NSString* html, const GURL& url) {
// Wait until the page is loaded.
ASSERT_TRUE(WaitUntilConditionOrTimeout(kWaitForPageLoadTimeout, ^{
base::RunLoop().RunUntilIdle();
return web_controller.loadPhase == PAGE_LOADED;
}));
......
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