Fix issues related to request and context object lifespan (issue #1037, issue #1044).

- Simplify and document the relationship between the various context object types. See browser_context.h for a description of the new relationships.
- cefclient: Add `request-context-per-browser` command-line flag for testing multiple CefRequestContext instances.
- cefclient: Add a CefURLRequest example.

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@2032 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2015-02-13 23:17:08 +00:00
parent 559ca19bbe
commit 7a2ce64096
66 changed files with 1233 additions and 773 deletions

View File

@ -7,6 +7,8 @@
#pragma once
#include "libcef/browser/browser_pref_store.h"
#include "libcef/browser/browser_context_impl.h"
#include "libcef/browser/url_request_context_getter_impl.h"
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
@ -27,7 +29,6 @@ namespace content {
struct MainFunctionParams;
}
class CefBrowserContext;
class CefDevToolsDelegate;
class CefBrowserMainParts : public content::BrowserMainParts {
@ -44,10 +45,10 @@ class CefBrowserMainParts : public content::BrowserMainParts {
void PostMainMessageLoopRun() override;
void PostDestroyThreads() override;
CefBrowserContext* browser_context() const {
return global_browser_context_.get();
scoped_refptr<CefBrowserContextImpl> browser_context() const {
return global_browser_context_;
}
scoped_refptr<net::URLRequestContextGetter> request_context() const {
scoped_refptr<CefURLRequestContextGetterImpl> request_context() const {
return global_request_context_;
}
CefDevToolsDelegate* devtools_delegate() const {
@ -58,16 +59,12 @@ class CefBrowserMainParts : public content::BrowserMainParts {
return proxy_config_service_.Pass();
}
void AddBrowserContext(CefBrowserContext* context);
void RemoveBrowserContext(CefBrowserContext* context);
private:
void PlatformInitialize();
void PlatformCleanup();
scoped_ptr<CefBrowserContext> global_browser_context_;
scoped_refptr<net::URLRequestContextGetter> global_request_context_;
ScopedVector<CefBrowserContext> browser_contexts_;
scoped_refptr<CefBrowserContextImpl> global_browser_context_;
scoped_refptr<CefURLRequestContextGetterImpl> global_request_context_;
CefDevToolsDelegate* devtools_delegate_; // Deletes itself.
scoped_ptr<base::MessageLoop> message_loop_;
scoped_ptr<PrefProxyConfigTracker> pref_proxy_config_tracker_;