Fix external message pump (issue #2493)

This commit is contained in:
Marshall Greenblatt 2018-09-06 14:40:36 +02:00
parent 876e82f444
commit e858849615
4 changed files with 11 additions and 12 deletions

View File

@ -10,7 +10,6 @@
#include "libcef/browser/browser_context_impl.h"
#include "libcef/browser/browser_context_keyed_service_factories.h"
#include "libcef/browser/browser_message_loop.h"
#include "libcef/browser/content_browser_client.h"
#include "libcef/browser/context.h"
#include "libcef/browser/devtools_manager_delegate.h"
@ -107,11 +106,6 @@ void CefBrowserMainParts::ToolkitInitialized() {
}
void CefBrowserMainParts::PreMainMessageLoopStart() {
if (!base::MessageLoop::current()) {
// Create the browser message loop.
message_loop_.reset(new CefBrowserMessageLoop());
}
for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
chrome_extra_parts_[i]->PreMainMessageLoopStart();
}

View File

@ -16,11 +16,6 @@
#include "content/public/browser/browser_main_parts.h"
#include "net/url_request/url_request_context_getter.h"
namespace base {
class MessageLoop;
class Thread;
} // namespace base
namespace content {
struct MainFunctionParams;
}
@ -89,7 +84,6 @@ class CefBrowserMainParts : public content::BrowserMainParts {
CefRefPtr<CefRequestContextImpl> global_request_context_;
CefDevToolsDelegate* devtools_delegate_; // Deletes itself.
std::unique_ptr<base::MessageLoop> message_loop_;
std::unique_ptr<extensions::ExtensionsClient> extensions_client_;
std::unique_ptr<extensions::ExtensionsBrowserClient>

View File

@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "libcef/common/main_delegate.h"
#include "libcef/browser/browser_message_loop.h"
#include "libcef/browser/content_browser_client.h"
#include "libcef/browser/context.h"
#include "libcef/common/cef_switches.h"
@ -304,6 +305,11 @@ CefMainDelegate::CefMainDelegate(CefRefPtr<CefApp> application)
CefMainDelegate::~CefMainDelegate() {}
void CefMainDelegate::PreCreateMainMessageLoop() {
// Create the main message loop.
message_loop_.reset(new CefBrowserMessageLoop());
}
bool CefMainDelegate::BasicStartupComplete(int* exit_code) {
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
std::string process_type =
@ -634,6 +640,8 @@ void CefMainDelegate::ShutdownBrowser() {
ui_thread_->Stop();
ui_thread_.reset();
}
message_loop_.reset();
}
void CefMainDelegate::InitializeResourceBundle() {

View File

@ -16,6 +16,7 @@
namespace base {
class CommandLine;
class MessageLoop;
class Thread;
} // namespace base
@ -32,6 +33,7 @@ class CefMainDelegate : public content::ContentMainDelegate {
explicit CefMainDelegate(CefRefPtr<CefApp> application);
~CefMainDelegate() override;
void PreCreateMainMessageLoop() override;
bool BasicStartupComplete(int* exit_code) override;
void PreSandboxStartup() override;
void SandboxInitialized(const std::string& process_type) override;
@ -55,6 +57,7 @@ class CefMainDelegate : public content::ContentMainDelegate {
private:
void InitializeResourceBundle();
std::unique_ptr<base::MessageLoop> message_loop_;
std::unique_ptr<content::BrowserMainRunner> browser_runner_;
std::unique_ptr<base::Thread> ui_thread_;