From: Steinar H. Gunderson Date: Tue, 13 Mar 2018 17:36:10 +0000 (+0100) Subject: Do not wait for OnBrowserDestroyed. X-Git-Tag: 1.7.1~21 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=6cc6c194b3eb245a04af531c7a6adb582673f2e7;p=nageru Do not wait for OnBrowserDestroyed. Evidently, there's no guarantee that this will ever come; see http://magpcss.org/ceforum/viewtopic.php?f=6&t=14687 We were seemingly saved by our own inverted logic here earlier. --- diff --git a/nageru_cef_app.cpp b/nageru_cef_app.cpp index bd8b9d6..2ddd816 100644 --- a/nageru_cef_app.cpp +++ b/nageru_cef_app.cpp @@ -18,13 +18,6 @@ void NageruCefApp::OnBeforeCommandLineProcessing( command_line->AppendSwitch("enable-begin-frame-scheduling"); } -void NageruCefApp::OnBrowserDestroyed(CefRefPtr browser) -{ - lock_guard lock(cef_mutex); - pending_browsers.erase(browser.get()); - browser_closed_cond.notify_all(); -} - void NageruCefApp::initialize_cef() { unique_lock lock(cef_mutex); @@ -37,11 +30,7 @@ void NageruCefApp::initialize_cef() void NageruCefApp::close_browser(CefRefPtr browser) { unique_lock lock(cef_mutex); - CefBrowser *raw_ptr = browser.get(); - pending_browsers.insert(raw_ptr); browser->GetHost()->CloseBrowser(/*force_close=*/true); - browser = nullptr; - browser_closed_cond.wait(lock, [this, raw_ptr]{ return pending_browsers.count(raw_ptr) != 0; }); } void NageruCefApp::unref_cef() diff --git a/nageru_cef_app.h b/nageru_cef_app.h index a120d5a..1a7ca1a 100644 --- a/nageru_cef_app.h +++ b/nageru_cef_app.h @@ -78,8 +78,6 @@ public: void OnBeforeCommandLineProcessing(const CefString& process_type, CefRefPtr command_line); - void OnBrowserDestroyed(CefRefPtr browser) override; - private: void cef_thread_func(); @@ -88,8 +86,6 @@ private: int cef_thread_refcount = 0; // Under . bool cef_initialized = false; // Under . std::condition_variable cef_initialized_cond; - std::unordered_set pending_browsers; // Under . - std::condition_variable browser_closed_cond; IMPLEMENT_REFCOUNTING(NageruCefApp); };