mirror of
https://github.com/electron/electron.git
synced 2026-02-19 03:14:51 -05:00
refactor: add ElectronBrowserContext::GetDefaultBrowserContext() (#46065)
* refactor: add ElectronBrowserContext::DestroyAllContexts()
Simpler semantics than previous implementation; also hides the
"default context must be destroyed last" implementation detail.
* refactor: add ElectronBrowserContext::GetDefaultBrowserContext()
clearer semantics than everyone calling From("", false)
This commit is contained in:
@@ -119,7 +119,7 @@ bool GlobalShortcut::Register(const ui::Accelerator& accelerator,
|
||||
}
|
||||
|
||||
if (instance->IsRegistrationHandledExternally()) {
|
||||
auto* context = ElectronBrowserContext::From("", false);
|
||||
auto* context = ElectronBrowserContext::GetDefaultBrowserContext();
|
||||
PrefService* prefs = context->prefs();
|
||||
|
||||
// Need a unique profile id. Set one if not generated yet, otherwise re-use
|
||||
|
||||
@@ -1679,7 +1679,7 @@ gin::Handle<Session> Session::FromPartition(v8::Isolate* isolate,
|
||||
ElectronBrowserContext* browser_context;
|
||||
if (partition.empty()) {
|
||||
browser_context =
|
||||
ElectronBrowserContext::From("", false, std::move(options));
|
||||
ElectronBrowserContext::GetDefaultBrowserContext(std::move(options));
|
||||
} else if (partition.starts_with(kPersistPrefix)) {
|
||||
std::string name = partition.substr(8);
|
||||
browser_context =
|
||||
|
||||
Reference in New Issue
Block a user