Wait for CefBrowserContext initialization (see issue #2969)

With the Chrome runtime, Profile initialization may be asynchronous. Code that
waited on CefBrowserContext creation now needs to wait on CefBrowserContext
initialization instead.
This commit is contained in:
Marshall Greenblatt
2021-04-14 19:28:22 -04:00
parent fc7f9ff505
commit 34c63a665d
39 changed files with 779 additions and 477 deletions

View File

@ -36,9 +36,30 @@ class CefCookieManagerImpl : public CefCookieManager {
bool FlushStore(CefRefPtr<CefCompletionCallback> callback) override;
private:
bool VisitAllCookiesInternal(CefRefPtr<CefCookieVisitor> visitor);
bool VisitUrlCookiesInternal(const GURL& url,
bool includeHttpOnly,
CefRefPtr<CefCookieVisitor> visitor);
bool SetCookieInternal(const GURL& url,
const CefCookie& cookie,
CefRefPtr<CefSetCookieCallback> callback);
bool DeleteCookiesInternal(const GURL& url,
const CefString& cookie_name,
CefRefPtr<CefDeleteCookiesCallback> callback);
bool FlushStoreInternal(CefRefPtr<CefCompletionCallback> callback);
// If the context is fully initialized execute |callback|, otherwise
// store it until the context is fully initialized.
void StoreOrTriggerInitCallback(base::OnceClosure callback);
bool ValidContext() const;
// Only accessed on the UI thread. Will be non-null after Initialize().
CefBrowserContext::Getter browser_context_getter_;
bool initialized_ = false;
std::vector<base::OnceClosure> init_callbacks_;
IMPLEMENT_REFCOUNTING(CefCookieManagerImpl);
DISALLOW_COPY_AND_ASSIGN(CefCookieManagerImpl);
};