Make overriding BrowserContext::RegisterPrefs actually work
We were calling it before derived classes' vtables were set up. Now we wait to call it until the BrowserContext is fully constructed.
This commit is contained in:
parent
1161da6527
commit
710d0fc6c5
3 changed files with 6 additions and 0 deletions
|
@ -48,6 +48,9 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
BrowserContext::BrowserContext() : resource_context_(new ResourceContext) {
|
BrowserContext::BrowserContext() : resource_context_(new ResourceContext) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void BrowserContext::Initialize() {
|
||||||
auto prefs_path = GetPath().Append(FILE_PATH_LITERAL("Preferences"));
|
auto prefs_path = GetPath().Append(FILE_PATH_LITERAL("Preferences"));
|
||||||
PrefServiceBuilder builder;
|
PrefServiceBuilder builder;
|
||||||
builder.WithUserFilePrefs(prefs_path,
|
builder.WithUserFilePrefs(prefs_path,
|
||||||
|
|
|
@ -22,6 +22,8 @@ public:
|
||||||
BrowserContext();
|
BrowserContext();
|
||||||
~BrowserContext();
|
~BrowserContext();
|
||||||
|
|
||||||
|
void Initialize();
|
||||||
|
|
||||||
net::URLRequestContextGetter* CreateRequestContext(content::ProtocolHandlerMap*);
|
net::URLRequestContextGetter* CreateRequestContext(content::ProtocolHandlerMap*);
|
||||||
|
|
||||||
PrefService* prefs() { return prefs_.get(); }
|
PrefService* prefs() { return prefs_.get(); }
|
||||||
|
|
|
@ -22,6 +22,7 @@ BrowserMainParts::~BrowserMainParts() {
|
||||||
|
|
||||||
void BrowserMainParts::PreMainMessageLoopRun() {
|
void BrowserMainParts::PreMainMessageLoopRun() {
|
||||||
browser_context_.reset(CreateBrowserContext());
|
browser_context_.reset(CreateBrowserContext());
|
||||||
|
browser_context_->Initialize();
|
||||||
|
|
||||||
// These two objects are owned by devtools_http_handler_.
|
// These two objects are owned by devtools_http_handler_.
|
||||||
auto delegate = new DevToolsDelegate;
|
auto delegate = new DevToolsDelegate;
|
||||||
|
|
Loading…
Reference in a new issue