mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-02-17 04:30:46 +01:00
Create and destroy the base::AtExitManager on the UI thread.
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@85 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
de4cee4415
commit
ba08f77938
@ -231,6 +231,9 @@ DWORD WINAPI ThreadHandlerUI(LPVOID lpParam)
|
|||||||
{
|
{
|
||||||
CefContext *pContext = static_cast<CefContext*>(lpParam);
|
CefContext *pContext = static_cast<CefContext*>(lpParam);
|
||||||
|
|
||||||
|
// AtExitManager is scoped to the UI thread.
|
||||||
|
base::AtExitManager at_exit_manager;
|
||||||
|
|
||||||
if (!pContext->DoInitialize())
|
if (!pContext->DoInitialize())
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
@ -258,6 +261,8 @@ CefContext::CefContext()
|
|||||||
messageloopui_ = NULL;
|
messageloopui_ = NULL;
|
||||||
in_transition_ = false;
|
in_transition_ = false;
|
||||||
webprefs_ = NULL;
|
webprefs_ = NULL;
|
||||||
|
statstable_ = NULL;
|
||||||
|
at_exit_manager_ = NULL;
|
||||||
hinstance_ = ::GetModuleHandle(NULL);
|
hinstance_ = ::GetModuleHandle(NULL);
|
||||||
next_browser_id_ = 1;
|
next_browser_id_ = 1;
|
||||||
webkit_init_ = NULL;
|
webkit_init_ = NULL;
|
||||||
@ -267,6 +272,8 @@ CefContext::~CefContext()
|
|||||||
{
|
{
|
||||||
// Just in case CefShutdown() isn't called
|
// Just in case CefShutdown() isn't called
|
||||||
Shutdown();
|
Shutdown();
|
||||||
|
if(at_exit_manager_)
|
||||||
|
delete at_exit_manager_;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CefContext::Initialize(bool multi_threaded_message_loop,
|
bool CefContext::Initialize(bool multi_threaded_message_loop,
|
||||||
@ -366,6 +373,8 @@ bool CefContext::Initialize(bool multi_threaded_message_loop,
|
|||||||
DCHECK(hthreadui_ != NULL);
|
DCHECK(hthreadui_ != NULL);
|
||||||
DCHECK(idthreadui_ != 0);
|
DCHECK(idthreadui_ != 0);
|
||||||
} else {
|
} else {
|
||||||
|
// AtExitManager is scoped to the context.
|
||||||
|
at_exit_manager_ = new base::AtExitManager;
|
||||||
if (!DoInitialize()) {
|
if (!DoInitialize()) {
|
||||||
// TODO: Process initialization errors
|
// TODO: Process initialization errors
|
||||||
}
|
}
|
||||||
|
@ -80,8 +80,10 @@ protected:
|
|||||||
StatsTable* statstable_;
|
StatsTable* statstable_;
|
||||||
std::wstring cache_path_;
|
std::wstring cache_path_;
|
||||||
|
|
||||||
// Initialize the AtExitManager to avoid asserts and possible memory leaks.
|
// AtExitManager will be scoped to the context when running in single threaded
|
||||||
base::AtExitManager at_exit_manager_;
|
// message loop mode.
|
||||||
|
base::AtExitManager* at_exit_manager_;
|
||||||
|
|
||||||
// WebKit implementation class.
|
// WebKit implementation class.
|
||||||
BrowserWebKitInit* webkit_init_;
|
BrowserWebKitInit* webkit_init_;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user