mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Merge revision 482 changes:
- Mac: Fix the "no autorelease pool in place" error by initializing an NSAutoreleasePool on every thread (issue #502). git-svn-id: https://chromiumembedded.googlecode.com/svn/branches/963@629 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@ -9,6 +9,10 @@
|
||||
#include "base/message_loop.h"
|
||||
#include "base/message_loop_proxy.h"
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#include <Objbase.h> // NOLINT(build/include_order)
|
||||
#endif
|
||||
|
||||
using base::MessageLoopProxy;
|
||||
|
||||
// Friendly names for the well-known threads.
|
||||
@ -102,6 +106,29 @@ CefThread::CefThread(ID identifier, MessageLoop* message_loop)
|
||||
Initialize();
|
||||
}
|
||||
|
||||
void CefThread::Init() {
|
||||
#if defined(OS_WIN)
|
||||
// Initializes the COM library on the current thread.
|
||||
CoInitialize(NULL);
|
||||
#endif
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
autorelease_pool_.reset(new base::mac::ScopedNSAutoreleasePool);
|
||||
#endif
|
||||
}
|
||||
|
||||
void CefThread::Cleanup() {
|
||||
#if defined(OS_WIN)
|
||||
// Closes the COM library on the current thread. CoInitialize must
|
||||
// be balanced by a corresponding call to CoUninitialize.
|
||||
CoUninitialize();
|
||||
#endif
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
autorelease_pool_.reset(NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
void CefThread::Initialize() {
|
||||
base::AutoLock lock(lock_);
|
||||
DCHECK(identifier_ >= 0 && identifier_ < ID_COUNT);
|
||||
|
Reference in New Issue
Block a user