Convert CefCookieManagerImpl to use CefBrowserContext::Getter.

With this change CefCookieManagerImpl no longer keeps a reference to the
originating CefRequestContextImpl. This means that the CefRequestContextImpl
can be destroyed if all other references are released while the
CefCookieManagerImpl exists. If CefRequestContextImpl destruction results in
the underlying CefBrowserContext being destroyed then the CefCookieManagerImpl's
reference to that CefBrowserContext will be invalidated.

This is the same ownership model introduced with CefMediaRouterImpl in the
previous commit.
This commit is contained in:
Marshall Greenblatt
2020-03-27 16:00:36 -04:00
parent 03fd5b15da
commit 869ae21c9f
4 changed files with 99 additions and 41 deletions

View File

@ -9,6 +9,7 @@
#include "include/cef_request_context.h"
#include "libcef/browser/browser_context.h"
#include "libcef/browser/media_router/media_router_impl.h"
#include "libcef/browser/net_service/cookie_manager_impl.h"
#include "libcef/browser/thread_util.h"
class CefBrowserContext;
@ -149,6 +150,9 @@ class CefRequestContextImpl : public CefRequestContext {
CefRefPtr<CefResolveCallback> callback,
CefBrowserContext* browser_context);
void InitializeCookieManagerOnUIThread(
CefRefPtr<CefCookieManagerImpl> cookie_manager,
CefRefPtr<CefCompletionCallback> callback);
void InitializeMediaRouterOnUIThread(
CefRefPtr<CefMediaRouterImpl> media_router);