chore: make util::Promise a move-only type (#17071)
This commit is contained in:
parent
a40d826b11
commit
32a4de4a68
29 changed files with 325 additions and 260 deletions
|
@ -177,21 +177,22 @@ bool IsProtocolHandledInIO(
|
|||
return is_handled;
|
||||
}
|
||||
|
||||
void PromiseCallback(scoped_refptr<util::Promise> promise, bool handled) {
|
||||
promise->Resolve(handled);
|
||||
void PromiseCallback(util::Promise promise, bool handled) {
|
||||
promise.Resolve(handled);
|
||||
}
|
||||
|
||||
v8::Local<v8::Promise> Protocol::IsProtocolHandled(const std::string& scheme) {
|
||||
scoped_refptr<util::Promise> promise = new util::Promise(isolate());
|
||||
util::Promise promise(isolate());
|
||||
v8::Local<v8::Promise> handle = promise.GetHandle();
|
||||
auto* getter = static_cast<URLRequestContextGetter*>(
|
||||
browser_context_->GetRequestContext());
|
||||
|
||||
base::PostTaskWithTraitsAndReplyWithResult(
|
||||
FROM_HERE, {content::BrowserThread::IO},
|
||||
base::Bind(&IsProtocolHandledInIO, base::RetainedRef(getter), scheme),
|
||||
base::Bind(&PromiseCallback, promise));
|
||||
base::BindOnce(&IsProtocolHandledInIO, base::RetainedRef(getter), scheme),
|
||||
base::BindOnce(&PromiseCallback, std::move(promise)));
|
||||
|
||||
return promise->GetHandle();
|
||||
return handle;
|
||||
}
|
||||
|
||||
void Protocol::UninterceptProtocol(const std::string& scheme,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue