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:
Marshall Greenblatt 2010-06-22 15:20:38 +00:00
parent de4cee4415
commit ba08f77938
2 changed files with 13 additions and 2 deletions

View File

@ -231,6 +231,9 @@ DWORD WINAPI ThreadHandlerUI(LPVOID lpParam)
{
CefContext *pContext = static_cast<CefContext*>(lpParam);
// AtExitManager is scoped to the UI thread.
base::AtExitManager at_exit_manager;
if (!pContext->DoInitialize())
return 1;
@ -258,6 +261,8 @@ CefContext::CefContext()
messageloopui_ = NULL;
in_transition_ = false;
webprefs_ = NULL;
statstable_ = NULL;
at_exit_manager_ = NULL;
hinstance_ = ::GetModuleHandle(NULL);
next_browser_id_ = 1;
webkit_init_ = NULL;
@ -267,6 +272,8 @@ CefContext::~CefContext()
{
// Just in case CefShutdown() isn't called
Shutdown();
if(at_exit_manager_)
delete at_exit_manager_;
}
bool CefContext::Initialize(bool multi_threaded_message_loop,
@ -366,6 +373,8 @@ bool CefContext::Initialize(bool multi_threaded_message_loop,
DCHECK(hthreadui_ != NULL);
DCHECK(idthreadui_ != 0);
} else {
// AtExitManager is scoped to the context.
at_exit_manager_ = new base::AtExitManager;
if (!DoInitialize()) {
// TODO: Process initialization errors
}

View File

@ -80,8 +80,10 @@ protected:
StatsTable* statstable_;
std::wstring cache_path_;
// Initialize the AtExitManager to avoid asserts and possible memory leaks.
base::AtExitManager at_exit_manager_;
// AtExitManager will be scoped to the context when running in single threaded
// message loop mode.
base::AtExitManager* at_exit_manager_;
// WebKit implementation class.
BrowserWebKitInit* webkit_init_;