Merge revision 556 changes:

- Fix race condition in CefCookieManagerImpl constructor (issue #542).

git-svn-id: https://chromiumembedded.googlecode.com/svn/branches/1025@558 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2012-03-29 16:53:16 +00:00
parent 6c669ab484
commit 0d33fc8cd2
2 changed files with 13 additions and 19 deletions

View File

@ -66,18 +66,14 @@ class VisitCookiesCallback : public base::RefCounted<VisitCookiesCallback> {
} // namespace
CefCookieManagerImpl::CefCookieManagerImpl()
: is_global_(true) {
cookie_monster_ =
static_cast<net::CookieMonster*>(
_Context->request_context()->cookie_store());
DCHECK(cookie_monster_);
}
// Creates a new cookie monster with storage at the specified |path|.
CefCookieManagerImpl::CefCookieManagerImpl(const CefString& path)
:is_global_(false) {
SetStoragePath(path);
CefCookieManagerImpl::CefCookieManagerImpl(bool is_global)
: is_global_(is_global) {
if (is_global) {
cookie_monster_ =
static_cast<net::CookieMonster*>(
_Context->request_context()->cookie_store());
DCHECK(cookie_monster_);
}
}
CefCookieManagerImpl::~CefCookieManagerImpl() {
@ -239,7 +235,7 @@ CefRefPtr<CefCookieManager> CefCookieManager::GetGlobalManager() {
return NULL;
}
return new CefCookieManagerImpl();
return new CefCookieManagerImpl(true);
}
// static
@ -251,5 +247,7 @@ CefRefPtr<CefCookieManager> CefCookieManager::CreateManager(
return NULL;
}
return new CefCookieManagerImpl(path);
CefRefPtr<CefCookieManager> manager(new CefCookieManagerImpl(false));
manager->SetStoragePath(path);
return manager;
}

View File

@ -12,11 +12,7 @@
// Implementation of the CefCookieManager interface.
class CefCookieManagerImpl : public CefCookieManager {
public:
// Creates a new reference to the existing global cookie monster.
CefCookieManagerImpl();
// Creates a new cookie monster with storage at the specified |path|.
explicit CefCookieManagerImpl(const CefString& path);
CefCookieManagerImpl(bool is_global);
~CefCookieManagerImpl();