Popups must share the parent context to avoid crashes on parent browser destruction (issue #2162)

This commit is contained in:
Marshall Greenblatt
2017-05-04 17:53:27 -04:00
parent 4a193051a9
commit 5b9fb7e4ec
17 changed files with 448 additions and 390 deletions

View File

@@ -19,16 +19,16 @@ class CefRequestContextImpl : public CefRequestContext {
public:
~CefRequestContextImpl() override;
// Creates the singleton global RequestContext. Called from
// CefBrowserMainParts::PreMainMessageLoopRun.
static CefRefPtr<CefRequestContextImpl> CreateGlobalRequestContext(
const CefRequestContextSettings& settings);
// Returns a CefRequestContextImpl for the specified |request_context|.
// Will return the global context if |request_context| is NULL.
static CefRefPtr<CefRequestContextImpl> GetOrCreateForRequestContext(
CefRefPtr<CefRequestContext> request_context);
// Returns a CefRequestContextImpl for the specified |browser_context|.
// |browser_context| must be non-NULL.
static CefRefPtr<CefRequestContextImpl> CreateForBrowserContext(
CefBrowserContext* browser_context);
// Returns the browser context object. Can only be called on the UI thread.
CefBrowserContext* GetBrowserContext();
@@ -108,10 +108,12 @@ class CefRequestContextImpl : public CefRequestContext {
int unique_id = -1;
};
static CefRefPtr<CefRequestContextImpl> GetOrCreateRequestContext(
const Config& config);
explicit CefRequestContextImpl(const Config& config);
void Initialize();
void Initialize(CefBrowserContext* other_browser_context);
// Make sure the browser context exists. Only called on the UI thread.
void EnsureBrowserContext();
@@ -155,7 +157,7 @@ class CefRequestContextImpl : public CefRequestContext {
Config config_;
// Owned by the CefBrowserContext.
CefURLRequestContextGetterImpl* request_context_impl_ = nullptr;
CefURLRequestContextGetterImpl* request_context_getter_impl_ = nullptr;
IMPLEMENT_REFCOUNTING_DELETE_ON_UIT(CefRequestContextImpl);
DISALLOW_COPY_AND_ASSIGN(CefRequestContextImpl);