refactor: add SessionPreferences::CreateForBrowserContext() (#38713)

Copy the NativeWindowRelay::CreateForWebContents() idiom
to simplify SessionPreferences's constructor and lifecycle.

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
This commit is contained in:
trop[bot]
2023-06-09 12:21:30 -07:00
committed by GitHub
parent 9a64d47132
commit 744b8dfc31
3 changed files with 12 additions and 4 deletions

View File

@@ -345,7 +345,7 @@ Session::Session(v8::Isolate* isolate, ElectronBrowserContext* browser_context)
// Observe DownloadManager to get download notifications.
browser_context->GetDownloadManager()->AddObserver(this);
new SessionPreferences(browser_context);
SessionPreferences::CreateForBrowserContext(browser_context);
protocol_.Reset(isolate, Protocol::Create(isolate, browser_context).ToV8());