chore: convert more files away from base::Bind (#18121)
* chore: convert more files away from base::Bind * use BindOnce for JsAsker
This commit is contained in:
parent
c25c31e018
commit
0755857a0c
24 changed files with 86 additions and 71 deletions
|
@ -9,9 +9,9 @@
|
|||
#include "atom/browser/api/atom_api_session.h"
|
||||
#include "atom/browser/net/atom_url_request.h"
|
||||
#include "atom/common/api/event_emitter_caller.h"
|
||||
#include "atom/common/native_mate_converters/callback.h"
|
||||
#include "atom/common/native_mate_converters/gurl_converter.h"
|
||||
#include "atom/common/native_mate_converters/net_converter.h"
|
||||
#include "atom/common/native_mate_converters/once_callback.h"
|
||||
#include "atom/common/native_mate_converters/string16_converter.h"
|
||||
#include "atom/common/node_includes.h"
|
||||
#include "native_mate/dictionary.h"
|
||||
|
@ -365,7 +365,7 @@ void URLRequest::OnAuthenticationRequired(
|
|||
}
|
||||
|
||||
Emit("login", auth_info,
|
||||
base::Bind(&AtomURLRequest::PassLoginInformation, atom_request_));
|
||||
base::BindOnce(&AtomURLRequest::PassLoginInformation, atom_request_));
|
||||
}
|
||||
|
||||
void URLRequest::OnResponseStarted(
|
||||
|
|
|
@ -346,7 +346,8 @@ WebContents::WebContents(v8::Isolate* isolate,
|
|||
#if BUILDFLAG(ENABLE_OSR)
|
||||
if (embedder_ && embedder_->IsOffScreen()) {
|
||||
auto* view = new OffScreenWebContentsView(
|
||||
false, base::Bind(&WebContents::OnPaint, base::Unretained(this)));
|
||||
false,
|
||||
base::BindRepeating(&WebContents::OnPaint, base::Unretained(this)));
|
||||
params.view = view;
|
||||
params.delegate_view = view;
|
||||
|
||||
|
@ -363,7 +364,8 @@ WebContents::WebContents(v8::Isolate* isolate,
|
|||
|
||||
content::WebContents::CreateParams params(session->browser_context());
|
||||
auto* view = new OffScreenWebContentsView(
|
||||
transparent, base::Bind(&WebContents::OnPaint, base::Unretained(this)));
|
||||
transparent,
|
||||
base::BindRepeating(&WebContents::OnPaint, base::Unretained(this)));
|
||||
params.view = view;
|
||||
params.delegate_view = view;
|
||||
|
||||
|
@ -640,8 +642,9 @@ void WebContents::EnterFullscreenModeForTab(
|
|||
const blink::WebFullscreenOptions& options) {
|
||||
auto* permission_helper =
|
||||
WebContentsPermissionHelper::FromWebContents(source);
|
||||
auto callback = base::Bind(&WebContents::OnEnterFullscreenModeForTab,
|
||||
base::Unretained(this), source, origin, options);
|
||||
auto callback =
|
||||
base::BindRepeating(&WebContents::OnEnterFullscreenModeForTab,
|
||||
base::Unretained(this), source, origin, options);
|
||||
permission_helper->RequestFullscreenPermission(callback);
|
||||
}
|
||||
|
||||
|
@ -680,8 +683,9 @@ bool WebContents::HandleContextMenu(content::RenderFrameHost* render_frame_host,
|
|||
const content::ContextMenuParams& params) {
|
||||
if (params.custom_context.is_pepper_menu) {
|
||||
Emit("pepper-context-menu", std::make_pair(params, web_contents()),
|
||||
base::Bind(&content::WebContents::NotifyContextMenuClosed,
|
||||
base::Unretained(web_contents()), params.custom_context));
|
||||
base::BindOnce(&content::WebContents::NotifyContextMenuClosed,
|
||||
base::Unretained(web_contents()),
|
||||
params.custom_context));
|
||||
} else {
|
||||
Emit("context-menu", std::make_pair(params, web_contents()));
|
||||
}
|
||||
|
|
|
@ -748,7 +748,7 @@ content::BrowserMainParts* AtomBrowserClient::CreateBrowserMainParts(
|
|||
|
||||
void AtomBrowserClient::WebNotificationAllowed(
|
||||
int render_process_id,
|
||||
const base::Callback<void(bool, bool)>& callback) {
|
||||
const base::RepeatingCallback<void(bool, bool)>& callback) {
|
||||
content::WebContents* web_contents =
|
||||
WebContentsPreferences::GetWebContentsFromProcessID(render_process_id);
|
||||
if (!web_contents) {
|
||||
|
|
|
@ -151,7 +151,7 @@ void OverrideLinuxAppDataPath() {
|
|||
int BrowserX11ErrorHandler(Display* d, XErrorEvent* error) {
|
||||
if (!g_in_x11_io_error_handler && base::ThreadTaskRunnerHandle::IsSet()) {
|
||||
base::ThreadTaskRunnerHandle::Get()->PostTask(
|
||||
FROM_HERE, base::Bind(&ui::LogErrorEventDescription, d, *error));
|
||||
FROM_HERE, base::BindOnce(&ui::LogErrorEventDescription, d, *error));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -394,8 +394,8 @@ void AtomBrowserMainParts::PreMainMessageLoopRun() {
|
|||
|
||||
// Start idle gc.
|
||||
gc_timer_.Start(FROM_HERE, base::TimeDelta::FromMinutes(1),
|
||||
base::Bind(&v8::Isolate::LowMemoryNotification,
|
||||
base::Unretained(js_env_->isolate())));
|
||||
base::BindRepeating(&v8::Isolate::LowMemoryNotification,
|
||||
base::Unretained(js_env_->isolate())));
|
||||
|
||||
content::WebUIControllerFactory::RegisterFactory(
|
||||
AtomWebUIControllerFactory::GetInstance());
|
||||
|
|
|
@ -76,7 +76,7 @@ using InAppTransactionCallback = base::RepeatingCallback<void(
|
|||
|
||||
// Send the callback to the browser thread.
|
||||
base::PostTaskWithTraits(FROM_HERE, {content::BrowserThread::UI},
|
||||
base::Bind(callback_, converted));
|
||||
base::BindOnce(callback_, converted));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -184,8 +184,9 @@ Transaction::~Transaction() = default;
|
|||
|
||||
TransactionObserver::TransactionObserver() : weak_ptr_factory_(this) {
|
||||
obeserver_ = [[InAppTransactionObserver alloc]
|
||||
initWithCallback:base::Bind(&TransactionObserver::OnTransactionsUpdated,
|
||||
weak_ptr_factory_.GetWeakPtr())];
|
||||
initWithCallback:base::BindRepeating(
|
||||
&TransactionObserver::OnTransactionsUpdated,
|
||||
weak_ptr_factory_.GetWeakPtr())];
|
||||
}
|
||||
|
||||
TransactionObserver::~TransactionObserver() {
|
||||
|
|
|
@ -82,8 +82,8 @@ class CertVerifierRequest : public AtomCertVerifier::Request {
|
|||
void Start(const net::NetLogWithSource& net_log) {
|
||||
int error = cert_verifier_->default_verifier()->Verify(
|
||||
params_, &result_,
|
||||
base::Bind(&CertVerifierRequest::OnDefaultVerificationDone,
|
||||
weak_ptr_factory_.GetWeakPtr()),
|
||||
base::BindOnce(&CertVerifierRequest::OnDefaultVerificationDone,
|
||||
weak_ptr_factory_.GetWeakPtr()),
|
||||
&default_verifier_request_, net_log);
|
||||
if (error != net::ERR_IO_PENDING)
|
||||
OnDefaultVerificationDone(error);
|
||||
|
@ -96,20 +96,20 @@ class CertVerifierRequest : public AtomCertVerifier::Request {
|
|||
request->default_result = net::ErrorToString(error);
|
||||
request->error_code = error;
|
||||
request->certificate = params_.certificate();
|
||||
auto response_callback = base::Bind(&CertVerifierRequest::OnResponseInUI,
|
||||
weak_ptr_factory_.GetWeakPtr());
|
||||
auto response_callback = base::BindOnce(
|
||||
&CertVerifierRequest::OnResponseInUI, weak_ptr_factory_.GetWeakPtr());
|
||||
base::PostTaskWithTraits(
|
||||
FROM_HERE, {BrowserThread::UI},
|
||||
base::BindOnce(&CertVerifierRequest::OnVerifyRequestInUI,
|
||||
cert_verifier_->verify_proc(), std::move(request),
|
||||
response_callback));
|
||||
std::move(response_callback)));
|
||||
}
|
||||
|
||||
static void OnVerifyRequestInUI(
|
||||
const AtomCertVerifier::VerifyProc& verify_proc,
|
||||
std::unique_ptr<VerifyRequestParams> request,
|
||||
const base::Callback<void(int)>& response_callback) {
|
||||
verify_proc.Run(*(request.get()), response_callback);
|
||||
base::OnceCallback<void(int)> response_callback) {
|
||||
verify_proc.Run(*(request.get()), std::move(response_callback));
|
||||
}
|
||||
|
||||
static void OnResponseInUI(base::WeakPtr<CertVerifierRequest> self,
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#include <utility>
|
||||
|
||||
#include "atom/common/native_mate_converters/callback.h"
|
||||
#include "atom/common/native_mate_converters/once_callback.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
|
||||
namespace atom {
|
||||
|
@ -29,14 +29,14 @@ void JsAsker::AskForOptions(
|
|||
v8::Isolate* isolate,
|
||||
const JavaScriptHandler& handler,
|
||||
std::unique_ptr<base::DictionaryValue> request_details,
|
||||
const BeforeStartCallback& before_start) {
|
||||
BeforeStartCallback before_start) {
|
||||
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
||||
v8::Locker locker(isolate);
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
v8::Local<v8::Context> context = isolate->GetCurrentContext();
|
||||
v8::Context::Scope context_scope(context);
|
||||
handler.Run(*(request_details.get()),
|
||||
mate::ConvertToV8(isolate, before_start));
|
||||
mate::ConvertToV8(isolate, std::move(before_start)));
|
||||
}
|
||||
|
||||
// static
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace atom {
|
|||
|
||||
using JavaScriptHandler =
|
||||
base::Callback<void(const base::DictionaryValue&, v8::Local<v8::Value>)>;
|
||||
using BeforeStartCallback = base::Callback<void(mate::Arguments* args)>;
|
||||
using BeforeStartCallback = base::OnceCallback<void(mate::Arguments* args)>;
|
||||
|
||||
class JsAsker {
|
||||
public:
|
||||
|
@ -34,7 +34,7 @@ class JsAsker {
|
|||
v8::Isolate* isolate,
|
||||
const JavaScriptHandler& handler,
|
||||
std::unique_ptr<base::DictionaryValue> request_details,
|
||||
const BeforeStartCallback& before_start);
|
||||
BeforeStartCallback before_start);
|
||||
|
||||
// Test whether the |options| means an error.
|
||||
static bool IsErrorOptions(base::Value* value, int* error);
|
||||
|
|
|
@ -58,9 +58,10 @@ void URLRequestAsyncAsarJob::Start() {
|
|||
FillRequestDetails(request_details.get(), request());
|
||||
base::PostTaskWithTraits(
|
||||
FROM_HERE, {content::BrowserThread::UI},
|
||||
base::BindOnce(&JsAsker::AskForOptions, base::Unretained(isolate()),
|
||||
handler(), std::move(request_details),
|
||||
base::Bind(&BeforeStartInUI, weak_factory_.GetWeakPtr())));
|
||||
base::BindOnce(
|
||||
&JsAsker::AskForOptions, base::Unretained(isolate()), handler(),
|
||||
std::move(request_details),
|
||||
base::BindOnce(&BeforeStartInUI, weak_factory_.GetWeakPtr())));
|
||||
}
|
||||
|
||||
void URLRequestAsyncAsarJob::StartAsync(std::unique_ptr<base::Value> options,
|
||||
|
|
|
@ -69,9 +69,10 @@ void URLRequestBufferJob::Start() {
|
|||
FillRequestDetails(request_details.get(), request());
|
||||
base::PostTaskWithTraits(
|
||||
FROM_HERE, {content::BrowserThread::UI},
|
||||
base::BindOnce(&JsAsker::AskForOptions, base::Unretained(isolate()),
|
||||
handler(), std::move(request_details),
|
||||
base::Bind(&BeforeStartInUI, weak_factory_.GetWeakPtr())));
|
||||
base::BindOnce(
|
||||
&JsAsker::AskForOptions, base::Unretained(isolate()), handler(),
|
||||
std::move(request_details),
|
||||
base::BindOnce(&BeforeStartInUI, weak_factory_.GetWeakPtr())));
|
||||
}
|
||||
|
||||
void URLRequestBufferJob::StartAsync(std::unique_ptr<base::Value> options,
|
||||
|
|
|
@ -147,9 +147,10 @@ void URLRequestFetchJob::Start() {
|
|||
FillRequestDetails(request_details.get(), request());
|
||||
base::PostTaskWithTraits(
|
||||
FROM_HERE, {content::BrowserThread::UI},
|
||||
base::BindOnce(&JsAsker::AskForOptions, base::Unretained(isolate()),
|
||||
handler(), std::move(request_details),
|
||||
base::Bind(&BeforeStartInUI, weak_factory_.GetWeakPtr())));
|
||||
base::BindOnce(
|
||||
&JsAsker::AskForOptions, base::Unretained(isolate()), handler(),
|
||||
std::move(request_details),
|
||||
base::BindOnce(&BeforeStartInUI, weak_factory_.GetWeakPtr())));
|
||||
}
|
||||
|
||||
void URLRequestFetchJob::StartAsync(
|
||||
|
|
|
@ -115,9 +115,10 @@ void URLRequestStreamJob::Start() {
|
|||
FillRequestDetails(request_details.get(), request());
|
||||
base::PostTaskWithTraits(
|
||||
FROM_HERE, {content::BrowserThread::UI},
|
||||
base::BindOnce(&JsAsker::AskForOptions, base::Unretained(isolate()),
|
||||
handler(), std::move(request_details),
|
||||
base::Bind(&BeforeStartInUI, weak_factory_.GetWeakPtr())));
|
||||
base::BindOnce(
|
||||
&JsAsker::AskForOptions, base::Unretained(isolate()), handler(),
|
||||
std::move(request_details),
|
||||
base::BindOnce(&BeforeStartInUI, weak_factory_.GetWeakPtr())));
|
||||
}
|
||||
|
||||
void URLRequestStreamJob::StartAsync(
|
||||
|
|
|
@ -57,9 +57,10 @@ void URLRequestStringJob::Start() {
|
|||
FillRequestDetails(request_details.get(), request());
|
||||
base::PostTaskWithTraits(
|
||||
FROM_HERE, {content::BrowserThread::UI},
|
||||
base::BindOnce(&JsAsker::AskForOptions, base::Unretained(isolate()),
|
||||
handler(), std::move(request_details),
|
||||
base::Bind(&BeforeStartInUI, weak_factory_.GetWeakPtr())));
|
||||
base::BindOnce(
|
||||
&JsAsker::AskForOptions, base::Unretained(isolate()), handler(),
|
||||
std::move(request_details),
|
||||
base::BindOnce(&BeforeStartInUI, weak_factory_.GetWeakPtr())));
|
||||
}
|
||||
|
||||
void URLRequestStringJob::StartAsync(std::unique_ptr<base::Value> options,
|
||||
|
|
|
@ -92,9 +92,9 @@ void PlatformNotificationService::DisplayNotification(
|
|||
if (notification) {
|
||||
browser_client_->WebNotificationAllowed(
|
||||
render_process_host->GetID(),
|
||||
base::Bind(&OnWebNotificationAllowed, notification,
|
||||
notification_resources.notification_icon,
|
||||
notification_data));
|
||||
base::BindRepeating(&OnWebNotificationAllowed, notification,
|
||||
notification_resources.notification_icon,
|
||||
notification_data));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -415,7 +415,7 @@ IFACEMETHODIMP ToastEventHandler::Invoke(
|
|||
IInspectable* args) {
|
||||
base::PostTaskWithTraits(
|
||||
FROM_HERE, {content::BrowserThread::UI},
|
||||
base::Bind(&Notification::NotificationClicked, notification_));
|
||||
base::BindOnce(&Notification::NotificationClicked, notification_));
|
||||
if (IsDebuggingNotifications())
|
||||
LOG(INFO) << "Notification clicked";
|
||||
|
||||
|
@ -427,7 +427,7 @@ IFACEMETHODIMP ToastEventHandler::Invoke(
|
|||
ABI::Windows::UI::Notifications::IToastDismissedEventArgs* e) {
|
||||
base::PostTaskWithTraits(
|
||||
FROM_HERE, {content::BrowserThread::UI},
|
||||
base::Bind(&Notification::NotificationDismissed, notification_));
|
||||
base::BindOnce(&Notification::NotificationDismissed, notification_));
|
||||
if (IsDebuggingNotifications())
|
||||
LOG(INFO) << "Notification dismissed";
|
||||
|
||||
|
@ -439,7 +439,7 @@ IFACEMETHODIMP ToastEventHandler::Invoke(
|
|||
ABI::Windows::UI::Notifications::IToastFailedEventArgs* e) {
|
||||
base::PostTaskWithTraits(
|
||||
FROM_HERE, {content::BrowserThread::UI},
|
||||
base::Bind(&Notification::NotificationFailed, notification_));
|
||||
base::BindOnce(&Notification::NotificationFailed, notification_));
|
||||
if (IsDebuggingNotifications())
|
||||
LOG(INFO) << "Notification failed";
|
||||
|
||||
|
|
|
@ -15,7 +15,8 @@ namespace atom {
|
|||
|
||||
class OffScreenRenderWidgetHostView;
|
||||
|
||||
typedef base::Callback<void(const gfx::Rect&, const SkBitmap&)> OnPaintCallback;
|
||||
typedef base::RepeatingCallback<void(const gfx::Rect&, const SkBitmap&)>
|
||||
OnPaintCallback;
|
||||
|
||||
class OffScreenVideoConsumer : public viz::mojom::FrameSinkVideoConsumer {
|
||||
public:
|
||||
|
|
|
@ -726,8 +726,8 @@ void InspectableWebContentsImpl::HandleMessageFromDevToolsFrontend(
|
|||
int id = 0;
|
||||
dict->GetInteger(kFrontendHostId, &id);
|
||||
embedder_message_dispatcher_->Dispatch(
|
||||
base::Bind(&InspectableWebContentsImpl::SendMessageAck,
|
||||
weak_factory_.GetWeakPtr(), id),
|
||||
base::BindRepeating(&InspectableWebContentsImpl::SendMessageAck,
|
||||
weak_factory_.GetWeakPtr(), id),
|
||||
method, params);
|
||||
}
|
||||
|
||||
|
@ -763,8 +763,9 @@ void InspectableWebContentsImpl::RenderFrameHostChanged(
|
|||
return;
|
||||
frontend_host_ = content::DevToolsFrontendHost::Create(
|
||||
new_host,
|
||||
base::Bind(&InspectableWebContentsImpl::HandleMessageFromDevToolsFrontend,
|
||||
weak_factory_.GetWeakPtr()));
|
||||
base::BindRepeating(
|
||||
&InspectableWebContentsImpl::HandleMessageFromDevToolsFrontend,
|
||||
weak_factory_.GetWeakPtr()));
|
||||
}
|
||||
|
||||
void InspectableWebContentsImpl::WebContentsDestroyed() {
|
||||
|
@ -866,7 +867,7 @@ void InspectableWebContentsImpl::ReadyToCommitNavigation(
|
|||
}
|
||||
frontend_host_ = content::DevToolsFrontendHost::Create(
|
||||
web_contents()->GetMainFrame(),
|
||||
base::Bind(
|
||||
base::BindRepeating(
|
||||
&InspectableWebContentsImpl::HandleMessageFromDevToolsFrontend,
|
||||
base::Unretained(this)));
|
||||
return;
|
||||
|
|
|
@ -132,8 +132,8 @@ views::MenuItemView* MenuDelegate::GetSiblingMenu(
|
|||
if (!switch_in_progress) {
|
||||
base::PostTaskWithTraits(
|
||||
FROM_HERE, {content::BrowserThread::UI},
|
||||
base::Bind(&views::MenuRunner::Cancel,
|
||||
base::Unretained(menu_runner_.get())));
|
||||
base::BindOnce(&views::MenuRunner::Cancel,
|
||||
base::Unretained(menu_runner_.get())));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -167,8 +167,8 @@ void NotifyIcon::PopUpContextMenu(const gfx::Point& pos,
|
|||
menu_runner_.reset(new views::MenuRunner(
|
||||
menu_model != nullptr ? menu_model : menu_model_,
|
||||
views::MenuRunner::CONTEXT_MENU | views::MenuRunner::HAS_MNEMONICS,
|
||||
base::Bind(&NotifyIcon::OnContextMenuClosed,
|
||||
weak_factory_.GetWeakPtr())));
|
||||
base::BindRepeating(&NotifyIcon::OnContextMenuClosed,
|
||||
weak_factory_.GetWeakPtr())));
|
||||
menu_runner_->RunMenuAt(widget_.get(), NULL, rect,
|
||||
views::MenuAnchorPosition::kTopLeft,
|
||||
ui::MENU_SOURCE_MOUSE);
|
||||
|
|
|
@ -160,8 +160,9 @@ void ZoomLevelDelegate::InitHostZoomMap(content::HostZoomMap* host_zoom_map) {
|
|||
// by calls to HostZoomMap::SetZoomLevelForHost().
|
||||
ExtractPerHostZoomLevels(host_zoom_dictionary);
|
||||
}
|
||||
zoom_subscription_ = host_zoom_map_->AddZoomLevelChangedCallback(base::Bind(
|
||||
&ZoomLevelDelegate::OnZoomLevelChanged, base::Unretained(this)));
|
||||
zoom_subscription_ =
|
||||
host_zoom_map_->AddZoomLevelChangedCallback(base::BindRepeating(
|
||||
&ZoomLevelDelegate::OnZoomLevelChanged, base::Unretained(this)));
|
||||
}
|
||||
|
||||
} // namespace atom
|
||||
|
|
|
@ -51,8 +51,9 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
dict.SetMethod("hasSwitch", &HasSwitch);
|
||||
dict.SetMethod("getSwitchValue", &GetSwitchValue);
|
||||
dict.SetMethod("appendSwitch", &AppendSwitch);
|
||||
dict.SetMethod("appendArgument", base::Bind(&base::CommandLine::AppendArg,
|
||||
base::Unretained(command_line)));
|
||||
dict.SetMethod("appendArgument",
|
||||
base::BindRepeating(&base::CommandLine::AppendArg,
|
||||
base::Unretained(command_line)));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -22,7 +22,7 @@ v8::Local<v8::Function> CreateConstructor(v8::Isolate* isolate,
|
|||
called = true;
|
||||
#endif
|
||||
v8::Local<v8::FunctionTemplate> templ = CreateFunctionTemplate(
|
||||
isolate, base::Bind(&mate::internal::InvokeNew<Sig>, func));
|
||||
isolate, base::BindRepeating(&mate::internal::InvokeNew<Sig>, func));
|
||||
templ->InstanceTemplate()->SetInternalFieldCount(1);
|
||||
T::BuildPrototype(isolate, templ);
|
||||
return templ->GetFunction(isolate->GetCurrentContext()).ToLocalChecked();
|
||||
|
|
|
@ -215,7 +215,8 @@ void SpellCheckClient::SpellCheckWords(
|
|||
DCHECK(!scope.spell_check_.IsEmpty());
|
||||
|
||||
v8::Local<v8::FunctionTemplate> templ = mate::CreateFunctionTemplate(
|
||||
isolate_, base::Bind(&SpellCheckClient::OnSpellCheckDone, AsWeakPtr()));
|
||||
isolate_,
|
||||
base::BindRepeating(&SpellCheckClient::OnSpellCheckDone, AsWeakPtr()));
|
||||
|
||||
auto context = isolate_->GetCurrentContext();
|
||||
v8::Local<v8::Value> args[] = {mate::ConvertToV8(isolate_, words),
|
||||
|
|
|
@ -28,7 +28,7 @@ net::NSSCertDatabase* g_nss_cert_database = nullptr;
|
|||
|
||||
net::NSSCertDatabase* GetNSSCertDatabaseForResourceContext(
|
||||
content::ResourceContext* context,
|
||||
const base::Callback<void(net::NSSCertDatabase*)>& callback) {
|
||||
base::OnceCallback<void(net::NSSCertDatabase*)> callback) {
|
||||
// This initialization is not thread safe. This CHECK ensures that this code
|
||||
// is only run on a single thread.
|
||||
CHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
|
||||
|
@ -75,8 +75,8 @@ void CertificateManagerModel::Create(content::BrowserContext* browser_context,
|
|||
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
||||
base::PostTaskWithTraits(
|
||||
FROM_HERE, {BrowserThread::IO},
|
||||
base::Bind(&CertificateManagerModel::GetCertDBOnIOThread,
|
||||
browser_context->GetResourceContext(), callback));
|
||||
base::BindOnce(&CertificateManagerModel::GetCertDBOnIOThread,
|
||||
browser_context->GetResourceContext(), callback));
|
||||
}
|
||||
|
||||
CertificateManagerModel::CertificateManagerModel(
|
||||
|
@ -148,8 +148,8 @@ void CertificateManagerModel::DidGetCertDBOnIOThread(
|
|||
bool is_user_db_available = !!cert_db->GetPublicSlot();
|
||||
base::PostTaskWithTraits(
|
||||
FROM_HERE, {BrowserThread::UI},
|
||||
base::Bind(&CertificateManagerModel::DidGetCertDBOnUIThread, cert_db,
|
||||
is_user_db_available, callback));
|
||||
base::BindOnce(&CertificateManagerModel::DidGetCertDBOnUIThread, cert_db,
|
||||
is_user_db_available, callback));
|
||||
}
|
||||
|
||||
// static
|
||||
|
@ -158,8 +158,8 @@ void CertificateManagerModel::GetCertDBOnIOThread(
|
|||
const CreationCallback& callback) {
|
||||
DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
||||
net::NSSCertDatabase* cert_db = GetNSSCertDatabaseForResourceContext(
|
||||
context,
|
||||
base::Bind(&CertificateManagerModel::DidGetCertDBOnIOThread, callback));
|
||||
context, base::BindOnce(&CertificateManagerModel::DidGetCertDBOnIOThread,
|
||||
callback));
|
||||
if (cert_db)
|
||||
DidGetCertDBOnIOThread(callback, cert_db);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue