From 5fe1ac5c3dbd5024eb567838c27fe4243aad2283 Mon Sep 17 00:00:00 2001 From: Jeremy Rose Date: Wed, 31 Aug 2022 08:16:27 -0700 Subject: [PATCH] refactor: simplify WebContents::Destroy (#35510) --- shell/browser/api/electron_api_web_contents.cc | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/shell/browser/api/electron_api_web_contents.cc b/shell/browser/api/electron_api_web_contents.cc index 9411bc092692..1690b5c1e049 100644 --- a/shell/browser/api/electron_api_web_contents.cc +++ b/shell/browser/api/electron_api_web_contents.cc @@ -1000,12 +1000,8 @@ void WebContents::Destroy() { DeleteThisIfAlive(); } else { content::GetUIThreadTaskRunner({})->PostTask( - FROM_HERE, base::BindOnce( - [](base::WeakPtr contents) { - if (contents) - contents->DeleteThisIfAlive(); - }, - GetWeakPtr())); + FROM_HERE, + base::BindOnce(&WebContents::DeleteThisIfAlive, GetWeakPtr())); } }