Used proper task traits

This commit is contained in:
Simon Hong
2021-11-15 15:46:54 +09:00
parent 0cede88062
commit 1dd14b3d00
2 changed files with 10 additions and 3 deletions
@@ -23,6 +23,7 @@
#include "base/strings/string_util_win.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/threading/scoped_blocking_call.h"
#include "base/win/atl.h"
#include "base/win/registry.h"
#include "base/win/scoped_co_mem.h"
@@ -407,6 +408,9 @@ std::wstring GenerateUserChoiceHash(base::WStringPiece ext,
}
bool SetDefaultProtocolHandlerFor(base::WStringPiece protocol) {
base::ScopedBlockingCall scoped_blocking_call(FROM_HERE,
base::BlockingType::MAY_BLOCK);
if (IsDefaultProtocolHandlerFor(protocol)) {
VLOG(2) << "Already default handler for " << protocol;
return true;
@@ -443,6 +447,9 @@ bool SetDefaultProtocolHandlerFor(base::WStringPiece protocol) {
}
bool IsDefaultProtocolHandlerFor(base::WStringPiece protocol) {
base::ScopedBlockingCall scoped_blocking_call(FROM_HERE,
base::BlockingType::MAY_BLOCK);
const auto prog_id = GetBrowserProgId();
if (!CheckProgIDExists(prog_id)) {
LOG(ERROR) << "ProgId is not found - " << prog_id;
@@ -49,7 +49,7 @@ void MSEdgeProtocolMessageHandler::OnRegValChanged() {
void MSEdgeProtocolMessageHandler::CheckMSEdgeProtocolDefaultHandlerState() {
base::ThreadPool::PostTaskAndReplyWithResult(
FROM_HERE, {base::MayBlock()},
FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_VISIBLE},
base::BindOnce(&IsDefaultProtocolHandlerFor, kMSEdgeProtocol),
base::BindOnce(&MSEdgeProtocolMessageHandler::OnIsDefaultProtocolHandler,
weak_factory_.GetWeakPtr()));
@@ -88,7 +88,7 @@ void MSEdgeProtocolMessageHandler::HandleSetAsDefaultMSEdgeProtocolHandler(
}
base::ThreadPool::PostTaskAndReplyWithResult(
FROM_HERE, {base::MayBlock()},
FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_BLOCKING},
base::BindOnce(&SetDefaultProtocolHandlerFor, kMSEdgeProtocol),
base::BindOnce(&MSEdgeProtocolMessageHandler::OnSetDefaultProtocolHandler,
weak_factory_.GetWeakPtr()));
@@ -121,7 +121,7 @@ void MSEdgeProtocolMessageHandler::LaunchSystemDialog() {
}
base::ThreadPool::PostTask(
FROM_HERE, {base::MayBlock()},
FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_BLOCKING},
base::BindOnce(
[](const base::FilePath& brave_exe) {
ShellUtil::ShowMakeChromeDefaultProtocolClientSystemUI(