Store BrowserContext in ref-counted ptr
This commit is contained in:
parent
3773f81fd5
commit
ba25bed45b
3 changed files with 7 additions and 14 deletions
|
@ -52,19 +52,13 @@ AtomBrowserMainParts* AtomBrowserMainParts::Get() {
|
||||||
|
|
||||||
content::BrowserContext* AtomBrowserMainParts::GetBrowserContextForPartition(
|
content::BrowserContext* AtomBrowserMainParts::GetBrowserContextForPartition(
|
||||||
const std::string& partition, bool in_memory) {
|
const std::string& partition, bool in_memory) {
|
||||||
if (browser_context_map_.contains(partition))
|
if (ContainsKey(browser_context_map_, partition))
|
||||||
return browser_context_map_.get(partition);
|
return browser_context_map_[partition].get();
|
||||||
|
|
||||||
scoped_ptr<brightray::BrowserContext> browser_context(CreateBrowserContext());
|
brightray::BrowserContext* browser_context = CreateBrowserContext();
|
||||||
<<<<<<< HEAD
|
|
||||||
browser_context->Initialize(partition_path.AsUTF8Unsafe(), in_memory);
|
|
||||||
browser_context_map_.set(id, browser_context.Pass());
|
|
||||||
return browser_context_map_.get(id);
|
|
||||||
=======
|
|
||||||
browser_context->Initialize(partition, in_memory);
|
browser_context->Initialize(partition, in_memory);
|
||||||
browser_context_map_.set(partition, browser_context.Pass());
|
browser_context_map_[partition] = make_scoped_refptr(browser_context);
|
||||||
return browser_context_map_.get(partition);
|
return browser_context;
|
||||||
>>>>>>> Pass partition name instead of path to BrowserContext
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AtomBrowserMainParts::RegisterDestructionCallback(
|
void AtomBrowserMainParts::RegisterDestructionCallback(
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "base/callback.h"
|
#include "base/callback.h"
|
||||||
#include "base/containers/scoped_ptr_hash_map.h"
|
|
||||||
#include "base/timer/timer.h"
|
#include "base/timer/timer.h"
|
||||||
#include "brightray/browser/browser_main_parts.h"
|
#include "brightray/browser/browser_main_parts.h"
|
||||||
#include "content/public/browser/browser_context.h"
|
#include "content/public/browser/browser_context.h"
|
||||||
|
@ -79,7 +78,7 @@ class AtomBrowserMainParts : public brightray::BrowserMainParts {
|
||||||
std::list<base::Closure> destruction_callbacks_;
|
std::list<base::Closure> destruction_callbacks_;
|
||||||
|
|
||||||
// partition_id => browser_context
|
// partition_id => browser_context
|
||||||
base::ScopedPtrHashMap<std::string, scoped_ptr<brightray::BrowserContext>>
|
std::map<std::string, scoped_refptr<brightray::BrowserContext>>
|
||||||
browser_context_map_;
|
browser_context_map_;
|
||||||
|
|
||||||
static AtomBrowserMainParts* self_;
|
static AtomBrowserMainParts* self_;
|
||||||
|
|
2
vendor/brightray
vendored
2
vendor/brightray
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 55bab304fd1c92a79e636bca0313f7cbda000c06
|
Subproject commit ca80107e3dec28d5b49d64da9985525c3e2c4e84
|
Loading…
Reference in a new issue